添加钥匙管理记录页面

添加钥匙申请页面
添加选择设备页面
hmxc
张萌 4 years ago
parent 410bc98018
commit cd091a0cc8

@ -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<KeyApplyInputPage> {
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<TextInputFormatter> 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,
),
),
],
),
);
}
}

@ -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<KeyApplyRecordCard> {
@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,
...<Widget>[
_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,
],
);
}
}

@ -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<KeyApplyRecordPage>
with TickerProviderStateMixin {
List<String> _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();
},
),
);
}
}

@ -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<KeyApplyRecordView> {
@override
Widget build(BuildContext context) {
return ListView(
padding: EdgeInsets.symmetric(vertical: 24.w,horizontal: 32.w),
children: [
KeyApplyRecordCard(
index: widget.index,
)
],
);
}
}

@ -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,12 +39,15 @@ class _KeyManagePageState extends State<KeyManagePage>
return AkuScaffold(
title: '钥匙管理',
actions: [
InkWell(
Container(
padding: EdgeInsets.symmetric(vertical: 26.w, horizontal: 32.w),
child: InkWell(
onTap: () {
Get.to(() => AddPackagePage());
Get.to(() => KeyApplyRecordPage());
},
child: '申请记录'.text.size(26.sp).color(kTextPrimaryColor).make(),
),
),
],
appBarBottom: PreferredSize(
child: AkuTabBar(controller: _tabController, tabs: _tabs),
@ -56,7 +61,12 @@ class _KeyManagePageState extends State<KeyManagePage>
index: index,
)),
),
bottom: AkuBottomButton(title: '立即申请'),
bottom: AkuBottomButton(
title: '立即申请',
onTap: () {
Get.to(() => SelectPlacePage());
},
),
);
}
}

@ -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<SelectPlacePage> {
@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,
...<Widget>[
'剩余钥匙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(),
],
),
);
}
}
Loading…
Cancel
Save