fix home draw display

hmxc
小赖 4 years ago
parent a20b53725b
commit 8e12d18437

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

@ -0,0 +1,4 @@
class UserInfoModel {
String nickName;
String avatarPath;
}

@ -1,10 +1,18 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// //
class UserProvider extends ChangeNotifier{ class UserProvider extends ChangeNotifier{
bool _isSigned=false; bool _isSigned=false;
///
get isSigned=>_isSigned; get isSigned=>_isSigned;
///
setisSigned (bool state){ setisSigned (bool state){
_isSigned=state; _isSigned=state;
notifyListeners(); notifyListeners();
} }
} }

@ -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/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/login/login_page.dart'; import 'package:aku_community_manager/ui/login/login_page.dart';
@ -18,27 +19,30 @@ class PersonalDraw extends StatefulWidget {
} }
class _PersonalDrawState extends State<PersonalDraw> { class _PersonalDrawState extends State<PersonalDraw> {
Widget _myListTile(IconData iconData, String text, {VoidCallback onPressed}) { Widget _myListTile(String path, String text, {VoidCallback onPressed}) {
return AkuButton( return AkuButton(
onPressed: onPressed, onPressed: onPressed,
child: Container( child: Container(
width: double.infinity,
height: 96.w, height: 96.w,
padding: EdgeInsets.only(left: 32.w, top: 28.w, bottom: 28.w), padding: EdgeInsets.only(left: 32.w),
child: Row(children: [ child: Row(
Icon( crossAxisAlignment: CrossAxisAlignment.center,
iconData, children: [
size: 40.w, Image.asset(
), path,
SizedBox(width: 16.w), width: 40.w,
Text( height: 40.w,
text,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp,
), ),
), SizedBox(width: 16.w),
]), Text(
text,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp,
),
),
],
),
), ),
); );
} }
@ -46,83 +50,86 @@ class _PersonalDrawState extends State<PersonalDraw> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context); final userProvider = Provider.of<UserProvider>(context);
return Drawer( return SizedBox(
child: ListView( width: 465.w,
children: [ child: Drawer(
SizedBox( child: ListView(
height: 80.w - 40.w + ScreenUtil().statusBarHeight, children: [
), SizedBox(
//leading height: 80.w - 40.w + ScreenUtil().statusBarHeight,
Container( ),
margin: EdgeInsets.only(bottom: 80.w), //leading
width: double.infinity, Container(
child: Row( margin: EdgeInsets.only(bottom: 80.w),
children: [ width: double.infinity,
SizedBox(width: 32.w), child: Row(
// children: [
AkuRoundButton( SizedBox(width: 32.w),
height: 72.w, //
onPressed: () {}, AkuRoundButton(
child: CircleAvatar( height: 72.w,
radius: 36.w, onPressed: () {},
backgroundColor: Colors.grey, child: CircleAvatar(
child: userProvider.isSigned ? null : null, radius: 36.w,
backgroundColor: Colors.grey,
child: userProvider.isSigned ? null : null,
),
), ),
), SizedBox(width: 24.w),
SizedBox(width: 24.w), Column(
Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ //
// InkWell(
InkWell( onTap: () {},
onTap: () {}, child: userProvider.isSigned
child: userProvider.isSigned ? Text(
? Text( '李大海',
'李大海', style: TextStyle(
style: TextStyle( color: AppStyle.primaryTextColor,
color: AppStyle.primaryTextColor, fontSize: 28.sp,
fontSize: 28.sp, fontWeight: FontWeight.bold),
fontWeight: FontWeight.bold), )
) : Text('登录',
: 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( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontSize: 28.sp, fontSize: 24.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),
),
],
), ),
), ],
], ),
), ],
], ),
),
_myListTile(
R.ASSETS_USER_IC_PERSON_PNG,
'个人信息',
onPressed: () {
userProvider.isSigned
? Get.to(UserInfoPage())
: Get.to(LoginPage());
},
), ),
), _myListTile(R.ASSETS_USER_IC_KEFU_PNG, '联系客服'),
_myListTile( _myListTile(R.ASSETS_USER_IC_SETUP_PNG, '设置', onPressed: () {
Icons.contact_page, Get.to(SettingsPage());
'个人信息', }),
onPressed: () { ],
userProvider.isSigned ),
? Get.to(UserInfoPage())
: Get.to(LoginPage());
},
),
_myListTile(Icons.supervised_user_circle, '联系客服'),
_myListTile(Icons.settings, '设置', onPressed: () {
Get.to(SettingsPage());
}),
],
), ),
); );
} }

@ -68,6 +68,7 @@ flutter:
assets: assets:
- assets/ - assets/
- assets/home/ - assets/home/
- assets/user/
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
# assets: # assets:
# - images/a_dot_burr.jpeg # - images/a_dot_burr.jpeg

Loading…
Cancel
Save