Merge branch 'master' of http://test.akuhotel.com:8099/zhangmeng/aku_community_manager
* 'master' of http://test.akuhotel.com:8099/zhangmeng/aku_community_manager: 添加登录状态管理,添加抽屉页 分割线修改 添加布局,自定义分割线 修改布局 # Conflicts: # lib/ui/home/home_page.darthmxc
commit
0ce81f09f6
@ -0,0 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
//登录状态管理
|
||||
class UserProvider extends ChangeNotifier{
|
||||
bool _isSigned=false;
|
||||
get isSigned=>_isSigned;
|
||||
setisSigned (bool state){
|
||||
_isSigned=state;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
//自定义分割线
|
||||
class AkuDiveder {
|
||||
final bool isReverse;//颜色方向反转
|
||||
const AkuDiveder({Key key,this.isReverse=false});
|
||||
Widget verticalDivider(double height) {
|
||||
return Container(
|
||||
width: 1.w,
|
||||
height: height,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: isReverse
|
||||
? [
|
||||
Color(0xFFE8E8E8),
|
||||
Color(0xFFFFFFFF),
|
||||
]
|
||||
: [
|
||||
Color(0xFFFFFFFF),
|
||||
Color(0xFFE8E8E8),
|
||||
])),
|
||||
);
|
||||
}
|
||||
Widget horizontalDivider(double width) {
|
||||
return Container(
|
||||
width: width,
|
||||
height: 1.w,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
colors: isReverse
|
||||
? [
|
||||
Color(0xFFE8E8E8),
|
||||
Color(0xFFFFFFFF),
|
||||
]
|
||||
: [
|
||||
Color(0xFFFFFFFF),
|
||||
Color(0xFFE8E8E8),
|
||||
])),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
import 'package:aku_community_manager/provider/user_provider.dart';
|
||||
import 'package:aku_community_manager/style/app_style.dart';
|
||||
import 'package:aku_ui/common_widgets/aku_button.dart';
|
||||
import 'package:aku_ui/common_widgets/aku_round_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class PersonalDraw extends StatefulWidget {
|
||||
PersonalDraw({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_PersonalDrawState createState() => _PersonalDrawState();
|
||||
}
|
||||
|
||||
class _PersonalDrawState extends State<PersonalDraw> {
|
||||
Widget _myListTile(IconData iconData, String text) {
|
||||
return AkuButton(
|
||||
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,
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userProvider = Provider.of<UserProvider>(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,
|
||||
height: 72.w,
|
||||
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('登录',
|
||||
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),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
_myListTile(Icons.contact_page, '个人信息'),
|
||||
_myListTile(Icons.supervised_user_circle, '联系客服'),
|
||||
_myListTile(Icons.settings, '设置'),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue