diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index 67a7bfc..81e79c0 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -9,6 +9,7 @@ import 'package:aku_community_manager/ui/home/messages/message.dart'; import 'package:aku_community_manager/ui/home/application/applications_page.dart'; import 'package:aku_community_manager/ui/home/personal_draw.dart'; import 'package:aku_community_manager/ui/login/login_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_page.dart'; import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_page.dart'; import 'package:aku_community_manager/ui/tool_pages/scan_page.dart'; import 'package:aku_ui/aku_ui.dart'; @@ -27,7 +28,7 @@ class HomePage extends StatefulWidget { } class _HomePageState extends State { - //自定义bar的菜单按钮 + ///自定义bar的菜单按钮 Widget _menuButton(String assetPath, String text, Widget page) { return Expanded( child: AkuButton( @@ -64,7 +65,7 @@ class _HomePageState extends State { ); } -//底部信息栏卡片 +///底部信息栏卡片 Widget _card( String number, String text, @@ -189,14 +190,12 @@ class _HomePageState extends State { onPressed: () {}, radius: 8.w, child: Row(children: [ + AkuBox.w(21.w), Container( child: Column( children: [ SizedBox(height: 18.w), - Icon( - Icons.zoom_in_sharp, - size: 38.w, - ), + Image.asset(R.ASSETS_HOME_IC_SEARCH_PNG,width:37.w,height:37.w), ], ), ), @@ -298,7 +297,7 @@ class _HomePageState extends State { _menuButton( R.ASSETS_HOME_IC_POLICE_PNG, '一键报警', HomePage()), _menuButton( - R.ASSETS_HOME_IC_VISITORS_PNG, '访客管理', HomePage()), + R.ASSETS_HOME_IC_VISITORS_PNG, '访客管理', VisitorManagerPage()), _menuButton( R.ASSETS_HOME_IC_SERVICE_PNG, '报事报修', diff --git a/lib/ui/sub_pages/visitor_manager/visitor_manager_card.dart b/lib/ui/sub_pages/visitor_manager/visitor_manager_card.dart index c9eecf5..9e9137a 100644 --- a/lib/ui/sub_pages/visitor_manager/visitor_manager_card.dart +++ b/lib/ui/sub_pages/visitor_manager/visitor_manager_card.dart @@ -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_screenutil/flutter_screenutil.dart'; 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 _VisitorManagerCardState createState() => _VisitorManagerCardState(); } class _VisitorManagerCardState extends State { + +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 Widget build(BuildContext context) { - return Container( - // child: child, + return Column( + 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(); + } + } } \ No newline at end of file diff --git a/lib/ui/sub_pages/visitor_manager/visitor_manager_page.dart b/lib/ui/sub_pages/visitor_manager/visitor_manager_page.dart index 8ff00a5..8804df9 100644 --- a/lib/ui/sub_pages/visitor_manager/visitor_manager_page.dart +++ b/lib/ui/sub_pages/visitor_manager/visitor_manager_page.dart @@ -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/inner/aku_tab_bar.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 { - VisitorManagerPage({Key key}) : super(key: key); + final initIndex; + VisitorManagerPage({Key key, this.initIndex = 0}) : super(key: key); @override _VisitorManagerPageState createState() => _VisitorManagerPageState(); } -class _VisitorManagerPageState extends State { +class _VisitorManagerPageState extends State + with TickerProviderStateMixin { + List _tabs = ['全部', '未到访', '已到访', '已过期']; + + List _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 Widget build(BuildContext context) { return AkuScaffold( - // title: '', - // appBarBottom: , - // body: , - ); + title: '访客管理', + appBarBottom: PreferredSize( + 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 _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(), + ); } }