import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:vbvs_app/common/color/appConstants.dart'; import 'package:vbvs_app/common/color/appFontsize.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/controller/mh/address_list_controller.dart'; import 'package:vbvs_app/pages/device_control/EmptyMessageWidget.dart'; import 'package:vbvs_app/pages/device_control/address_module_widget.dart'; class AddressListPage extends GetView { final scaffoldKey = GlobalKey(); BoxConstraints? bodysize; // AddressListPage() { // controller.getAddressList(); // } @override Widget build(BuildContext context) { return LayoutBuilder(builder: (context, cc) { bodysize = cc; return GestureDetector( onTap: () => FocusScope.of(context).unfocus(), child: Container( decoration: const BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/new_background.png'), // 本地图片 fit: BoxFit.fill, // 填满整个 Container ), ), child: Scaffold( backgroundColor: Colors.transparent, appBar: AppBar( backgroundColor: Colors.transparent, automaticallyImplyLeading: false, iconTheme: IconThemeData(color: Colors.white), titleSpacing: 0, title: SizedBox( width: double.infinity, height: 180.rpx, child: Stack( alignment: Alignment.center, children: [ // 中间居中的标题 Text( '地址管理', textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontSize: 30.rpx, ), ), // 左侧图标 Positioned( left: 20.rpx, child: returnIconButtomNew, ), ], ), ), centerTitle: false, ), body: Container( width: bodysize!.maxWidth, height: bodysize!.maxHeight * 1, child: Column( mainAxisSize: MainAxisSize.max, children: [ Obx(() { if (controller.model.addressList!.isEmpty) { // 如果地址列表为空,显示 EmptyMessageWidget return Expanded( child: EmptyMessageWidget(), ); } else { // 如果地址列表不为空,显示地址列表 return Expanded( child: Container( width: bodysize!.maxWidth, height: bodysize!.maxHeight * 1, decoration: BoxDecoration( color: Color(0xFFF6F6F6), ), child: Column( mainAxisSize: MainAxisSize.max, children: [ Align( alignment: AlignmentDirectional(-1, 0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( 31, 27, 0, 26), child: Text( '我的地址', style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: 'Readex Pro', fontSize: AppFontsize.title_size, letterSpacing: 0, fontWeight: FontWeight.w600, ), ), ), ), Expanded( child: Obx(() => ListView( shrinkWrap: true, scrollDirection: Axis.vertical, children: (controller.model.addressList! .asMap() .entries .map((e) => AddressModuleWidget( index: e.key, addressListController: controller, )) .toList() as List) .divide(const SizedBox(height: 10)) .addToEnd(const SizedBox( height: AppConstants .list_end_height)), )), ), ], ), ), ); } }), Align( alignment: AlignmentDirectional(0, 1), child: Padding( padding: EdgeInsetsDirectional.fromSTEB(15, 15, 15, AppConstants.page_button_bottom_padding), child: Container( width: bodysize!.maxWidth, height: bodysize!.maxHeight * 0.056, decoration: BoxDecoration( // color: Color(0xFFF6F6F6), border: Border.all(width: 0, color: Color(0XFF85F5FF)), borderRadius: BorderRadius.circular(12), ), child: TextButton( onPressed: () { controller.model.address = {'isChecked': false}; controller.model.type = 1; Get.toNamed("/editAddressPage"); }, style: TextButton.styleFrom( backgroundColor: Colors.transparent, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), padding: EdgeInsets.symmetric(horizontal: 24), // 按钮内边距 ), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Baseline( baselineType: TextBaseline.alphabetic, baseline: AppFontsize.normal_text_size * 1.6, // 调整基线位置 child: Text( '+', style: FlutterFlowTheme.of(context) .titleSmall .override( fontFamily: 'Readex Pro', color: Color(0xFF85F5FF), fontSize: AppFontsize.normal_text_size + 12, // 让加号比文字稍大 letterSpacing: 0, ), ), ), SizedBox(width: 10), // 加号和文字间距 Text( '添加新地址', style: FlutterFlowTheme.of(context) .titleSmall .override( fontFamily: 'Readex Pro', color: Color(0xFF85F5FF), fontSize: AppFontsize.normal_text_size, letterSpacing: 0, ), ), ], ), ), ), ), ), ], ), ), ), )); }); } }