221 lines
7.7 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/mine/mineSet/transferSmartLock/selectBranch/selectBranch_state.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart';
import '../recipientInformation/recipientInformation_entity.dart';
import 'selectBranch_logic.dart';
class SelectBranchPage extends StatefulWidget {
const SelectBranchPage({Key? key}) : super(key: key);
@override
State<SelectBranchPage> createState() => _SelectBranchPageState();
}
class _SelectBranchPageState extends State<SelectBranchPage> {
final SelectBranchLogic logic = Get.put(SelectBranchLogic());
final SelectBranchState state = Get.find<SelectBranchLogic>().state;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
2024-08-01 18:54:32 +08:00
barTitle: '接收人信息'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
body: Column(
children: <Widget>[
_buildTopView(),
SizedBox(height: 20.h),
Expanded(child: _buildMainUI()),
_buildNextBtn(),
SizedBox(height: 64.h)
],
),
);
}
Widget _buildTopView() {
return Container(
height: 120.h,
width: ScreenUtil().screenWidth,
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 40.w, top: 20.h, bottom: 16.h),
child: Text(
'公寓'.tr,
style: TextStyle(fontSize: 28.sp),
),
),
Obx(() => Padding(
padding: EdgeInsets.only(left: 40.w),
child: Text('管理员'.tr + '${state.receiverNumber.value}',
style: TextStyle(
color: AppColors.darkGrayTextColor, fontSize: 24.sp)),
))
],
),
);
}
Widget _buildMainUI() {
return ListView.separated(
itemCount: 1,
separatorBuilder: (BuildContext context, int index) {
return Divider(
height: 1,
indent: 20.w,
endIndent: 20.w,
color: AppColors.greyLineColor,
);
},
itemBuilder: (BuildContext c, int index) {
return _electronicKeyItem('images/normal_circle.png', '', () {});
});
}
Widget _electronicKeyItem(
String leftIcon, String leftTitle, Function() action) {
return GestureDetector(
child: Container(
color: Colors.white,
height: 70.h,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(
width: 40.w,
),
GestureDetector(
child: Image.asset(
leftIcon,
width: 16,
height: 16,
),
),
SizedBox(
width: 16.w,
),
Text(
leftTitle,
style: TextStyle(fontSize: 24.sp),
)
],
),
),
onTap: () {},
);
}
Widget _buildNextBtn() {
return GestureDetector(
child: Container(
color: AppColors.mainColor,
width: ScreenUtil().screenWidth,
height: 64.h,
child: TextButton(
onPressed: () {
// showCupertinoAlertDialog(context, RecipientInformationData());
},
child: Text(
'下一步'.tr,
style: TextStyle(fontSize: 28.sp, color: Colors.white),
)),
),
);
}
void showCupertinoAlertDialog(BuildContext context, RecipientInformationData recipientInformationData) {
showGeneralDialog(
context: context,
barrierColor: Colors.black.withOpacity(.5),
barrierDismissible: true,
barrierLabel: '',
transitionDuration: const Duration(milliseconds: 200),
transitionBuilder: (BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child) {
return ScaleTransition(scale: animation, child: child);
},
pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
// recipientInformationData.nickname = "张三张三张三";
return Center(
child: Container(
width: 400.w,
height: 370.h,
color: Colors.white,
child: Column(
children: <Widget>[
SizedBox(height: 20.h),
Text('转移确认'.tr, style: TextStyle(fontSize: 24.sp)),
SizedBox(height: 20.h),
Image.asset('images/icon_lockGroup_item.png', width: 70.h, height: 70.h, fit: BoxFit.fill),
SizedBox(height: 15.h),
Stack(
alignment: Alignment.center,
clipBehavior: Clip.none,
children: <Widget>[
Text(recipientInformationData.nickname!, style: TextStyle(fontSize: 22.sp)),
Positioned(
left: (recipientInformationData.nickname!.length*19.w).w,
child: Container(
width: 80.w,
color: Colors.red,
child: Center(child: Text(state.type.value == 1 ? '个人用户' : '星寓', style: TextStyle(fontSize: 18.sp, color: Colors.white))),
),
)
],
),
SizedBox(height: 8.h),
Text(recipientInformationData.userid!, style: TextStyle(fontSize: 22.sp)),
SizedBox(height: 8.h),
Text('本次共转移${state.idList.value.length}把智能锁', style: TextStyle(fontSize: 20.sp)),
SizedBox(height: 20.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ElevatedButton(
2024-05-30 09:27:29 +08:00
onPressed: Get.back,
style: ElevatedButton.styleFrom(
2024-05-30 09:27:29 +08:00
foregroundColor: AppColors.appBarIconColor, backgroundColor: Colors.grey,
minimumSize: Size(110.w, 45.h),
padding: const EdgeInsets.symmetric(horizontal: 16),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(2)),
),
),
child: Text('取消'.tr, style: TextStyle(fontSize: 22.sp)),
),
ElevatedButton(
2024-05-30 09:27:29 +08:00
onPressed: Get.back,
style: ElevatedButton.styleFrom(
2024-05-30 09:27:29 +08:00
foregroundColor: AppColors.appBarIconColor, backgroundColor: AppColors.mainColor,
minimumSize: Size(110.w, 45.h),
padding: const EdgeInsets.symmetric(horizontal: 16),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(2)),
),
),
child: Text('确认', style: TextStyle(fontSize: 22.sp)),
),
],
)
],
),
),
);
});
}
}