parent
152c8ed209
commit
410bc98018
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.9 KiB |
@ -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 KeyManageCard extends StatefulWidget {
|
||||||
|
final int index;
|
||||||
|
KeyManageCard({Key key, this.index}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_KeyManageCardState createState() => _KeyManageCardState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _KeyManageCardState extends State<KeyManageCard> {
|
||||||
|
@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[1].text
|
||||||
|
.size(28.sp)
|
||||||
|
.bold
|
||||||
|
.color(KeyManageMap.keyStatusColor[1])
|
||||||
|
.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(1),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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,21 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class KeyManageMap {
|
||||||
|
static Map<int, String> keyStatus = {
|
||||||
|
1: '可申请',
|
||||||
|
2: '审核中',
|
||||||
|
3: '已通过',
|
||||||
|
4: '使用中',
|
||||||
|
5: '已驳回',
|
||||||
|
6: '钥匙已空'
|
||||||
|
};
|
||||||
|
static Map<int, Color> keyStatusColor = {
|
||||||
|
1: Color(0xFF2576E5),
|
||||||
|
2: Color(0xFFFFC40C),
|
||||||
|
3: Color(0xFF333333),
|
||||||
|
4: Color(0xFFFFC40C),
|
||||||
|
5: Color(0xFFE60E0E),
|
||||||
|
6: Color(0xFF999999),
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
import 'package:aku_community_manager/style/app_style.dart';
|
||||||
|
import 'package:aku_community_manager/ui/manage_pages/key_manage/key_manage_view.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';
|
||||||
|
import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:velocity_x/velocity_x.dart';
|
||||||
|
|
||||||
|
class KeyManagePage extends StatefulWidget {
|
||||||
|
KeyManagePage({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_KeyManagePageState createState() => _KeyManagePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _KeyManagePageState extends State<KeyManagePage>
|
||||||
|
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: '钥匙管理',
|
||||||
|
actions: [
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Get.to(() => AddPackagePage());
|
||||||
|
},
|
||||||
|
child: '申请记录'.text.size(26.sp).color(kTextPrimaryColor).make(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
appBarBottom: PreferredSize(
|
||||||
|
child: AkuTabBar(controller: _tabController, tabs: _tabs),
|
||||||
|
preferredSize: Size.fromHeight(88.w),
|
||||||
|
),
|
||||||
|
body: TabBarView(
|
||||||
|
controller: _tabController,
|
||||||
|
children: List.generate(
|
||||||
|
_tabs.length,
|
||||||
|
(index) => KeyManageView(
|
||||||
|
index: index,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
bottom: AkuBottomButton(title: '立即申请'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
import 'package:aku_community_manager/ui/manage_pages/key_manage/key_manage_card.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
|
||||||
|
class KeyManageView extends StatefulWidget {
|
||||||
|
final int index;
|
||||||
|
KeyManageView({Key key, this.index}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_KeyManageViewState createState() => _KeyManageViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _KeyManageViewState extends State<KeyManageView> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ListView(
|
||||||
|
padding: EdgeInsets.all(32.w),
|
||||||
|
children: [
|
||||||
|
KeyManageCard(
|
||||||
|
index: widget.index,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue