魏少阳 15af50d951 1、完善星锁APP国际化 36种语言。
2、修复国际化问题
2024-10-15 18:32:11 +08:00

221 lines
7.7 KiB
Dart
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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(
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(
onPressed: Get.back,
style: ElevatedButton.styleFrom(
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(
onPressed: Get.back,
style: ElevatedButton.styleFrom(
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)),
),
],
)
],
),
),
);
});
}
}