import 'package:cs_resources/generated/assets.dart'; import 'package:cs_resources/generated/l10n.dart'; import 'package:cs_resources/theme/app_colors_theme.dart'; import 'package:domain/entity/user_me_entity.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'; class EstateItem extends StatelessWidget { final int childIndex; //组内的索引 final UserMeEstatesAccounts item; final VoidCallback deleteAction; final VoidCallback itemAction; const EstateItem({ required this.childIndex, required this.item, required this.deleteAction, required this.itemAction, }); @override Widget build(BuildContext context) { return Stack( children: [ Container( width: double.infinity, color: context.appColors.whiteBG, padding: const EdgeInsets.only(top: 22.5), margin: EdgeInsets.only(top: childIndex == 0 ? 0 : 10), child: Column( children: [ Row( children: [ MyLoadImage( item.avatar, width: 65, height: 65, isCircle: true, ).marginOnly( right: 17, left: 15, ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const SizedBox(height: 22.5), //姓名 MyTextView( item.name ?? "-", fontSize: 16, isFontBold: true, textColor: context.appColors.textBlack, maxLines: 2, ), MyTextView( item.type == "1" ? S.current.owner : S.current.tenant, fontSize: 15, isFontRegular: true, textColor: context.appColors.textBlack, ), MyTextView( item.unit?.address ?? "-", fontSize: 15, isFontRegular: true, textColor: context.appColors.textBlack, ), ], ).expanded(), ], ), const SizedBox(height: 22.5), Divider( height: 0.5, color: context.appColors.backgroundDark, ), Center( child: MyTextView( S.current.remove, paddingTop: 16, paddingBottom: 16, fontSize: 16, onClick: deleteAction, isFontMedium: true, textColor: context.appColors.textPrimary, ), ) ], ), ).onTap(itemAction), Visibility( visible: item.isDefault == 1, child: const MyAssetImage( Assets.profileMyEstateDefault, width: 76, height: 44, ), ).marginOnly(top: childIndex == 0 ? 0 : 10).alignRight(), MyTextView( S.current.approved, fontSize: 16, onClick: deleteAction, isFontMedium: true, textColor: context.appColors.textGreen, ).marginOnly(top: childIndex == 0 ? 46.5 : 56.5, right: 15).alignRight() ], ); } }