From cd091a0cc8ed714aa46202d29a21961d76dcd56b Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Fri, 14 May 2021 10:49:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=92=A5=E5=8C=99=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E8=AE=B0=E5=BD=95=E9=A1=B5=E9=9D=A2=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=92=A5=E5=8C=99=E7=94=B3=E8=AF=B7=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=20=E6=B7=BB=E5=8A=A0=E9=80=89=E6=8B=A9=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../key_manage/key_aplly_input_page.dart | 133 ++++++++++++++++++ .../key_manage/key_apply_record_card.dart | 127 +++++++++++++++++ .../key_manage/key_apply_record_page.dart | 56 ++++++++ .../key_manage/key_apply_record_view.dart | 25 ++++ .../key_manage/key_manage_page.dart | 22 ++- .../key_manage/select_place_page.dart | 89 ++++++++++++ 6 files changed, 446 insertions(+), 6 deletions(-) create mode 100644 lib/ui/manage_pages/key_manage/key_aplly_input_page.dart create mode 100644 lib/ui/manage_pages/key_manage/key_apply_record_card.dart create mode 100644 lib/ui/manage_pages/key_manage/key_apply_record_page.dart create mode 100644 lib/ui/manage_pages/key_manage/key_apply_record_view.dart create mode 100644 lib/ui/manage_pages/key_manage/select_place_page.dart diff --git a/lib/ui/manage_pages/key_manage/key_aplly_input_page.dart b/lib/ui/manage_pages/key_manage/key_aplly_input_page.dart new file mode 100644 index 0000000..a8dc11f --- /dev/null +++ b/lib/ui/manage_pages/key_manage/key_aplly_input_page.dart @@ -0,0 +1,133 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart'; +import 'package:bot_toast/bot_toast.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class KeyApplyInputPage extends StatefulWidget { + KeyApplyInputPage({Key key}) : super(key: key); + + @override + _KeyApplyInputPageState createState() => _KeyApplyInputPageState(); +} + +class _KeyApplyInputPageState extends State { + TextEditingController _nameController; + TextEditingController _phoneController; + TextEditingController _roleController; + TextEditingController _placeController; + bool get canSubmit { + if (TextUtil.isEmpty(_nameController.text)) { + BotToast.showText(text: '申请人姓名不能为空!'); + return false; + } + if (TextUtil.isEmpty(_phoneController.text)) { + BotToast.showText(text: '申请人联系方式不能为空!'); + return false; + } else if (!_phoneFormat(_phoneController.text)) { + BotToast.showText(text: '收件人联系方式格式错误!'); + return false; + } + if (TextUtil.isEmpty(_roleController.text)) { + BotToast.showText(text: '身份不能为空!'); + return false; + } + if (TextUtil.isEmpty(_placeController.text)) { + BotToast.showText(text: '对应设备不能为空!'); + return false; + } + return true; + } + + bool _phoneFormat(String phone) { + if ((phone.length != 11) || (phone.substring(0, 1) != '1')) { + return false; + } + return true; + } + + @override + void initState() { + super.initState(); + _nameController = TextEditingController(); + _phoneController = TextEditingController(); + _roleController = TextEditingController(); + _placeController = TextEditingController(); + } + + @override + void dispose() { + _nameController?.dispose(); + _phoneController?.dispose(); + _roleController?.dispose(); + _phoneController?.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '添加包裹', + backgroundColor: Colors.white, + body: Center( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: Column( + children: [ + _inputRowTile('申请人姓名', _nameController), + _inputRowTile('联系方式', _phoneController, + formatters: [FilteringTextInputFormatter.digitsOnly]), + _inputRowTile('身份', _roleController), + _inputRowTile('对应设备位置', _placeController), + ], + ), + ), + ), + bottom: AkuBottomButton( + title: '确认提交', + onTap: () async { + }, + ), + ); + } + + Widget _inputRowTile(String title, TextEditingController controller, + {String hintText, List formatters}) { + return Container( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 40.w.heightBox, + title.text.size(28.sp).color(kTextPrimaryColor).make(), + 32.w.heightBox, + TextField( + inputFormatters: formatters, + textAlign: TextAlign.start, + onChanged: (value) { + controller.text = value; + setState(() {}); + }, + decoration: InputDecoration( + hintText: hintText ?? '', + isDense: true, + contentPadding: EdgeInsets.zero, + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0xFFE8E8E8), width: 2.w), + ), + ), + style: TextStyle( + fontSize: 36.sp, + fontWeight: FontWeight.bold, + color: kTextPrimaryColor, + ), + ), + ], + ), + ); + } +} diff --git a/lib/ui/manage_pages/key_manage/key_apply_record_card.dart b/lib/ui/manage_pages/key_manage/key_apply_record_card.dart new file mode 100644 index 0000000..35354b8 --- /dev/null +++ b/lib/ui/manage_pages/key_manage/key_apply_record_card.dart @@ -0,0 +1,127 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/aku_divider.dart'; +import 'package:aku_community_manager/ui/manage_pages/key_manage/key_manage_map.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart'; +class KeyApplyRecordCard extends StatefulWidget { + final int index; + KeyApplyRecordCard({Key key, this.index}) : super(key: key); + + @override + _KeyApplyRecordCardState createState() => _KeyApplyRecordCardState(); +} + +class _KeyApplyRecordCardState extends State { + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(8.w)), + padding: EdgeInsets.all(24.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + '3-1-203配电箱' + .text + .size(32.sp) + .color(kTextPrimaryColor) + .bold + .make(), + Spacer(), + KeyManageMap.keyStatus[2].text + .size(28.sp) + .bold + .color(KeyManageMap.keyStatusColor[2]) + .make() + ], + ), + 16.w.heightBox, + AkuDivider.horizontal(), + 24.w.heightBox, + ...[ + _rowTile(R.ASSETS_MANAGE_KEY_PNG, '可申请钥匙数/钥匙总数', + '2/5'.text.size(24.sp).color(kTextSubColor).make()), + _rowTile(R.ASSETS_MANAGE_LOCK_PNG, '对应设备位置', + '2栋1楼2-3'.text.size(24.sp).color(kTextSubColor).make()), + _rowTile(R.ASSETS_OUTDOOR_IC_ADDRESS_PNG, '存放地址', + '物业管理处2号柜'.text.size(24.sp).color(kTextSubColor).make()), + ].sepWidget(separate: 12.w.heightBox), + _getBottomButtons(2), + ], + ), + ); + } + + Widget _getBottomButtons(int status) { + MaterialButton button; + switch (status) { + case 1: + button = _bottomButton('申请钥匙', () {}, Color(0xFFFFC40C), Colors.black); + break; + case 2: + break; + case 3: + button = _bottomButton('确认领取', () {}, Color(0xFFFFC40C), Colors.black); + break; + case 4: + button = _bottomButton('归还钥匙', () {}, Colors.black, Colors.white); + break; + case 5: + button = _bottomButton('重新提交', () {}, Colors.white, Colors.black); + break; + case 6: + button = _bottomButton('联系物业', () {}, Colors.white, Colors.black); + break; + default: + } + return button == null + ? SizedBox() + : Padding( + padding: EdgeInsets.only(top: 40.w), + child: Row( + children: [ + Spacer(), + button, + ], + ), + ); + } + + Widget _bottomButton( + String title, Function onPressed, Color color, Color textColor) { + return MaterialButton( + height: 52.w, + padding: EdgeInsets.symmetric(vertical: 8.w, horizontal: 24.w), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(74.w)), + color: color, + onPressed: onPressed, + elevation: 0, + focusElevation: 0, + hoverElevation: 0, + highlightElevation: 0, + child: title.text.size(26.sp).color(textColor).make(), + ); + } + + Widget _rowTile(String iconPath, String title, Widget content) { + return Row( + children: [ + SizedBox( + width: 40.w, + height: 40.w, + child: Image.asset(iconPath), + ), + 12.w.widthBox, + title.text.size(24.sp).color(kTextSubColor).make(), + Spacer(), + content, + ], + ); + } +} + diff --git a/lib/ui/manage_pages/key_manage/key_apply_record_page.dart b/lib/ui/manage_pages/key_manage/key_apply_record_page.dart new file mode 100644 index 0000000..f1474c2 --- /dev/null +++ b/lib/ui/manage_pages/key_manage/key_apply_record_page.dart @@ -0,0 +1,56 @@ +import 'package:aku_community_manager/ui/manage_pages/key_manage/key_apply_record_view.dart'; +import 'package:aku_community_manager/ui/manage_pages/key_manage/select_place_page.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class KeyApplyRecordPage extends StatefulWidget { + KeyApplyRecordPage({Key key}) : super(key: key); + + @override + _KeyApplyRecordPageState createState() => _KeyApplyRecordPageState(); +} + +class _KeyApplyRecordPageState extends State + with TickerProviderStateMixin { + List _tabs = ['全部', '审核中', '已通过', '已驳回']; + TabController _tabController; + @override + void initState() { + super.initState(); + _tabController = TabController(length: _tabs.length, vsync: this); + } + + @override + void dispose() { + _tabController?.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '钥匙管理', + appBarBottom: PreferredSize( + child: AkuTabBar(controller: _tabController, tabs: _tabs), + preferredSize: Size.fromHeight(88.w), + ), + body: TabBarView( + controller: _tabController, + children: List.generate( + _tabs.length, + (index) => KeyApplyRecordView( + index: index, + )), + ), + bottom: AkuBottomButton( + title: '立即申请', + onTap: () { + SelectPlacePage(); + }, + ), + ); + } +} diff --git a/lib/ui/manage_pages/key_manage/key_apply_record_view.dart b/lib/ui/manage_pages/key_manage/key_apply_record_view.dart new file mode 100644 index 0000000..e889736 --- /dev/null +++ b/lib/ui/manage_pages/key_manage/key_apply_record_view.dart @@ -0,0 +1,25 @@ +import 'package:aku_community_manager/ui/manage_pages/key_manage/key_apply_record_card.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class KeyApplyRecordView extends StatefulWidget { + final int index; + KeyApplyRecordView({Key key, this.index}) : super(key: key); + + @override + _KeyApplyRecordViewState createState() => _KeyApplyRecordViewState(); +} + +class _KeyApplyRecordViewState extends State { + @override + Widget build(BuildContext context) { + return ListView( + padding: EdgeInsets.symmetric(vertical: 24.w,horizontal: 32.w), + children: [ + KeyApplyRecordCard( + index: widget.index, + ) + ], + ); + } +} diff --git a/lib/ui/manage_pages/key_manage/key_manage_page.dart b/lib/ui/manage_pages/key_manage/key_manage_page.dart index dd32041..096602f 100644 --- a/lib/ui/manage_pages/key_manage/key_manage_page.dart +++ b/lib/ui/manage_pages/key_manage/key_manage_page.dart @@ -1,5 +1,7 @@ import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/manage_pages/key_manage/key_apply_record_page.dart'; import 'package:aku_community_manager/ui/manage_pages/key_manage/key_manage_view.dart'; +import 'package:aku_community_manager/ui/manage_pages/key_manage/select_place_page.dart'; import 'package:aku_community_manager/ui/manage_pages/packages_manage/add_package_page.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart'; @@ -37,11 +39,14 @@ class _KeyManagePageState extends State return AkuScaffold( title: '钥匙管理', actions: [ - InkWell( - onTap: () { - Get.to(() => AddPackagePage()); - }, - child: '申请记录'.text.size(26.sp).color(kTextPrimaryColor).make(), + Container( + padding: EdgeInsets.symmetric(vertical: 26.w, horizontal: 32.w), + child: InkWell( + onTap: () { + Get.to(() => KeyApplyRecordPage()); + }, + child: '申请记录'.text.size(26.sp).color(kTextPrimaryColor).make(), + ), ), ], appBarBottom: PreferredSize( @@ -56,7 +61,12 @@ class _KeyManagePageState extends State index: index, )), ), - bottom: AkuBottomButton(title: '立即申请'), + bottom: AkuBottomButton( + title: '立即申请', + onTap: () { + Get.to(() => SelectPlacePage()); + }, + ), ); } } diff --git a/lib/ui/manage_pages/key_manage/select_place_page.dart b/lib/ui/manage_pages/key_manage/select_place_page.dart new file mode 100644 index 0000000..617a9f1 --- /dev/null +++ b/lib/ui/manage_pages/key_manage/select_place_page.dart @@ -0,0 +1,89 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/manage_pages/key_manage/key_aplly_input_page.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:aku_community_manager/const/resource.dart'; +import 'package:get/get.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart'; + +class SelectPlacePage extends StatefulWidget { + SelectPlacePage({Key key}) : super(key: key); + + @override + _SelectPlacePageState createState() => _SelectPlacePageState(); +} + +class _SelectPlacePageState extends State { + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '选择设备', + // actions: [ + // IconButton(icon: Icon(CupertinoIcons.search,size: 40.w,), onPressed: (){ + + // }), + // ], + body: ListView( + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + children: [_selectCard()], + ), + ); + } + + Widget _selectCard() { + return MaterialButton( + elevation: 0, + minWidth: double.infinity, + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 24.w), + color: Colors.white, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.w)), + onPressed: () { + Get.to(() => KeyApplyInputPage()); + }, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: 189.w, + height: 184.w, + child: FadeInImage.assetNetwork( + placeholder: R.ASSETS_PLACEHOLDER_WEBP, + image: '', + fit: BoxFit.cover, + ), + ), + 24.w.widthBox, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + '3-1-102会议室' + .text + .size(32.sp) + .bold + .color(kTextPrimaryColor) + .make(), + Spacer(), + Icon( + CupertinoIcons.chevron_right, + size: 40.w, + ), + ], + ), + 12.w.heightBox, + ...[ + '剩余钥匙:2个'.text.size(24.sp).color(kTextSubColor).make(), + '钥匙总数:5个'.text.size(24.sp).color(kTextSubColor).make(), + '设备位置:1号楼楼下'.text.size(24.sp).color(kTextSubColor).make(), + ].sepWidget(separate: 12.w.heightBox) + ], + ).expand(), + ], + ), + ); + } +}