item_estate.dart 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import 'package:cs_resources/generated/assets.dart';
  2. import 'package:cs_resources/generated/l10n.dart';
  3. import 'package:cs_resources/theme/app_colors_theme.dart';
  4. import 'package:domain/entity/user_me_entity.dart';
  5. import 'package:flutter/material.dart';
  6. import 'package:widgets/ext/ex_widget.dart';
  7. import 'package:widgets/my_load_image.dart';
  8. import 'package:widgets/my_text_view.dart';
  9. class EstateItem extends StatelessWidget {
  10. final int childIndex; //组内的索引
  11. final UserMeEstatesAccounts item;
  12. final VoidCallback deleteAction;
  13. final VoidCallback itemAction;
  14. const EstateItem({
  15. required this.childIndex,
  16. required this.item,
  17. required this.deleteAction,
  18. required this.itemAction,
  19. });
  20. @override
  21. Widget build(BuildContext context) {
  22. return Stack(
  23. children: [
  24. Container(
  25. width: double.infinity,
  26. color: context.appColors.whiteBG,
  27. padding: const EdgeInsets.only(top: 22.5),
  28. margin: EdgeInsets.only(top: childIndex == 0 ? 0 : 10),
  29. child: Column(
  30. children: [
  31. Row(
  32. children: [
  33. MyLoadImage(
  34. item.avatar,
  35. width: 65,
  36. height: 65,
  37. isCircle: true,
  38. ).marginOnly(
  39. right: 17,
  40. left: 15,
  41. ),
  42. Column(
  43. crossAxisAlignment: CrossAxisAlignment.start,
  44. children: [
  45. const SizedBox(height: 22.5),
  46. //姓名
  47. MyTextView(
  48. item.name ?? "-",
  49. fontSize: 16,
  50. isFontBold: true,
  51. textColor: context.appColors.textBlack,
  52. maxLines: 2,
  53. ),
  54. MyTextView(
  55. item.type == "1" ? S.current.owner : S.current.tenant,
  56. fontSize: 15,
  57. isFontRegular: true,
  58. textColor: context.appColors.textBlack,
  59. ),
  60. MyTextView(
  61. item.unit?.address ?? "-",
  62. fontSize: 15,
  63. isFontRegular: true,
  64. textColor: context.appColors.textBlack,
  65. ),
  66. ],
  67. ).expanded(),
  68. ],
  69. ),
  70. const SizedBox(height: 22.5),
  71. Divider(
  72. height: 0.5,
  73. color: context.appColors.backgroundDark,
  74. ),
  75. Center(
  76. child: MyTextView(
  77. S.current.remove,
  78. paddingTop: 16,
  79. paddingBottom: 16,
  80. fontSize: 16,
  81. onClick: deleteAction,
  82. isFontMedium: true,
  83. textColor: context.appColors.textPrimary,
  84. ),
  85. )
  86. ],
  87. ),
  88. ).onTap(itemAction),
  89. Visibility(
  90. visible: item.isDefault == 1,
  91. child: const MyAssetImage(
  92. Assets.profileMyEstateDefault,
  93. width: 76,
  94. height: 44,
  95. ),
  96. ).marginOnly(top: childIndex == 0 ? 0 : 10).alignRight(),
  97. MyTextView(
  98. S.current.approved,
  99. fontSize: 16,
  100. onClick: deleteAction,
  101. isFontMedium: true,
  102. textColor: context.appColors.textGreen,
  103. ).marginOnly(top: childIndex == 0 ? 46.5 : 56.5, right: 15).alignRight()
  104. ],
  105. );
  106. }
  107. }