import 'package:cs_resources/constants/color_constants.dart';
import 'package:cs_resources/generated/assets.dart';
import 'package:cs_resources/theme/app_colors_theme.dart';
import 'package:flutter/material.dart';
import 'package:widgets/ext/ex_widget.dart';
import 'package:widgets/my_load_image.dart';
import 'package:widgets/my_text_view.dart';

/*
 * 设置页面的Item容器，左侧图标，中间文本，右侧箭头
 */
class SettingItemContainer extends StatelessWidget {
  final String? iconPath;
  final String title;
  final bool isShowMoreIcon;
  final Widget? rightWidget;

  SettingItemContainer({this.iconPath, this.isShowMoreIcon = true, required this.title, this.rightWidget});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      height: 60,
      margin: const EdgeInsets.symmetric(vertical: 5, horizontal: 15),
      padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 19),
      decoration: BoxDecoration(
        color: context.appColors.whiteBG, // 设置背景颜色和不透明度
        borderRadius: BorderRadius.circular(10.0), // 设置圆角
      ),
      child: Row(
        mainAxisSize: MainAxisSize.max,
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          iconPath == null ? const SizedBox() : MyAssetImage(iconPath!, width: 25, height: 25).marginOnly(right: 11),
          MyTextView(
            title,
            isFontMedium: true,
            fontSize: 15,
            marginRight: 11,
            textColor: context.appColors.textBlack,
          ).expanded(),
          rightWidget == null ? const SizedBox() : rightWidget!,
          isShowMoreIcon ? const MyAssetImage(Assets.baseLibItemMoreBlack, width: 6.5, height: 11.5).marginOnly(left: 12) : const SizedBox()
        ],
      ),
    );
  }
}
