You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

404 lines
13 KiB

4 years ago
import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
4 years ago
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/personal_draw.dart';
import 'package:aku_community_manager/ui/tool_pages/scan_page.dart';
4 years ago
import 'package:aku_ui/aku_ui.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
4 years ago
import 'package:get/get.dart';
import 'package:provider/provider.dart';
4 years ago
class HomePage extends StatefulWidget {
HomePage({Key key}) : super(key: key);
@override
_HomePageState createState() => _HomePageState();
}
//自定义bar的菜单按钮
Widget _menuButton(IconData iconData, String text, Widget page) {
4 years ago
return Expanded(
child: AkuButton(
radius: 8.w,
height: 75.w + 8.w + 33.w,
onPressed: () {
Get.to(page);
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
iconData,
size: 75.w,
),
4 years ago
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(
4 years ago
color: color,
fontSize: 40.sp,
fontFamily: 'Bebas',
),
),
SizedBox(
height: 16.w,
),
Text(text,
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 24.sp,
fontWeight: FontWeight.bold)),
Spacer(),
],
)),
);
4 years ago
}
4 years ago
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context);
4 years ago
ScreenUtil.init(context,
designSize: Size(750, 1334), allowFontScaling: true);
return Scaffold(
drawer: PersonalDraw(),
backgroundColor: Color(0xFFF9F9F9),
//自定义bar
4 years ago
appBar: PreferredSize(
preferredSize: Size(375.w, 430.w - 40.w + statusBarHeight),
4 years ago
child: Container(
height: 430.w - 40.w + ScreenUtil().statusBarHeight,
width: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0xFFFFDC6F),
Color(0xFFFFC40C),
],
),
borderRadius: BorderRadius.only(bottomRight: Radius.circular(32.w)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: ScreenUtil().statusBarHeight),
Container(
height: 88.w,
child: Row(children: [
SizedBox(
width: 16.w,
),
Container(
4 years ago
margin: EdgeInsets.only(top: 8.w, bottom: 8.w),
width: 72.w,
height: 72.w,
//头像按钮
child: Builder(
builder: (BuildContext context) {
return GestureDetector(
onTap: () {
Scaffold.of(context).openDrawer();
},
child: CircleAvatar(
radius: 36.w,
backgroundColor: Colors.grey,
child: userProvider.isSigned ? null : null,
),
);
4 years ago
},
),
),
4 years ago
SizedBox(width: 16.w),
Expanded(
child: Container(
margin: EdgeInsets.only(top: 8.w, bottom: 8.w),
alignment: Alignment.center,
height: 72.w,
child: AkuButton(
//搜索框按钮
color: Color(0xFFFFFFFF),
onPressed: () {},
4 years ago
radius: 8.w,
child: Row(children: [
Container(
child: Column(
children: [
SizedBox(height: 18.w),
Icon(
Icons.zoom_in_sharp,
size: 38.w,
),
],
),
4 years ago
),
SizedBox(width: 19.w),
Text(
'搜索工单订单号、手机',
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 28.sp,
4 years ago
),
),
]),
),
4 years ago
),
),
4 years ago
SizedBox(width: 15.w),
4 years ago
Container(
margin: EdgeInsets.only(top: 5.w, bottom: 5.w),
child: MaterialButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
//扫一扫按钮
height: double.infinity,
minWidth: 78.w,
padding: EdgeInsets.zero,
onPressed: () {
Get.to(ScanPage());
},
4 years ago
child: Column(children: [
4 years ago
Image.asset(
R.ASSETS_HOME_IC_SCAN_PNG,
height: 48.w,
width: 48.w,
4 years ago
),
Text(
'扫一扫',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 20.sp,
fontWeight: FontWeight.normal,
),
),
]),
),
),
Container(
margin: EdgeInsets.only(top: 5.w, bottom: 5.w),
child: AkuMaterialButton(
minWidth: 78.w,
//消息按钮
height: double.infinity,
onPressed: () {},
child: Column(children: [
4 years ago
Image.asset(
R.ASSETS_HOME_IC_NEWS_PNG,
height: 48.w,
width: 48.w,
4 years ago
),
Text(
'消息',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 20.sp,
),
),
]),
),
),
4 years ago
SizedBox(width: 17.w),
4 years ago
]),
),
SizedBox(height: 24.w),
Container(
margin: EdgeInsets.only(
left: 32.w,
),
height: 67.w,
child: Text(
'HI李大海',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontWeight: FontWeight.bold,
fontSize: 48.sp),
),
),
SizedBox(height: 16.w),
Container(
margin: EdgeInsets.only(left: 32.w, right: 32.w),
width: double.infinity,
height: 163.w,
4 years ago
decoration: BoxDecoration(
color: Color(0xFFFFFFFF),
borderRadius: BorderRadius.circular(8.w),
),
4 years ago
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
_menuButton(Icons.wysiwyg, '一键报警', HomePage()),
_menuButton(Icons.work, '访客管理', HomePage()),
_menuButton(Icons.accessibility, '报事报修', HomePage()),
_menuButton(Icons.account_balance, '全部应用', HomePage()),
4 years ago
],
),
4 years ago
),
],
),
),
),
body: ListView(
padding: EdgeInsets.all(32.w),
children: [
Container(
//公告标题行
width: double.infinity,
height: 45.w,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'今日公告',
style: TextStyle(
color: Color(0xFF4A4B51),
fontSize: 32.sp,
fontWeight: FontWeight.bold,
4 years ago
),
),
Spacer(),
AkuButton(
//全部公告按钮
onPressed: () {},
child: Row(
4 years ago
children: [
Text(
'全部公告',
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 24.sp,
fontWeight: FontWeight.bold,
4 years ago
),
),
Icon(
Icons.arrow_forward_ios,
size: 22.w,
color: AppStyle.minorTextColor,
)
4 years ago
],
),
),
],
),
),
SizedBox(height: 16.w),
//公告栏
Container(
color: Color(0xFFFFFFFF),
//公告栏
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(
color: Color(0xFF4A4B51),
fontSize: 32.sp,
fontWeight: FontWeight.bold,
),
),
Spacer(),
AkuButton(
onPressed: () {},
child: Row(
4 years ago
children: [
Text(
'全部事项',
style: TextStyle(
color: AppStyle.minorTextColor,
4 years ago
fontSize: 24.sp,
fontWeight: FontWeight.bold),
4 years ago
),
Icon(
Icons.arrow_forward_ios,
size: 22.w,
color: AppStyle.minorTextColor,
4 years ago
),
],
),
),
],
),
),
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)),
],
),
4 years ago
Row(children: [
AkuDiveder().horizontalDivider(343.w),
AkuDiveder(isReverse: true).horizontalDivider(343.w)
4 years ago
]),
Row(
children: [
_card('25', '已处理事项', Color(0xFF3F8FFE)),
AkuDiveder(isReverse: true).verticalDivider(
166.5.w,
),
_card('72', '全部事项', Color(0xFF333333)),
],
),
],
),
4 years ago
),
],
4 years ago
),
);
}
}