diff --git a/assets/user/ic_kefu.png b/assets/user/ic_kefu.png new file mode 100644 index 0000000..a53514a Binary files /dev/null and b/assets/user/ic_kefu.png differ diff --git a/assets/user/ic_person.png b/assets/user/ic_person.png new file mode 100644 index 0000000..4ddd834 Binary files /dev/null and b/assets/user/ic_person.png differ diff --git a/assets/user/ic_setup.png b/assets/user/ic_setup.png new file mode 100644 index 0000000..efe8dc2 Binary files /dev/null and b/assets/user/ic_setup.png differ diff --git a/lib/mock_models/users/user_info_model.dart b/lib/mock_models/users/user_info_model.dart new file mode 100644 index 0000000..945e711 --- /dev/null +++ b/lib/mock_models/users/user_info_model.dart @@ -0,0 +1,4 @@ +class UserInfoModel { + String nickName; + String avatarPath; +} diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index 110c511..b29b8a1 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -1,10 +1,18 @@ import 'package:flutter/material.dart'; //登录状态管理 class UserProvider extends ChangeNotifier{ + + bool _isSigned=false; + ///用户是否登陆 get isSigned=>_isSigned; + + ///设置用户登陆 setisSigned (bool state){ _isSigned=state; notifyListeners(); } + + + } \ No newline at end of file diff --git a/lib/ui/home/personal_draw.dart b/lib/ui/home/personal_draw.dart index 3bb7a89..a8457af 100644 --- a/lib/ui/home/personal_draw.dart +++ b/lib/ui/home/personal_draw.dart @@ -1,3 +1,4 @@ +import 'package:aku_community_manager/const/resource.dart'; import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/ui/login/login_page.dart'; @@ -18,27 +19,30 @@ class PersonalDraw extends StatefulWidget { } class _PersonalDrawState extends State { - Widget _myListTile(IconData iconData, String text, {VoidCallback onPressed}) { + Widget _myListTile(String path, String text, {VoidCallback onPressed}) { return AkuButton( onPressed: onPressed, child: Container( - width: double.infinity, height: 96.w, - padding: EdgeInsets.only(left: 32.w, top: 28.w, bottom: 28.w), - child: Row(children: [ - Icon( - iconData, - size: 40.w, - ), - SizedBox(width: 16.w), - Text( - text, - style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp, + padding: EdgeInsets.only(left: 32.w), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + path, + width: 40.w, + height: 40.w, ), - ), - ]), + SizedBox(width: 16.w), + Text( + text, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + ), + ), + ], + ), ), ); } @@ -46,83 +50,86 @@ class _PersonalDrawState extends State { @override Widget build(BuildContext context) { final userProvider = Provider.of(context); - return Drawer( - child: ListView( - children: [ - SizedBox( - height: 80.w - 40.w + ScreenUtil().statusBarHeight, - ), - //leading - Container( - margin: EdgeInsets.only(bottom: 80.w), - width: double.infinity, - child: Row( - children: [ - SizedBox(width: 32.w), - //头像按钮 - AkuRoundButton( - height: 72.w, - onPressed: () {}, - child: CircleAvatar( - radius: 36.w, - backgroundColor: Colors.grey, - child: userProvider.isSigned ? null : null, + return SizedBox( + width: 465.w, + child: Drawer( + child: ListView( + children: [ + SizedBox( + height: 80.w - 40.w + ScreenUtil().statusBarHeight, + ), + //leading + Container( + margin: EdgeInsets.only(bottom: 80.w), + width: double.infinity, + child: Row( + children: [ + SizedBox(width: 32.w), + //头像按钮 + AkuRoundButton( + height: 72.w, + onPressed: () {}, + child: CircleAvatar( + radius: 36.w, + backgroundColor: Colors.grey, + child: userProvider.isSigned ? null : null, + ), ), - ), - SizedBox(width: 24.w), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - //登录按钮 - InkWell( - onTap: () {}, - child: userProvider.isSigned - ? Text( - '李大海', - style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp, - fontWeight: FontWeight.bold), - ) - : Text('登录', + SizedBox(width: 24.w), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + //登录按钮 + InkWell( + onTap: () {}, + child: userProvider.isSigned + ? Text( + '李大海', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold), + ) + : Text('登录', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold)), + ), + InkWell( + onTap: () {}, + child: Row( + children: [ + Icon(Icons.location_on_outlined, size: 33.w), + Text( + '深圳华悦茂峰', style: TextStyle( color: AppStyle.primaryTextColor, - fontSize: 28.sp, - fontWeight: FontWeight.bold)), - ), - InkWell( - onTap: () {}, - child: Row( - children: [ - Icon(Icons.location_on_outlined, size: 33.w), - Text( - '深圳华悦茂峰', - style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 24.sp), - ), - ], + fontSize: 24.sp), + ), + ], + ), ), - ), - ], - ), - ], + ], + ), + ], + ), + ), + _myListTile( + R.ASSETS_USER_IC_PERSON_PNG, + '个人信息', + onPressed: () { + userProvider.isSigned + ? Get.to(UserInfoPage()) + : Get.to(LoginPage()); + }, ), - ), - _myListTile( - Icons.contact_page, - '个人信息', - onPressed: () { - userProvider.isSigned - ? Get.to(UserInfoPage()) - : Get.to(LoginPage()); - }, - ), - _myListTile(Icons.supervised_user_circle, '联系客服'), - _myListTile(Icons.settings, '设置', onPressed: () { - Get.to(SettingsPage()); - }), - ], + _myListTile(R.ASSETS_USER_IC_KEFU_PNG, '联系客服'), + _myListTile(R.ASSETS_USER_IC_SETUP_PNG, '设置', onPressed: () { + Get.to(SettingsPage()); + }), + ], + ), ), ); } diff --git a/pubspec.yaml b/pubspec.yaml index 874766e..d441c23 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -68,6 +68,7 @@ flutter: assets: - assets/ - assets/home/ + - assets/user/ # To add assets to your application, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg