物品清单页面添加验证,添加tabbar

hmxc
小赖 4 years ago
parent 5d5147ea0b
commit 03a4388174

@ -1,5 +1,7 @@
import 'package:aku_community_manager/mock_models/borrow/borrow_data.dart';
import 'package:aku_community_manager/mock_models/borrow/borrow_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_model.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/sub_pages/borrow_manager/add_borrow_object_page.dart';
@ -9,6 +11,7 @@ import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:aku_community_manager/const/resource.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
class AllBorrowGoods extends StatefulWidget {
AllBorrowGoods({Key key}) : super(key: key);
@ -20,22 +23,25 @@ class AllBorrowGoods extends StatefulWidget {
class _AllBorrowGoodsState extends State<AllBorrowGoods> {
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context);
return AkuScaffold(
title: '全部物品',
actions: [
AkuMaterialButton(
minWidth: 120.w,
onPressed: () {
Get.to(AddBorrowObjectPage());
},
child: Text(
'新增',
style: TextStyle(
fontSize: 28.w,
color: AppStyle.primaryTextColor,
),
),
),
userProvider.userInfoModel.role == USER_ROLE.MANAGER
? AkuMaterialButton(
minWidth: 120.w,
onPressed: () {
Get.to(AddBorrowObjectPage());
},
child: Text(
'新增',
style: TextStyle(
fontSize: 28.w,
color: AppStyle.primaryTextColor,
),
),
)
: SizedBox(),
],
body: ListView.builder(
padding: EdgeInsets.symmetric(

@ -1,9 +1,12 @@
import 'package:aku_community_manager/mock_models/borrow/borrow_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_model.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class BorrowItemDetailPage extends StatefulWidget {
final SingleBorrowGoods item;
@ -30,24 +33,27 @@ class _BorrowItemDetailPageState extends State<BorrowItemDetailPage> {
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context);
return AkuScaffold(
title: '物品详情',
actions: [
AkuMaterialButton(
minWidth: 120.w,
onPressed: () {
setState(() {
_isEditing = !_isEditing;
});
},
child: Text(
_isEditing ? '完成' : '编辑',
style: TextStyle(
fontSize: 28.w,
color: AppStyle.primaryTextColor,
),
),
),
userProvider.userInfoModel.role == USER_ROLE.MANAGER
? AkuMaterialButton(
minWidth: 120.w,
onPressed: () {
setState(() {
_isEditing = !_isEditing;
});
},
child: Text(
_isEditing ? '完成' : '编辑',
style: TextStyle(
fontSize: 28.w,
color: AppStyle.primaryTextColor,
),
),
)
: SizedBox(),
],
body: ListView(
padding: EdgeInsets.symmetric(vertical: 16.w),

@ -27,7 +27,7 @@ class _BorrowItemPageState extends State<BorrowItemPage> {
return AkuScaffold(
title: '物品查看',
actions: [
userProvider.userInfoModel.role != USER_ROLE.MANAGER
userProvider.userInfoModel.role == USER_ROLE.MANAGER
? AkuMaterialButton(
minWidth: 120.w,
onPressed: () {
@ -76,7 +76,7 @@ class _BorrowItemPageState extends State<BorrowItemPage> {
),
),
Spacer(),
userProvider.userInfoModel.role != USER_ROLE.MANAGER
userProvider.userInfoModel.role == USER_ROLE.MANAGER
? AkuMaterialButton(
padding: EdgeInsets.symmetric(horizontal: 24.w),
onPressed: () {

@ -1,10 +1,9 @@
import 'package:aku_community_manager/mock_models/borrow/borrow_data.dart';
import 'package:aku_community_manager/mock_models/borrow/borrow_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_model.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/sub_pages/borrow_manager/all_borrow_goods.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@ -17,28 +16,50 @@ class BorrowManagerPage extends StatefulWidget {
_BorrowManagerPageState createState() => _BorrowManagerPageState();
}
class _BorrowManagerPageState extends State<BorrowManagerPage> {
class _BorrowManagerPageState extends State<BorrowManagerPage>
with TickerProviderStateMixin {
USER_ROLE get role =>
Provider.of<UserProvider>(context, listen: false).userInfoModel.role;
TabController _tabController;
List<String> get _tabs {
switch (role) {
case USER_ROLE.MANAGER:
return ['全部', '出借中', '待检查', '已归还'];
default:
return ['全部', '出借中', '已归还'];
}
}
@override
void initState() {
super.initState();
_tabController = TabController(length: _tabs.length, vsync: this);
}
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context);
return AkuScaffold(
title: '物品清单',
appBarBottom: PreferredSize(
child: AkuTabBar(
controller: _tabController,
tabs: _tabs,
),
preferredSize: Size.fromHeight(96.w)),
actions: [
userProvider.userInfoModel.role != USER_ROLE.MANAGER
? AkuMaterialButton(
minWidth: 178.w,
onPressed: () {
Get.to(AllBorrowGoods());
},
child: Text(
'全部物品',
style: TextStyle(
fontSize: 28.w,
color: AppStyle.primaryTextColor,
),
),
)
: SizedBox(),
AkuMaterialButton(
minWidth: 178.w,
onPressed: () {
Get.to(AllBorrowGoods());
},
child: Text(
'全部物品',
style: TextStyle(
fontSize: 28.w,
color: AppStyle.primaryTextColor,
),
),
),
],
);
}

Loading…
Cancel
Save