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.
 
 
 
 
 
 

932 lines
31 KiB

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../utils/font_weight.dart';
import 'my_line_chart.dart';
class BusinessHomePage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _BusinessHomePage();
}
}
class _BusinessHomePage extends State<BusinessHomePage>
with AutomaticKeepAliveClientMixin {
ApiService apiService;
final RefreshController refreshController = RefreshController();
final ScrollController scrollController = ScrollController();
List<LineChartSample2Data> lineChartSample2Data =
[LineChartSample2Data(0,100,"2023-06-20"),
LineChartSample2Data(1,200,"2023-06-21"),
LineChartSample2Data(2,400,"2023-06-22"),
LineChartSample2Data(3,10,"2023-06-23"),
LineChartSample2Data(4,250,"2023-06-24"),
LineChartSample2Data(5,175,"2023-06-25"),
LineChartSample2Data(6,500,"2023-06-26")];
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
super.build(context);
return Column(
children: [
Expanded(
child: Container(
child: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
physics: BouncingScrollPhysics(),
scrollController: scrollController,
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () {
setState(() {});
},
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Column(
children: [
homeTop(),
businessOverview(),
userOverview(),
hotSellHotCharts(),
todayFlow(),
],
)),
),
),
),
SizedBox(
height: 76.h,
),
],
);
}
///首页头部
Widget homeTop() {
return Container(
color: Color(0xFF30415B),
width: double.infinity,
padding: EdgeInsets.only(
top: MediaQuery.of(context).padding.top + 23.h,
bottom: 16.h,
left: 16.w,
right: 16.w),
child: Column(
children: [
GestureDetector(
onTap: (){
showAlertDialog();
},
child: Row(
children: [
Image.asset(
"assets/image/bs_more.webp",
width: 16.w,
height: 13.h,
),
Padding(
padding: EdgeInsets.only(left: 7.w),
child: Text(
"海峽姐妹茶 郑州新田360店",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
color: Colors.white,
),
),
),
],
),
),
SizedBox(
height: 14.h,
),
Container(
padding: EdgeInsets.symmetric(horizontal: 23.w, vertical: 12.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(4),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
Image.asset(
"assets/image/bs_home_bill.webp",
width: 14,
height: 14,
),
Padding(
padding: EdgeInsets.only(left: 3.w),
child: Text(
"营业额(元)",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF30415B),
),
),
),
],
),
Padding(
padding: EdgeInsets.only(top: 6.h, bottom: 17.h),
child: Text(
"1288890.00",
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B),
),
),
),
Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Image.asset(
"assets/image/bs_trade_num.webp",
width: 16,
height: 16,
),
Padding(
padding: EdgeInsets.only(left: 3.w),
child: Text(
"交易笔数",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B),
),
),
),
],
),
Padding(
padding: EdgeInsets.only(top: 5.h),
child: Text(
"12",
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B),
),
),
),
],
)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/image/bs_refund.webp",
width: 14,
height: 14,
),
Padding(
padding: EdgeInsets.only(left: 3.w),
child: Text(
"退款金额(元)",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B),
),
),
),
],
),
Padding(
padding: EdgeInsets.only(top: 5.h),
child: Text(
"12999.00",
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B),
),
),
),
],
)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Image.asset(
"assets/image/bs_refund_num.webp",
width: 14,
height: 14,
),
Padding(
padding: EdgeInsets.only(left: 3.w),
child: Text(
"退款笔数",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B),
),
),
),
],
),
Padding(
padding: EdgeInsets.only(top: 5.h),
child: Text(
"129",
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B),
),
),
),
],
))
],
),
],
),
)
],
),
);
}
///侧面弹窗
showAlertDialog() {
showCupertinoModalPopup(
builder: (BuildContext context) {
return StatefulBuilder(builder: (
context,
state,
) {
return WillPopScope(
///点击背景不收起弹窗;
// onWillPop: () async => false,
child: Container(
width: double.infinity,
margin: EdgeInsets.only(right:61.w),
height: double.infinity,
padding: EdgeInsets.only(top: 55.h),
decoration: new BoxDecoration(
color: Colors.white,
),
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
child:
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding:EdgeInsets.only(left:14.w,bottom: 33.h),
child: Row(
children: [
Image.asset(
"assets/image/default_user.webp",
width:57,
height:57,
),
SizedBox(width: 10.w,),
Expanded(child:
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:[
Text("前进麦味烘焙*海峡姐妹茶",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF1A1A1A)
),),
SizedBox(height: 5.h,),
Text("123****1234",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF4D4D4D)
),),
],
))
],
),
),
Padding(padding: EdgeInsets.only(left: 16.w,bottom: 22.h),
child:
Row(
children: [
Image.asset(
"assets/image/bs_switch_shop.webp",
width:24,
height:24,
),
SizedBox(width: 4.w,),
Text("门店切换",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF1A1A1A)
),),
],
),),
Container(
height: 450.h,
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount:5,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
},
child: shopItem(),
);
},
),
)
,
Container(
alignment: Alignment.center,
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: 9.h),
margin: EdgeInsets.only(left:16.w,right: 16.w,bottom: 103.h,top: 20.h),
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(4.w),
),
child:Text("退出登录",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white
),),),
],
),
),
),
),);
});
},
context: context);
}
///门店选择
Widget shopItem(){
return Container(
decoration: BoxDecoration(
color: Color(0xFFF8F9FA),
borderRadius: BorderRadius.circular(4.w),
),
margin:EdgeInsets.only(bottom: 11.h),
padding: EdgeInsets.only(top: 5.h,bottom: 8.h,left: 16.w,right: 17.w),
child: Row(
children: [
Expanded(child:Text("前进麦味烘焙*海峡姐妹茶(哈乐城店)",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B)
),)),
Icon(
Icons.check,
size: 20,
color: Color(0xFF4D4D4D),)
],
),
);
}
///生意总览
Widget businessOverview() {
return Container(
padding:
EdgeInsets.only(left: 16.w, right: 21.w, top: 12.h, bottom: 16.h),
color: Colors.white,
child: Column(
children: [
Row(
children: [
Container(width: 4.w, height: 16.h, color: Color(0xFF30415B)),
Padding(
padding: EdgeInsets.only(left: 12.w, right: 8.w),
child: Text(
"生意总览",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF0D0D0D),
),
),
),
Expanded(
child: Text(
"近一周订单量趋势",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0x99000000),
),
)),
Text(
"更多数据",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF252626),
),
),
SizedBox(width: 5.w,),
Image.asset(
"assets/image/bs_right.webp",
width: 8.w,
height: 12.h,
),
],
),
SizedBox(
height: 18.h,
),
LineChartSample2(lineChartSample2Data),
],
),
);
}
///用户概览
Widget userOverview() {
return Container(
color: Colors.white,
margin: EdgeInsets.only(top: 16.h),
padding: EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 12.h),
child: Column(
children: [
Row(
children: [
Container(width: 4.w, height: 16.h, color: Color(0xFF30415B)),
Padding(
padding: EdgeInsets.only(
left: 12.w,
),
child: Text(
"用户概览",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF0D0D0D),
),
),
),
],
),
SizedBox(
height: 12.h,
),
Row(
children: [
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 8.w,vertical:6.h),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFFFC5A58), Color(0xFFFF716F)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
borderRadius: BorderRadius.circular(6.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Padding(padding: EdgeInsets.only(right: 6.w),
child: Text(
"今日会员充值",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),),
Image.asset(
"assets/image/bs_query_logo.webp",
width: 14,
height: 14,
),
],
),
SizedBox(
height: 7.h,
),
Text(
"108088",
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
],
),
)),
SizedBox(width:9.w,),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 8.w,vertical:6.h),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFFFFA238), Color(0xFFFFBA6D)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
borderRadius: BorderRadius.circular(6.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Padding(padding: EdgeInsets.only(right: 6.w),
child: Text(
"今日新增会员",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),),
Image.asset(
"assets/image/bs_query_logo.webp",
width: 14,
height: 14,
),
],
),
SizedBox(
height: 7.h,
),
Text(
"666",
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
],
),
)),
SizedBox(width:9.w,),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 8.w,vertical:6.h),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF4B77FC), Color(0xFF7091FF)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
borderRadius: BorderRadius.circular(6.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Padding(padding: EdgeInsets.only(right: 6.w),
child: Text(
"总会员数",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),),
Image.asset(
"assets/image/bs_query_logo.webp",
width: 14,
height: 14,
),
],
),
SizedBox(
height: 7.h,
),
Text(
"23455",
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
],
),
)),
],
)
],
),
);
}
///热销榜单
Widget hotSellHotCharts(){
return Container(
color: Colors.white,
margin: EdgeInsets.only(top: 16.h),
padding: EdgeInsets.only(left: 16.w, right: 15.w, top: 12.h, bottom: 16.h),
child: Column(
children: [
Row(
children: [
Container(width: 4.w, height: 16.h, color: Color(0xFF30415B)),
Padding(
padding: EdgeInsets.only(left: 12.w,),
child: Text(
"热销榜单",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF0D0D0D),
),
),
),
],
),
SizedBox(height:14.h,),
Container(
height:25.h,
margin:EdgeInsets.only(bottom:26.h),
child: ListView.builder(
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
itemCount:4,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
},
child: dayItem(),
);
},
),
),
ListView.builder(
padding: EdgeInsets.zero,
itemCount:5,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
},
child: salesVolumeItem(),
);
},
)
],
),
);
}
///天数item
Widget dayItem(){
return Container(
padding: EdgeInsets.symmetric(horizontal:19.w,),
alignment: Alignment.center,
margin: EdgeInsets.only(right:16.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2.w),
// color: Color(0xFF30415B),
border: Border.all(
color: Color(0xFF30415B),
width: 1.w,
),
),
child: Text(
"今天",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0XFF30415B),
),
),
);
}
///销量item
Widget salesVolumeItem(){
return Container(
padding: EdgeInsets.only(bottom:12.h),
child: Row(
children: [
Image.asset(
"assets/image/bs_trophy_one.webp",
width:26,
height:26,
),
// Text(
// "1",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.regular,
// color: Color(0xFF0D0D0D),
// ),
// ),
SizedBox(width:8.w,),
Expanded(child:Text(
"满杯花青素",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF0D0D0D),
),
),),
Text(
"已售",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF0D0D0D),
),
),
Padding(padding:EdgeInsets.only(left: 7.w),
child: Text(
"1888件",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF0D0D0D),
),
),)
],
),
);
}
///今日流水
Widget todayFlow(){
return Container(
color: Colors.white,
margin: EdgeInsets.only(top: 16.h),
padding: EdgeInsets.only(left: 16.w, right:21.w, top: 12.h, bottom: 16.h),
child:Column(
children: [
Row(
children: [
Container(width: 4.w, height: 16.h, color: Color(0xFF30415B),margin: EdgeInsets.only(right:12.w),),
Expanded(
child: Text(
"今日流水",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF0D0D0D),
),
)),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pushNamed('/router/flow_page');
},
child: Row(
children: [
Text(
"更多数据",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF252626),
),
),
SizedBox(width:5.w,),
Image.asset(
"assets/image/bs_right.webp",
width: 8.w,
height: 12.h,
),
],
),
),
],
),
SizedBox(height:20.h,),
ListView.builder(
padding: EdgeInsets.zero,
itemCount:5,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
},
child: flowItem(),
);
},
)
],
),
);
}
///流水item
Widget flowItem(){
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(0.w),
color: Color(0xFFF3F7FF),
),
margin: EdgeInsets.only(bottom: 12.h),
padding: EdgeInsets.symmetric(horizontal: 17.w, vertical:8.h),
child:Row(
children: [
Expanded(child:Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"2023-06-04 9:00:05",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xD9000000),
),
),
SizedBox(height:7.h,),
Text(
"海峽姐妹茶 郑州新田360店",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0x99000000),
),
),
],
)),
Text.rich(
TextSpan(
children: [
TextSpan(
text:"+",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xD9000000),
),
),
TextSpan(
text: "34.00",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xD9000000),
),
),
],
),
),
],
),
);
}
@override
bool get wantKeepAlive => true;
}