setting_item_container.dart 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import 'package:cs_resources/constants/color_constants.dart';
  2. import 'package:cs_resources/generated/assets.dart';
  3. import 'package:cs_resources/theme/app_colors_theme.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:widgets/ext/ex_widget.dart';
  6. import 'package:widgets/my_load_image.dart';
  7. import 'package:widgets/my_text_view.dart';
  8. /*
  9. * 设置页面的Item容器,左侧图标,中间文本,右侧箭头
  10. */
  11. class SettingItemContainer extends StatelessWidget {
  12. final String? iconPath;
  13. final String title;
  14. final bool isShowMoreIcon;
  15. final Widget? rightWidget;
  16. SettingItemContainer({this.iconPath, this.isShowMoreIcon = true, required this.title, this.rightWidget});
  17. @override
  18. Widget build(BuildContext context) {
  19. return Container(
  20. width: double.infinity,
  21. height: 60,
  22. margin: const EdgeInsets.symmetric(vertical: 5, horizontal: 15),
  23. padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 19),
  24. decoration: BoxDecoration(
  25. color: context.appColors.whiteBG, // 设置背景颜色和不透明度
  26. borderRadius: BorderRadius.circular(10.0), // 设置圆角
  27. ),
  28. child: Row(
  29. mainAxisSize: MainAxisSize.max,
  30. mainAxisAlignment: MainAxisAlignment.start,
  31. crossAxisAlignment: CrossAxisAlignment.center,
  32. children: [
  33. iconPath == null ? const SizedBox() : MyAssetImage(iconPath!, width: 25, height: 25).marginOnly(right: 11),
  34. MyTextView(
  35. title,
  36. isFontMedium: true,
  37. fontSize: 15,
  38. marginRight: 11,
  39. textColor: context.appColors.textBlack,
  40. ).expanded(),
  41. rightWidget == null ? const SizedBox() : rightWidget!,
  42. isShowMoreIcon ? const MyAssetImage(Assets.baseLibItemMoreBlack, width: 6.5, height: 11.5).marginOnly(left: 12) : const SizedBox()
  43. ],
  44. ),
  45. );
  46. }
  47. }