* 'master' of http://test.akuhotel.com:8099/zhangmeng/aku_community_manager:
  添加登录状态管理,添加抽屉页
  分割线修改
  添加布局,自定义分割线
  修改布局

# Conflicts:
#	lib/ui/home/home_page.dart
hmxc
小赖 4 years ago
commit 0ce81f09f6

@ -1,6 +1,8 @@
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/ui/home/home_page.dart'; import 'package:aku_community_manager/ui/home/home_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart';
void main() { void main() {
runApp(MyApp()); runApp(MyApp());
@ -10,9 +12,15 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application. // This widget is the root of your application.
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetMaterialApp( return MultiProvider(
providers:[
ChangeNotifierProvider(create: (context)=>UserProvider()),
],
child: GetMaterialApp(
title: '小蜜蜂管家', title: '小蜜蜂管家',
home: HomePage(), home: HomePage(),
),
); );
} }
} }

@ -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),
])),
);
}
}

@ -1,9 +1,14 @@
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/utils/screen_tool.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/personal_draw.dart';
import 'package:aku_ui/aku_ui.dart'; import 'package:aku_ui/aku_ui.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
class HomePage extends StatefulWidget { class HomePage extends StatefulWidget {
HomePage({Key key}) : super(key: key); HomePage({Key key}) : super(key: key);
@ -12,14 +17,76 @@ class HomePage extends StatefulWidget {
_HomePageState createState() => _HomePageState(); _HomePageState createState() => _HomePageState();
} }
//bar
Widget _menuButton(IconData iconData, String text, Widget page) {
return AkuButton(
height: 75.w + 8.w + 33.w,
onPressed: () {
Get.to(page);
},
child: Column(
children: [
Icon(
iconData,
size: 75.w,
),
SizedBox(height: 8.w),
Text(
text,
style: TextStyle(
color: Color(0xFF4A4B51),
fontSize: 24.sp,
fontWeight: FontWeight.bold,
),
)
],
),
);
}
//
Widget _card(String number, String text, Color color) {
return AkuButton(
onPressed: () {},
color: Color(0xFFFFFFFF),
child: Container(
width: 342.5.w,
height: 166.w,
alignment: Alignment.center,
child: Column(
children: [
SizedBox(
height: 32.w,
),
Text(
number,
style: TextStyle(
color: color, fontSize: 40.sp, fontStyle: FontStyle.italic),
),
SizedBox(
height: 16.w,
),
Text(text,
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 24.sp,
fontWeight: FontWeight.bold)),
Spacer(),
],
)),
);
}
class _HomePageState extends State<HomePage> { class _HomePageState extends State<HomePage> {
TextEditingController _controller;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final userProvider=Provider.of<UserProvider>(context);
ScreenUtil.init(context, ScreenUtil.init(context,
designSize: Size(750, 1334), allowFontScaling: true); designSize: Size(750, 1334), allowFontScaling: true);
return Scaffold( return Scaffold(
drawer: PersonalDraw(),
backgroundColor: Color(0xFFF9F9F9),
//bar
appBar: PreferredSize( appBar: PreferredSize(
preferredSize: Size(375.w, 430.w - 40.w + statusBarHeight), preferredSize: Size(375.w, 430.w - 40.w + statusBarHeight),
child: Container( child: Container(
@ -50,21 +117,29 @@ class _HomePageState extends State<HomePage> {
margin: EdgeInsets.only(top: 8.w, bottom: 8.w), margin: EdgeInsets.only(top: 8.w, bottom: 8.w),
width: 72.w, width: 72.w,
height: 72.w, height: 72.w,
child: AkuRoundButton(
// //
height: 36.w, child: Builder(builder: (BuildContext context) {
onPressed: () {}, return AkuRoundButton(
child: CircleAvatar(radius: 36.w), height: 72.w,
), onPressed: () {
), Scaffold.of(context).openDrawer();
},
child: CircleAvatar(radius: 36.w,
backgroundColor: Colors.grey,
child: userProvider.isSigned?null:null,),
);
})),
SizedBox(width: 16.w), SizedBox(width: 16.w),
Expanded( Expanded(
child: Container( child: Container(
margin: EdgeInsets.only(top: 8.w, bottom: 8.w), margin: EdgeInsets.only(top: 8.w, bottom: 8.w),
alignment: Alignment.center, alignment: Alignment.center,
height: 72.w, height: 72.w,
padding: EdgeInsets.only(left: 21.w),
child: AkuButton(
//
color: Color(0xFFFFFFFF), color: Color(0xFFFFFFFF),
padding: EdgeInsets.only(left: 21.w, right: 87.w), onPressed: () {},
child: Row(children: [ child: Row(children: [
Container( Container(
child: Column( child: Column(
@ -78,23 +153,17 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
SizedBox(width: 19.w), SizedBox(width: 19.w),
Expanded( Text(
child: AkuButton(
//
padding: EdgeInsets.zero,
onPressed: () {},
child: Text(
'搜索工单订单号、手机', '搜索工单订单号、手机',
style: TextStyle( style: TextStyle(
color: AppStyle.minorTextColor, color: AppStyle.minorTextColor,
fontSize: 28.sp, fontSize: 28.sp,
), ),
), ),
),
),
]), ]),
), ),
), ),
),
SizedBox(width: 15.w), SizedBox(width: 15.w),
Container( Container(
margin: EdgeInsets.only(top: 5.w, bottom: 5.w), margin: EdgeInsets.only(top: 5.w, bottom: 5.w),
@ -122,7 +191,6 @@ class _HomePageState extends State<HomePage> {
]), ]),
), ),
), ),
Container( Container(
margin: EdgeInsets.only(top: 5.w, bottom: 5.w), margin: EdgeInsets.only(top: 5.w, bottom: 5.w),
child: AkuMaterialButton( child: AkuMaterialButton(
@ -166,121 +234,152 @@ class _HomePageState extends State<HomePage> {
SizedBox(height: 16.w), SizedBox(height: 16.w),
Container( Container(
margin: EdgeInsets.only(left: 32.w, right: 32.w), margin: EdgeInsets.only(left: 32.w, right: 32.w),
padding: EdgeInsets.only(top: 24.w),
color: Color(0xFFFFFFFF), color: Color(0xFFFFFFFF),
width: double.infinity, width: double.infinity,
height: 163.w, height: 163.w,
child: Column(children: [ child: Row(
SizedBox( mainAxisAlignment: MainAxisAlignment.spaceAround,
height: 24.w,
),
Row(
children: [ children: [
SizedBox(width: 48.w), _menuButton(Icons.wysiwyg, '一键报警', HomePage()),
Container( _menuButton(Icons.work, '访客管理', HomePage()),
width: 75.w, _menuButton(Icons.accessibility, '报事报修', HomePage()),
height: 75.w, _menuButton(Icons.account_balance, '全部应用', HomePage()),
child: Icon( ],
Icons.accessibility,
size: 75.w,
),
),
SizedBox(
width: 97.w,
),
Container(
width: 75.w,
height: 75.w,
child: Icon(
Icons.account_balance,
size: 75.w,
),
),
SizedBox(width: 97.w),
Container(
width: 75.w,
height: 75.w,
child: Icon(
Icons.youtube_searched_for,
size: 75.w,
), ),
), ),
SizedBox(width: 97.w), ],
Container(
width: 75.w,
height: 75.w,
child: Icon(
Icons.wysiwyg,
size: 75.w,
), ),
), ),
SizedBox(width: 47.w),
],
), ),
SizedBox(height: 8.w), body: ListView(
Row( padding: EdgeInsets.all(32.w),
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
// SizedBox(width: 37.w),
Container( Container(
// width:96.w, //
height: 33.w, width: double.infinity,
child: Text( height: 45.w,
'一键报警', child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'今日公告',
style: TextStyle( style: TextStyle(
color: Color(0xFF4A4B51), color: Color(0xFF4A4B51),
fontSize: 24.sp, fontSize: 32.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
), Spacer(),
// SizedBox(width: 76.w), AkuButton(
Container( //
// width:96.w, onPressed: () {},
height: 33.w, child: Row(
child: Text( children: [
'访客管理', Text(
'全部公告',
style: TextStyle( style: TextStyle(
color: Color(0xFF4A4B51), color: AppStyle.minorTextColor,
fontSize: 24.sp, fontSize: 24.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
Icon(
Icons.arrow_forward_ios,
size: 22.w,
color: AppStyle.minorTextColor,
)
],
),
),
],
),
), ),
// SizedBox(width: 76.w), SizedBox(height: 16.w),
//
Container( Container(
// width:96.w, color: Color(0xFFFFFFFF),
height: 33.w, //
child: Text( width: double.infinity,
'报事报修', height: 172.w,
//TODO listview
),
SizedBox(height: 32.w),
//
Container(
width: double.infinity,
height: 45.w,
child: Row(
children: [
Text(
'待办事项',
style: TextStyle( style: TextStyle(
color: Color(0xFF4A4B51), color: Color(0xFF4A4B51),
fontSize: 24.sp, fontSize: 32.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
), Spacer(),
// SizedBox(width: 76.w), AkuButton(
Container( onPressed: () {},
// width:96.w, child: Row(
height: 33.w, children: [
child: Text( Text(
'全部应用', '全部事项',
style: TextStyle( style: TextStyle(
color: Color(0xFF4A4B51), color: AppStyle.minorTextColor,
fontSize: 24.sp, fontSize: 24.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold),
),
Icon(
Icons.arrow_forward_ios,
size: 22.w,
color: AppStyle.minorTextColor,
),
],
), ),
), ),
],
),
), ),
// SizedBox(width: 37.w), SizedBox(height: 16.w),
//
Container(
width: double.infinity,
height: 449.w,
//TODO listview
),
SizedBox(height: 24.w),
//
Container(
width: double.infinity,
// height: 333.w,
child: Column(
children: [
Row(
children: [
_card('25', '未处理事项', Color(0xFFFF4E0D)),
AkuDiveder().verticalDivider(166.5.w),
_card('22', '处理中事项', Color(0xFFFFC40C)),
], ],
), ),
SizedBox(height: 23.w), Row(children: [
AkuDiveder().horizontalDivider(343.w),
AkuDiveder(isReverse: true).horizontalDivider(343.w)
]), ]),
Row(
children: [
_card('25', '已处理事项', Color(0xFF3F8FFE)),
AkuDiveder(isReverse: true).verticalDivider(
166.5.w,
),
_card('72', '全部事项', Color(0xFF333333)),
],
), ),
], ],
), ),
), ),
],
), ),
); );
} }

@ -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…
Cancel
Save