Merge branch 'master' of http://192.168.2.201:8099/zhangmeng/aku_community_manager
* 'master' of http://192.168.2.201:8099/zhangmeng/aku_community_manager: 首页搜索图标更改 访客管理完成 访客管理页面逻辑 访客管理页面 访客管理页面 # Conflicts: # lib/ui/home/home_page.darthmxc
commit
792eeafaaa
@ -1,17 +1,90 @@
|
|||||||
|
import 'package:aku_community_manager/const/resource.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/visitor_manager/visitor_manager_page.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
class VisitorManagerCard extends StatefulWidget {
|
class VisitorManagerCard extends StatefulWidget {
|
||||||
VisitorManagerCard({Key key}) : super(key: key);
|
final String adress;
|
||||||
|
final String name;
|
||||||
|
final String plate;
|
||||||
|
final String time;
|
||||||
|
final VisitorStatus status;
|
||||||
|
VisitorManagerCard({Key key, @required this.adress,@required this.name, this.plate, this.time,@required this.status}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_VisitorManagerCardState createState() => _VisitorManagerCardState();
|
_VisitorManagerCardState createState() => _VisitorManagerCardState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _VisitorManagerCardState extends State<VisitorManagerCard> {
|
class _VisitorManagerCardState extends State<VisitorManagerCard> {
|
||||||
|
|
||||||
|
TextStyle _textStyle=TextStyle(color:AppStyle.primaryTextColor,fontSize:28.sp,);
|
||||||
|
String _adress;
|
||||||
|
String _name;
|
||||||
|
String _plate;
|
||||||
|
String _time;
|
||||||
|
VisitorStatus _status;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_adress=widget.adress;
|
||||||
|
_name=widget.name;
|
||||||
|
_plate=widget.plate??'无信息';
|
||||||
|
_time=widget.time??'无信息';
|
||||||
|
_status=widget.status;
|
||||||
|
}
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Column(
|
||||||
// child: child,
|
children: [
|
||||||
|
AkuBox.h(16),
|
||||||
|
Container(
|
||||||
|
color: Color(0xFFFFFFFF),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 201.w,
|
||||||
|
padding: EdgeInsets.only(top:24.w,left:24.w,bottom: 28.w),
|
||||||
|
child: Stack(children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children:[
|
||||||
|
Text(_adress,style: TextStyle(color:AppStyle.primaryTextColor,fontSize:32.sp,fontWeight: FontWeight.bold),),
|
||||||
|
AkuBox.h(16),
|
||||||
|
Row(children: [
|
||||||
|
Image.asset(R.ASSETS_USER_IC_PERSON_PNG,width:40.w ,height: 40.w,),
|
||||||
|
AkuBox.w(8),
|
||||||
|
Text('$_name先生',style:_textStyle,),
|
||||||
|
AkuBox.w(137),
|
||||||
|
Image.asset(R.ASSETS_IC_BORROW_PNG,width: 40.w,height: 40.w,),
|
||||||
|
AkuBox.w(8),
|
||||||
|
Text(_plate,style: _textStyle,),
|
||||||
|
Spacer(),
|
||||||
|
],),
|
||||||
|
Spacer(),
|
||||||
|
Row(children: [
|
||||||
|
Image.asset(R.ASSETS_HOME_IC_ARTICLE_PNG,width: 40.w,height: 40.w,),
|
||||||
|
AkuBox.w(8),
|
||||||
|
Text(_time,style:_textStyle),
|
||||||
|
Spacer(),
|
||||||
|
],),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
left: 582.w,
|
||||||
|
bottom: 104.w,
|
||||||
|
child:_statusImage(_status) ),
|
||||||
|
],),
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Widget _statusImage(VisitorStatus status){
|
||||||
|
switch (status) {
|
||||||
|
case VisitorStatus.NOT_VISIT:
|
||||||
|
return Placeholder();
|
||||||
|
case VisitorStatus.VISIT_DONE:
|
||||||
|
return Placeholder();
|
||||||
|
case VisitorStatus.OUTDATE:
|
||||||
|
return Placeholder();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,20 +1,113 @@
|
|||||||
|
import 'package:aku_community_manager/style/app_style.dart';
|
||||||
|
import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_card.dart';
|
||||||
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.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:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
|
||||||
|
enum VisitorStatus {
|
||||||
|
NOT_VISIT,
|
||||||
|
VISIT_DONE,
|
||||||
|
OUTDATE,
|
||||||
|
}
|
||||||
|
|
||||||
|
class VisitorCardsModel {
|
||||||
|
String adress;
|
||||||
|
String name;
|
||||||
|
String plate;
|
||||||
|
String time;
|
||||||
|
VisitorStatus status;
|
||||||
|
VisitorCardsModel({this.adress, this.name, this.status,
|
||||||
|
this.plate, this.time});
|
||||||
|
}
|
||||||
|
|
||||||
class VisitorManagerPage extends StatefulWidget {
|
class VisitorManagerPage extends StatefulWidget {
|
||||||
VisitorManagerPage({Key key}) : super(key: key);
|
final initIndex;
|
||||||
|
VisitorManagerPage({Key key, this.initIndex = 0}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_VisitorManagerPageState createState() => _VisitorManagerPageState();
|
_VisitorManagerPageState createState() => _VisitorManagerPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _VisitorManagerPageState extends State<VisitorManagerPage> {
|
class _VisitorManagerPageState extends State<VisitorManagerPage>
|
||||||
|
with TickerProviderStateMixin {
|
||||||
|
List<String> _tabs = ['全部', '未到访', '已到访', '已过期'];
|
||||||
|
|
||||||
|
List<VisitorCardsModel> _cards = [
|
||||||
|
VisitorCardsModel(
|
||||||
|
adress:'深圳华悦茂峰1幢1单元702',
|
||||||
|
name:'马泽城',
|
||||||
|
status:VisitorStatus.VISIT_DONE,
|
||||||
|
plate: '浙BA9899',
|
||||||
|
time: '2020-10-24 12:00',
|
||||||
|
),
|
||||||
|
VisitorCardsModel(adress:'深圳华悦茂峰2幢2单元702',name:'刘揪心',status: VisitorStatus.NOT_VISIT),
|
||||||
|
VisitorCardsModel(adress:'深圳华悦茂峰3幢3单元602', name:'张空间', status:VisitorStatus.OUTDATE),
|
||||||
|
];
|
||||||
|
TabController _tabController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_tabController =
|
||||||
|
TabController(length: 4, vsync: this, initialIndex: widget.initIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_tabController?.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AkuScaffold(
|
return AkuScaffold(
|
||||||
// title: '',
|
title: '访客管理',
|
||||||
// appBarBottom: ,
|
appBarBottom: PreferredSize(
|
||||||
// body: ,
|
child: AkuTabBar(
|
||||||
);
|
tabs: _tabs,
|
||||||
|
controller: _tabController,
|
||||||
|
),
|
||||||
|
preferredSize: Size.fromHeight(88.w)),
|
||||||
|
body: TabBarView(
|
||||||
|
controller: _tabController,
|
||||||
|
children: _tabs.map((e) => _buildListView(_tabs.indexOf(e))).toList(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildListView(int index) {
|
||||||
|
List<VisitorCardsModel> _selectCards;
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
_selectCards = _cards;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
_selectCards = _cards
|
||||||
|
.where((element) => element.status == VisitorStatus.NOT_VISIT)
|
||||||
|
.toList();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
_selectCards = _cards
|
||||||
|
.where((element) => element.status == VisitorStatus.VISIT_DONE)
|
||||||
|
.toList();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
_selectCards = _cards
|
||||||
|
.where((element) => element.status == VisitorStatus.OUTDATE)
|
||||||
|
.toList();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ListView(
|
||||||
|
padding: EdgeInsets.only(left: 32.w, right: 32.w),
|
||||||
|
children: _selectCards
|
||||||
|
.map((e) => VisitorManagerCard(
|
||||||
|
adress: e.adress,
|
||||||
|
name: e.name,
|
||||||
|
plate: e.plate,
|
||||||
|
time: e.time,
|
||||||
|
status: e.status,
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue