From e71514623cec930d497acf0c0718005d809a1d0f Mon Sep 17 00:00:00 2001 From: laiiihz Date: Tue, 3 Nov 2020 09:02:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BB=A3=E5=8A=9E=E4=BA=8B?= =?UTF-8?q?=E9=A1=B9=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mock_models/users/user_info_model.dart | 6 +- lib/provider/user_provider.dart | 9 +- lib/ui/home/business/business_page.dart | 60 ++++++++++++++ lib/ui/home/home_page.dart | 95 ++++++++++++---------- lib/ui/widgets/common/aku_scaffold.dart | 7 +- pubspec.lock | 49 +++++++++++ pubspec.yaml | 2 + 7 files changed, 182 insertions(+), 46 deletions(-) create mode 100644 lib/ui/home/business/business_page.dart diff --git a/lib/mock_models/users/user_info_model.dart b/lib/mock_models/users/user_info_model.dart index f5d41d2..6abd172 100644 --- a/lib/mock_models/users/user_info_model.dart +++ b/lib/mock_models/users/user_info_model.dart @@ -1,8 +1,10 @@ +import 'dart:io'; + class UserInfoModel { String nickName; - String avatarPath; + File avatar; UserInfoModel({ this.nickName, - this.avatarPath, + this.avatar, }); } diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index e9d6db5..5072b15 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:aku_community_manager/const/resource.dart'; import 'package:aku_community_manager/mock_models/users/user_info_model.dart'; import 'package:flutter/material.dart'; @@ -17,7 +19,7 @@ class UserProvider extends ChangeNotifier { UserInfoModel _userInfoModel = UserInfoModel( nickName: '李大海', - avatarPath: R.ASSETS_STATIC_TEMP_F3_WEBP, + avatar: null, ); UserInfoModel get userInfoModel => _userInfoModel; @@ -26,4 +28,9 @@ class UserProvider extends ChangeNotifier { _userInfoModel.nickName = name; notifyListeners(); } + + setAvatar(File file) { + _userInfoModel.avatar = file; + notifyListeners(); + } } diff --git a/lib/ui/home/business/business_page.dart b/lib/ui/home/business/business_page.dart new file mode 100644 index 0000000..d3dfe47 --- /dev/null +++ b/lib/ui/home/business/business_page.dart @@ -0,0 +1,60 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; + +class BusinessPage extends StatefulWidget { + ///DEFAULT IS 0 + final int initIndex; + BusinessPage({Key key, this.initIndex = 0}) : super(key: key); + + @override + _BusinessPageState createState() => _BusinessPageState(); +} + +class _BusinessPageState extends State + with TickerProviderStateMixin { + List tabs = ['待处理', '处理中', '已处理', '全部']; + 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: PreferredSize( + child: TabBar( + labelColor: AppStyle.primaryTextColor, + unselectedLabelColor: AppStyle.minorTextColor, + labelStyle: TextStyle( + fontSize: 28.w, + fontWeight: FontWeight.bold, + ), + unselectedLabelStyle: TextStyle( + fontWeight: FontWeight.normal, + ), + indicatorColor: AppStyle.primaryColor, + indicatorSize: TabBarIndicatorSize.label, + controller: _tabController, + tabs: tabs.map((e) => Tab(text: e)).toList(), + ), + preferredSize: Size.fromHeight(88.w), + ), + ); + } +} diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index eeeb48e..4aa55a9 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -4,6 +4,7 @@ import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/tools/widget_tool.dart'; import 'package:aku_community_manager/ui/home/announcement/All_anouncement.dart'; +import 'package:aku_community_manager/ui/home/business/business_page.dart'; 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'; @@ -57,10 +58,17 @@ class _HomePageState extends State { } //底部信息栏卡片 - Widget _card(String number, String text, Color color) { + Widget _card( + String number, + String text, + Color color, + int index, + ) { return AkuButton( radius: 8.w, - onPressed: () {}, + onPressed: () { + Get.to(BusinessPage(initIndex: index)); + }, color: Color(0xFFFFFFFF), child: Container( width: 342.5.w, @@ -151,8 +159,12 @@ class _HomePageState extends State { }, child: CircleAvatar( radius: 36.w, - backgroundColor: Colors.grey, - child: userProvider.isSigned ? null : null, + backgroundColor: Colors.white, + child: userProvider.isSigned + ? userProvider.userInfoModel.avatar == null + ? Icon(Icons.person_outline) + : null + : Icon(Icons.person), ), ); }, @@ -345,43 +357,42 @@ class _HomePageState extends State { height: 172.w, //TODO listview ), - SizedBox(height: 32.w), + SizedBox(height: 16.w), //待办事项标题行 - Container( - width: double.infinity, - height: 45.w, - child: Row( - children: [ - Text( - '待办事项', - style: TextStyle( - color: Color(0xFF4A4B51), - fontSize: 32.sp, - fontWeight: FontWeight.bold, - ), + Row( + children: [ + Text( + '待办事项', + style: TextStyle( + color: Color(0xFF4A4B51), + fontSize: 32.sp, + fontWeight: FontWeight.bold, ), - Spacer(), - AkuButton( - onPressed: () {}, - child: Row( - children: [ - Text( - '全部事项', - style: TextStyle( - color: AppStyle.minorTextColor, - fontSize: 24.sp, - fontWeight: FontWeight.bold), - ), - Icon( - Icons.arrow_forward_ios, - size: 22.w, - color: AppStyle.minorTextColor, - ), - ], - ), + ), + Spacer(), + AkuButton( + padding: EdgeInsets.symmetric(vertical: 16.w), + onPressed: () { + Get.to(BusinessPage(initIndex: 3)); + }, + child: Row( + children: [ + Text( + '全部事项', + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 24.sp, + fontWeight: FontWeight.bold), + ), + Icon( + Icons.arrow_forward_ios, + size: 22.w, + color: AppStyle.minorTextColor, + ), + ], ), - ], - ), + ), + ], ), SizedBox(height: 16.w), //待办事项栏 @@ -402,9 +413,9 @@ class _HomePageState extends State { children: [ Row( children: [ - _card('25', '未处理事项', Color(0xFFFF4E0D)), + _card('25', '未处理事项', Color(0xFFFF4E0D), 0), AkuDiveder().verticalDivider(166.5.w), - _card('22', '处理中事项', Color(0xFFFFC40C)), + _card('22', '处理中事项', Color(0xFFFFC40C), 1), ], ), Row(children: [ @@ -413,11 +424,11 @@ class _HomePageState extends State { ]), Row( children: [ - _card('25', '已处理事项', Color(0xFF3F8FFE)), + _card('25', '已处理事项', Color(0xFF3F8FFE), 2), AkuDiveder(isReverse: true).verticalDivider( 166.5.w, ), - _card('72', '全部事项', Color(0xFF333333)), + _card('72', '全部事项', Color(0xFF333333), 3), ], ), ], diff --git a/lib/ui/widgets/common/aku_scaffold.dart b/lib/ui/widgets/common/aku_scaffold.dart index 9ab0f07..d86d74f 100644 --- a/lib/ui/widgets/common/aku_scaffold.dart +++ b/lib/ui/widgets/common/aku_scaffold.dart @@ -5,7 +5,8 @@ import 'package:aku_community_manager/tools/screen_tool.dart'; ///用法大致同Scaffold class AkuScaffold extends StatefulWidget { - ///AppBar 使用该值 `title`,`titleStyle`,`leading`,`brightness`将失效 + ///AppBar 使用该值 `title`,`titleStyle`,`leading`, + ///`brightness`,`appBarColor`,``将失效 final PreferredSizeWidget appBar; ///title @@ -43,6 +44,8 @@ class AkuScaffold extends StatefulWidget { final Color backgroundColor; final Color appBarColor; + + final PreferredSizeWidget appBarBottom; AkuScaffold({ Key key, this.appBar, @@ -54,6 +57,7 @@ class AkuScaffold extends StatefulWidget { this.backgroundColor = const Color(0XFFF9F9F9), this.bottom, this.appBarColor = Colors.white, + this.appBarBottom, }) : super(key: key); @override @@ -81,6 +85,7 @@ class _AkuScaffoldState extends State { ), child: Text(widget.title ?? ''), ), + bottom: widget.appBarBottom, ), body: widget.body, bottomNavigationBar: widget.bottom, diff --git a/pubspec.lock b/pubspec.lock index bf7f680..47462f2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -134,6 +134,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.6" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.11" flutter_screenutil: dependency: "direct main" description: @@ -153,6 +160,34 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.15.0" + http: + dependency: transitive + description: + name: http + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.12.2" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.4" + image_picker: + dependency: "direct main" + description: + name: image_picker + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.6.7+12" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.1" matcher: dependency: transitive description: @@ -181,6 +216,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.8.0-nullsafety.1" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.9.2" pin_input_text_field: dependency: "direct main" description: @@ -188,6 +230,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.1.1" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.3" provider: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 24f0812..718fc11 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -48,6 +48,8 @@ dependencies: #验证码 pin_input_text_field: ^3.1.1 + image_picker: ^0.6.7+12 + aku_ui: git: url: http://test.akuhotel.com:8099/aku_fe/aku_ui.git