访客管理完成

hmxc
张萌 4 years ago
parent ad735bacce
commit 58457f7637

@ -1,6 +1,7 @@
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_screenutil/flutter_screenutil.dart';
class VisitorManagerCard extends StatefulWidget {
@ -8,7 +9,8 @@ class VisitorManagerCard extends StatefulWidget {
final String name;
final String plate;
final String time;
VisitorManagerCard({Key key, @required this.adress,@required this.name, this.plate, this.time}) : super(key: key);
final VisitorStatus status;
VisitorManagerCard({Key key, @required this.adress,@required this.name, this.plate, this.time,@required this.status}) : super(key: key);
@override
_VisitorManagerCardState createState() => _VisitorManagerCardState();
@ -21,6 +23,7 @@ String _adress;
String _name;
String _plate;
String _time;
VisitorStatus _status;
@override
void initState() {
super.initState();
@ -28,6 +31,7 @@ String _time;
_name=widget.name;
_plate=widget.plate??'无信息';
_time=widget.time??'无信息';
_status=widget.status;
}
@override
Widget build(BuildContext context) {
@ -67,11 +71,20 @@ String _time;
Positioned(
left: 582.w,
bottom: 104.w,
child: Placeholder(),),
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();
}
}
}

@ -17,8 +17,8 @@ class VisitorCardsModel {
String plate;
String time;
VisitorStatus status;
VisitorCardsModel(this.adress, this.name, this.status,
{this.plate, this.time});
VisitorCardsModel({this.adress, this.name, this.status,
this.plate, this.time});
}
class VisitorManagerPage extends StatefulWidget {
@ -35,14 +35,14 @@ class _VisitorManagerPageState extends State<VisitorManagerPage>
List<VisitorCardsModel> _cards = [
VisitorCardsModel(
'深圳华悦茂峰1幢1单元702',
'马泽城',
VisitorStatus.VISIT_DONE,
adress:'深圳华悦茂峰1幢1单元702',
name:'马泽城',
status:VisitorStatus.VISIT_DONE,
plate: '浙BA9899',
time: '2020-10-24 12:00',
),
VisitorCardsModel('深圳华悦茂峰2幢2单元702', '刘揪心', VisitorStatus.NOT_VISIT),
VisitorCardsModel('深圳华悦茂峰3幢3单元602', '刘揪心', VisitorStatus.OUTDATE),
VisitorCardsModel(adress:'深圳华悦茂峰2幢2单元702',name:'刘揪心',status: VisitorStatus.NOT_VISIT),
VisitorCardsModel(adress:'深圳华悦茂峰3幢3单元602', name:'张空间', status:VisitorStatus.OUTDATE),
];
TabController _tabController;
@ -71,34 +71,6 @@ class _VisitorManagerPageState extends State<VisitorManagerPage>
preferredSize: Size.fromHeight(88.w)),
body: TabBarView(
controller: _tabController,
// children: _tabs.map((e) => _buildTabView(_tabs.indexOf(e))).toList(),)
// children: [
// ListView(
// padding: EdgeInsets.only(left: 32.w, right: 32.w),
// children: _cards
// .map((e) => VisitorManagerCard(
// adress: e.adress,
// name: e.name,
// plate: e.plate,
// time: e.time,
// ))
// .toList(),
// ),
// ListView(
// padding: EdgeInsets.only(left: 32.w, right: 32.w),
// children: _cards
// .where((element) => element.status == VisitorStatus.NOT_VISIT)
// .map((e) => VisitorManagerCard(
// adress: e.adress,
// name: e.name,
// plate: e.plate,
// time: e.time,
// ))
// .toList(),
// ),
// ListView(),
// ListView(),
// ],
children: _tabs.map((e) => _buildListView(_tabs.indexOf(e))).toList(),
));
}
@ -107,19 +79,22 @@ class _VisitorManagerPageState extends State<VisitorManagerPage>
List<VisitorCardsModel> _selectCards;
switch (index) {
case 0:
_selectCards = _cards;
break;
_selectCards = _cards;
break;
case 1:
_selectCards = _cards
.where((element) => element.status == VisitorStatus.NOT_VISIT).toList();
.where((element) => element.status == VisitorStatus.NOT_VISIT)
.toList();
break;
case 2:
_selectCards = _cards
.where((element) => element.status == VisitorStatus.VISIT_DONE).toList();
.where((element) => element.status == VisitorStatus.VISIT_DONE)
.toList();
break;
case 3:
_selectCards =
_cards.where((element) => element.status == VisitorStatus.OUTDATE).toList();
_selectCards = _cards
.where((element) => element.status == VisitorStatus.OUTDATE)
.toList();
break;
}
return ListView(
@ -130,6 +105,7 @@ class _VisitorManagerPageState extends State<VisitorManagerPage>
name: e.name,
plate: e.plate,
time: e.time,
status: e.status,
))
.toList(),
);

Loading…
Cancel
Save