import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; class TransferSmartLockPage extends StatefulWidget { const TransferSmartLockPage({Key? key}) : super(key: key); @override State createState() => _TransferSmartLockPageState(); } class _TransferSmartLockPageState extends State { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( barTitle: TranslationLoader.lanKeys!.selectiveLock!.tr, haveBack: true, backgroundColor: AppColors.mainColor, actionsList: [ TextButton( onPressed: () {}, child: Text( '全选', style: TextStyle(color: Colors.white, fontSize: 24.sp), )) ], ), body: Column( children: [ _searchWidget(), SizedBox( height: 10.h, ), Expanded(child: _buildMainUI()), SizedBox( height: 20.h, ), _buildNextBtn(), SizedBox( height: 64.h, ) ], ), ); } Widget _searchWidget() { return Container( height: 60.h, margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(5)), child: TextField( //输入框一行 maxLines: 1, // controller: _controller, autofocus: false, decoration: InputDecoration( //输入里面输入文字内边距设置 contentPadding: const EdgeInsets.only( top: 12.0, left: -19.0, right: -15.0, bottom: 8.0), hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr, hintStyle: TextStyle(fontSize: 22.sp, height: 3.0), //不需要输入框下划线 border: InputBorder.none, //左边图标设置 icon: Padding( padding: EdgeInsets.only( top: 20.h, bottom: 20.h, right: 20.w, left: 10.w), child: Image.asset( 'images/main/icon_main_search.png', width: 40.w, height: 40.w, ), ), ), ), ); } Widget _buildMainUI() { return ListView.separated( itemCount: 10, separatorBuilder: (context, index) { return Divider( height: 1, indent: 20.w, endIndent: 20.w, color: AppColors.greyLineColor, ); }, itemBuilder: (c, index) { return _electronicKeyItem('images/icon_lock.png', "张三", "2023.6.21 11.15", "2023.6.21 11.15", () { Navigator.pushNamed(context, Routers.authorizedAdminDetailPage); }); }); } Widget _electronicKeyItem(String lockTypeIcon, String lockTypeTitle, String beginTime, String endTime, Function() action) { return GestureDetector( child: Container( color: Colors.white, height: 90.h, child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( width: 20.w, ), GestureDetector( child: Image.asset( 'images/icon_round_unSelet.png', width: 22, height: 22, ), ), SizedBox( width: 16.w, ), Image.asset( 'images/icon_lockGroup_item.png', width: 36, height: 36, fit: BoxFit.fill, ), SizedBox( width: 10.w, ), Text( 'Daisy', style: TextStyle(fontSize: 22.sp, color: AppColors.blackColor), ) ], ), ), onTap: () {}, ); } Widget _buildNextBtn() { return GestureDetector( child: Container( color: Colors.grey, width: ScreenUtil().screenWidth, height: 64.h, child: TextButton( onPressed: () { Navigator.pushNamed(context, Routers.recipientInformationPage); }, child: Text( '下一步', style: TextStyle(fontSize: 28.sp, color: Colors.white), )), ), ); } }