parent
7b9426b0af
commit
843f1b99c3
@ -0,0 +1,44 @@
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
|
||||
class VisitorListItemModel {
|
||||
int id;
|
||||
int accessCode;
|
||||
int visitorStatus;
|
||||
String name;
|
||||
int isDrive;
|
||||
String carNum;
|
||||
String effectiveTime;
|
||||
|
||||
DateTime get date => DateUtil.getDateTime(effectiveTime);
|
||||
|
||||
VisitorListItemModel(
|
||||
{this.id,
|
||||
this.accessCode,
|
||||
this.visitorStatus,
|
||||
this.name,
|
||||
this.isDrive,
|
||||
this.carNum,
|
||||
this.effectiveTime});
|
||||
|
||||
VisitorListItemModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
accessCode = json['accessCode'];
|
||||
visitorStatus = json['visitorStatus'];
|
||||
name = json['name'];
|
||||
isDrive = json['isDrive'];
|
||||
carNum = json['carNum'];
|
||||
effectiveTime = json['effectiveTime'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['accessCode'] = this.accessCode;
|
||||
data['visitorStatus'] = this.visitorStatus;
|
||||
data['name'] = this.name;
|
||||
data['isDrive'] = this.isDrive;
|
||||
data['carNum'] = this.carNum;
|
||||
data['effectiveTime'] = this.effectiveTime;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
import 'package:akuCommunity/pages/visitor_access_page/visitor_pass_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
|
||||
class RecordItem extends StatefulWidget {
|
||||
final bool isQRCode;
|
||||
RecordItem({Key key, this.isQRCode}) : super(key: key);
|
||||
|
||||
@override
|
||||
_RecordItemState createState() => _RecordItemState();
|
||||
}
|
||||
|
||||
class _RecordItemState extends State<RecordItem>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
void recordPass() {
|
||||
VisitorPassPage().to;
|
||||
}
|
||||
|
||||
Positioned _positionedAgain() {
|
||||
return Positioned(
|
||||
right: 0,
|
||||
top: 16.w,
|
||||
child: InkWell(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xffffffff),
|
||||
borderRadius: BorderRadius.all(Radius.circular(36.w)),
|
||||
border: Border.all(color: Color(0xffffc500), width: 3.w)),
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 11.w,
|
||||
horizontal: 32.w,
|
||||
),
|
||||
child: Text(
|
||||
'再次邀请',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 24.sp,
|
||||
color: Color(0xff333333),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Positioned _positionedQRcode() {
|
||||
return Positioned(
|
||||
right: 0,
|
||||
top: 16.w,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
AntDesign.qrcode,
|
||||
size: 40.sp,
|
||||
color: Color(0xff999999),
|
||||
),
|
||||
SizedBox(height: 18.w),
|
||||
Icon(
|
||||
AntDesign.right,
|
||||
size: 40.sp,
|
||||
color: Color(0xff999999),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return InkWell(
|
||||
onTap: recordPass,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: 32.w,
|
||||
left: 32.w,
|
||||
right: 32.w,
|
||||
),
|
||||
color: Colors.white,
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'马成泽(浙A88888)',
|
||||
style: TextStyle(
|
||||
fontSize: 32.sp,
|
||||
color: Color(0xff333333),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.w),
|
||||
Text(
|
||||
'2020年6月30日',
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: Color(0xff999999),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 33.w),
|
||||
Divider()
|
||||
],
|
||||
),
|
||||
widget.isQRCode ? _positionedQRcode() : _positionedAgain(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
import 'record_item.dart';
|
||||
|
||||
class RecordList extends StatefulWidget {
|
||||
RecordList({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_RecordListState createState() => _RecordListState();
|
||||
}
|
||||
|
||||
class _RecordListState extends State<RecordList>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
RefreshController _refreshController =
|
||||
RefreshController(initialRefresh: false);
|
||||
|
||||
void _onRefresh() async {
|
||||
await Future.delayed(Duration(milliseconds: 1500));
|
||||
_refreshController.refreshCompleted();
|
||||
}
|
||||
|
||||
void _onLoading() async {
|
||||
if (mounted) setState(() {});
|
||||
_refreshController.loadComplete();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: SmartRefresher(
|
||||
controller: _refreshController,
|
||||
header: WaterDropHeader(),
|
||||
footer: ClassicFooter(),
|
||||
onRefresh: _onRefresh,
|
||||
onLoading: _onLoading,
|
||||
enablePullUp: true,
|
||||
child: ListView.builder(
|
||||
itemBuilder: (context, index) => RecordItem(
|
||||
isQRCode: (index % 2 == 0) ? false : true,
|
||||
),
|
||||
itemCount: 6,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
import 'package:akuCommunity/model/manager/visitor_list_item_model.dart';
|
||||
import 'package:akuCommunity/ui/manager/visitor/visitor_passport_page.dart';
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
class VisitorListItem extends StatefulWidget {
|
||||
final VisitorListItemModel model;
|
||||
VisitorListItem({Key key, @required this.model}) : super(key: key);
|
||||
|
||||
@override
|
||||
_VisitorListItemState createState() => _VisitorListItemState();
|
||||
}
|
||||
|
||||
class _VisitorListItemState extends State<VisitorListItem> {
|
||||
String get _name {
|
||||
StringBuffer buffer = StringBuffer();
|
||||
var name = widget.model.name;
|
||||
buffer.write(name);
|
||||
var car = widget.model.carNum;
|
||||
if (TextUtil.isEmpty(car)) return buffer.toString();
|
||||
buffer.write('($car)');
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
bool get outDate => DateTime.now().isAfter(widget.model.date);
|
||||
_buildSuffix() {
|
||||
if (outDate)
|
||||
return MaterialButton(
|
||||
onPressed: () {},
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 12.w),
|
||||
height: 56.w,
|
||||
child: '再次邀约'.text.size(24.sp).bold.make(),
|
||||
shape: StadiumBorder(
|
||||
side: BorderSide(
|
||||
color: Color(0xFFFFC500),
|
||||
width: 3.w,
|
||||
),
|
||||
),
|
||||
);
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.qr_code_rounded),
|
||||
16.wb,
|
||||
Icon(CupertinoIcons.chevron_forward),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialButton(
|
||||
onPressed: () {
|
||||
if (!outDate) {
|
||||
VisitorPassportPage().to();
|
||||
}
|
||||
},
|
||||
color: Colors.white,
|
||||
elevation: 0,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
height: 152.w,
|
||||
child: Row(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_name.text.size(32.sp).bold.make(),
|
||||
8.hb,
|
||||
DateUtil.formatDate(widget.model.date, format: 'yyyy-MM-dd')
|
||||
.text
|
||||
.size(24.sp)
|
||||
.color(Color(0xFF999999))
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
_buildSuffix(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
import 'package:akuCommunity/widget/bee_back_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
class VisitorPassportPage extends StatefulWidget {
|
||||
VisitorPassportPage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_VisitorPassportPageState createState() => _VisitorPassportPageState();
|
||||
}
|
||||
|
||||
class _VisitorPassportPageState extends State<VisitorPassportPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Color(0xFF333333),
|
||||
appBar: AppBar(
|
||||
leading: BeeBackButton(color: Colors.white),
|
||||
backgroundColor: Color(0xFF333333),
|
||||
elevation: 0,
|
||||
centerTitle: true,
|
||||
title: '访客通行证'.text.white.make(),
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
64.hb,
|
||||
'宁波华茂悦峰'.text.size(40.sp).white.bold.make().centered(),
|
||||
'1幢-1单元-702室'.text.size(30.sp).white.make().centered(),
|
||||
32.hb,
|
||||
Container(
|
||||
height: 600.w,
|
||||
width: 600.w,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16.w),
|
||||
),
|
||||
// child: ,
|
||||
//TODO 二维码显示
|
||||
).centered(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue