Browse Source

管理端app:

首页数据报表(ok)
门店选择(ok)
wr_2023_business
wurong 2 years ago
parent
commit
0c12bc9b73
  1. BIN
      assets/image/2x/bs_shop.webp
  2. BIN
      assets/image/3x/bs_shop.webp
  3. BIN
      assets/image/bs_shop.webp
  4. 194
      lib/business_system/home/business_home_page.dart
  5. 78
      lib/business_system/home/my_line_chart.dart
  6. 154
      lib/business_system/home/select_shop.dart
  7. 3
      lib/main.dart

BIN
assets/image/2x/bs_shop.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

BIN
assets/image/3x/bs_shop.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
assets/image/bs_shop.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

194
lib/business_system/home/business_home_page.dart

@ -22,13 +22,13 @@ class _BusinessHomePage extends State<BusinessHomePage>
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();
List<LineChartSample2Data> lineChartSample2Data = List<LineChartSample2Data> lineChartSample2Data =
[LineChartSample2Data(0,100,"2023-06-20"), [LineChartSample2Data(0,100,"2023-03-09"),
LineChartSample2Data(1,200,"2023-06-21"), LineChartSample2Data(1,200,"2023-03-10"),
LineChartSample2Data(2,400,"2023-06-22"), LineChartSample2Data(2,400,"2023-03-11"),
LineChartSample2Data(3,10,"2023-06-23"), LineChartSample2Data(3,10,"2023-03-12"),
LineChartSample2Data(4,250,"2023-06-24"), LineChartSample2Data(4,250,"2023-03-13"),
LineChartSample2Data(5,175,"2023-06-25"), LineChartSample2Data(5,175,"2023-03-14"),
LineChartSample2Data(6,500,"2023-06-26")]; LineChartSample2Data(6,500,"2023-03-15")];
@override @override
void initState() { void initState() {
@ -93,6 +93,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
GestureDetector( GestureDetector(
onTap: (){ onTap: (){
showAlertDialog(); showAlertDialog();
// Navigator.of(context).pushNamed('/router/select_shop');
}, },
child: Row( child: Row(
children: [ children: [
@ -303,101 +304,94 @@ class _BusinessHomePage extends State<BusinessHomePage>
decoration: new BoxDecoration( decoration: new BoxDecoration(
color: Colors.white, color: Colors.white,
), ),
child: SingleChildScrollView( child:Container(
physics: BouncingScrollPhysics(), child:
child: Container( Column(
child: mainAxisAlignment: MainAxisAlignment.start,
Column( crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, children: [
crossAxisAlignment: CrossAxisAlignment.start, Container(
children: [ padding:EdgeInsets.only(left:14.w,bottom: 33.h),
Container( child: Row(
padding:EdgeInsets.only(left:14.w,bottom: 33.h), children: [
child: Row( Image.asset(
children: [ "assets/image/default_user.webp",
Image.asset( width:57,
"assets/image/default_user.webp", height:57,
width:57, ),
height:57, SizedBox(width: 10.w,),
), Expanded(child:
SizedBox(width: 10.w,), Column(
Expanded(child: crossAxisAlignment: CrossAxisAlignment.start,
Column( children:[
crossAxisAlignment: CrossAxisAlignment.start, Text("前进麦味烘焙*海峡姐妹茶",
children:[ maxLines: 1,
Text("前进麦味烘焙*海峡姐妹茶", overflow: TextOverflow.ellipsis,
maxLines: 1, style: TextStyle(
overflow: TextOverflow.ellipsis, fontSize: 15.sp,
style: TextStyle( fontWeight: MyFontWeight.medium,
fontSize: 15.sp, color: Color(0xFF1A1A1A)
fontWeight: MyFontWeight.medium, ),),
color: Color(0xFF1A1A1A) SizedBox(height: 5.h,),
),), Text("123****1234",
SizedBox(height: 5.h,), style: TextStyle(
Text("123****1234", fontSize: 12.sp,
style: TextStyle( fontWeight: MyFontWeight.regular,
fontSize: 12.sp, color: Color(0xFF4D4D4D)
fontWeight: MyFontWeight.regular, ),),
color: Color(0xFF4D4D4D) ],
),), ))
], ],
))
],
),
), ),
Padding(padding: EdgeInsets.only(left: 16.w,bottom: 22.h), ),
child: Padding(padding: EdgeInsets.only(left: 16.w,bottom: 22.h),
Row( child:
children: [ Row(
Image.asset( children: [
"assets/image/bs_switch_shop.webp", Image.asset(
width:24, "assets/image/bs_switch_shop.webp",
height:24, width:24,
), height:24,
SizedBox(width: 4.w,), ),
Text("门店切换", SizedBox(width: 4.w,),
style: TextStyle( Text("门店切换",
fontSize: 15.sp, style: TextStyle(
fontWeight: MyFontWeight.semi_bold, fontSize: 15.sp,
color: Color(0xFF1A1A1A) fontWeight: MyFontWeight.semi_bold,
),), color: Color(0xFF1A1A1A)
], ),),
),), ],
Container( ),),
height: 450.h, Expanded(child:ListView.builder(
child: ListView.builder( padding: EdgeInsets.zero,
padding: EdgeInsets.zero, itemCount:5,
itemCount:5, scrollDirection: Axis.vertical,
scrollDirection: Axis.vertical, shrinkWrap: true,
shrinkWrap: true, physics: BouncingScrollPhysics(),
physics: BouncingScrollPhysics(), itemBuilder: (context, position) {
itemBuilder: (context, position) { return GestureDetector(
return GestureDetector( onTap: () {
onTap: () {
},
child: shopItem(),
);
}, },
), child: shopItem(),
) );
, },
Container( )),
alignment: Alignment.center, Container(
width: double.infinity, alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 9.h), width: double.infinity,
margin: EdgeInsets.only(left:16.w,right: 16.w,bottom: 103.h,top: 20.h), padding: EdgeInsets.symmetric(vertical: 9.h),
decoration: BoxDecoration( margin: EdgeInsets.only(left:16.w,right: 16.w,bottom: 103.h,top: 20.h),
color: Color(0xFF30415B), decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.w), color: Color(0xFF30415B),
), borderRadius: BorderRadius.circular(4.w),
child:Text("退出登录", ),
style: TextStyle( child:Text("退出登录",
fontSize: 14.sp, style: TextStyle(
fontWeight: MyFontWeight.medium, fontSize: 14.sp,
color: Colors.white fontWeight: MyFontWeight.medium,
),),), color: Colors.white
], ),),),
), ],
), ),
), ),
),); ),);

78
lib/business_system/home/my_line_chart.dart

@ -1,5 +1,6 @@
import 'package:fl_chart/fl_chart.dart'; import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../utils/font_weight.dart'; import '../../utils/font_weight.dart';
@ -26,11 +27,12 @@ class _LineChartSample2State extends State<LineChartSample2> {
} }
Widget bottomTitleWidgets(double value, TitleMeta meta) { Widget bottomTitleWidgets(double value, TitleMeta meta) {
if(value%1 != 0)
return Text("");
String text = widget.lineChartSample2Data[value.toInt()].time ?? ""; String text = widget.lineChartSample2Data[value.toInt()].time ?? "";
if (text.length == 10) if (text.length == 10)
text = text.substring(5, 10); text = text.substring(5, 10);
else if (text.length == 7) text = text.substring(2, 7); else if (text.length == 7) text = text.substring(2, 7);
text = text.replaceAll("-", "/");
return SideTitleWidget( return SideTitleWidget(
axisSide: meta.axisSide, axisSide: meta.axisSide,
child: Text(text, child: Text(text,
@ -70,18 +72,31 @@ class _LineChartSample2State extends State<LineChartSample2> {
} else { } else {
text = value.toInt().toString(); text = value.toInt().toString();
} }
return Text(text, return Padding(padding:EdgeInsets.only(right:2.w),
child: Text(text,
style: const TextStyle( style: const TextStyle(
fontWeight: MyFontWeight.light, fontWeight: MyFontWeight.light,
fontSize: 10, fontSize: 10,
color: Color(0xFF999999)), color: Color(0xFF999999)),
textAlign: TextAlign.left); textAlign: TextAlign.right),);
} }
LineChartData mainData() { LineChartData mainData() {
return LineChartData( return LineChartData(
gridData: FlGridData( gridData: FlGridData(
show: false, show: true,
getDrawingHorizontalLine: (value) {
return FlLine(
color: Color(0xFFEBEBEB),
strokeWidth: 1,
);
},
getDrawingVerticalLine: (value) {
return FlLine(
color: Colors.transparent,
strokeWidth: 1,
);
},
), ),
titlesData: FlTitlesData( titlesData: FlTitlesData(
show: true, show: true,
@ -111,10 +126,11 @@ class _LineChartSample2State extends State<LineChartSample2> {
color: Color(0xFFCBCBCB), color: Color(0xFFCBCBCB),
width: 1, width: 1,
), ),
left: BorderSide( //线
color: Color(0xFFCBCBCB), // left: BorderSide(
width: 1, // color: Color(0xFFCBCBCB),
), // width: 1,
// ),
), ),
), ),
minY: 0, minY: 0,
@ -127,9 +143,9 @@ class _LineChartSample2State extends State<LineChartSample2> {
return spotIndexes.map((spotIndex) { return spotIndexes.map((spotIndex) {
return TouchedSpotIndicatorData( return TouchedSpotIndicatorData(
FlLine( FlLine(
color: Color(0xFF0D0D0D), color: Color(0xFF165DFF),
strokeWidth: 1, strokeWidth: 1,
dashArray: [5, 5], dashArray: [2, 4],
), ),
FlDotData( FlDotData(
show: true, show: true,
@ -137,8 +153,8 @@ class _LineChartSample2State extends State<LineChartSample2> {
return FlDotCirclePainter( return FlDotCirclePainter(
radius: 3, radius: 3,
color: Colors.white, color: Colors.white,
strokeWidth: 2, strokeWidth: 2.w,
strokeColor: Color(0xFF0D0D0D), strokeColor: Color(0xFF165DFF),
); );
}, },
), ),
@ -146,18 +162,36 @@ class _LineChartSample2State extends State<LineChartSample2> {
}).toList(); }).toList();
}, },
touchTooltipData: LineTouchTooltipData( touchTooltipData: LineTouchTooltipData(
tooltipBgColor: Colors.transparent, tooltipBgColor: Color(0xFF3D3D3D),
tooltipPadding: const EdgeInsets.all(0), tooltipPadding: const EdgeInsets.symmetric(vertical:5,horizontal:6),
tooltipMargin: 5, tooltipMargin: 5,
tooltipRoundedRadius: 0, tooltipRoundedRadius: 2,
// tooltipHorizontalAlignment: FLHorizontalAlignment.center,
getTooltipItems: (touchedSpots) { getTooltipItems: (touchedSpots) {
return touchedSpots.map((LineBarSpot touchedSpot) { return touchedSpots.map((LineBarSpot touchedSpot) {
return LineTooltipItem( return LineTooltipItem(
'${touchedSpot.y.toInt()}', '${(widget.lineChartSample2Data[touchedSpot.x.toInt()].time ?? "").substring(5,10)}',
const TextStyle( const TextStyle(
color: Color(0xFF0D0D0D), color: Colors.white,
fontWeight: MyFontWeight.light, fontWeight: MyFontWeight.light,
fontSize: 15), fontSize: 10),
textAlign: TextAlign.start,
children: [
TextSpan(
text: '\n订单量: ',
style: const TextStyle(
color: Colors.white,
fontWeight: MyFontWeight.medium,
fontSize: 10),
),
TextSpan(
text: '${touchedSpot.y.toInt()}',
style: const TextStyle(
color: Color(0xFFFFC163),
fontWeight: MyFontWeight.light,
fontSize: 10),
),
],
); );
}).toList(); }).toList();
}, },
@ -168,11 +202,11 @@ class _LineChartSample2State extends State<LineChartSample2> {
spots: widget.lineChartSample2Data spots: widget.lineChartSample2Data
.map((e) => FlSpot(e.index ?? 0, e.price ?? 0)) .map((e) => FlSpot(e.index ?? 0, e.price ?? 0))
.toList(), .toList(),
isCurved: true, isCurved: false,
color: Color(0xFF0D0D0D), color: Color(0xFF165DFF),
barWidth: 1, barWidth:2.5,
dotData: FlDotData( dotData: FlDotData(
show: true, show: false,
getDotPainter: (spot, percent, barData, index) { getDotPainter: (spot, percent, barData, index) {
return FlDotCirclePainter( return FlDotCirclePainter(
radius: 3, radius: 3,

154
lib/business_system/home/select_shop.dart

@ -0,0 +1,154 @@
import 'package:flutter/material.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../generated/l10n.dart';
import '../../view_widget/classic_header.dart';
import '../../view_widget/my_footer.dart';
class SelectShop extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _SelectShop();
}
}
class _SelectShop extends State<SelectShop> {
ApiService apiService;
final RefreshController refreshController = RefreshController();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return
Scaffold(
backgroundColor: Colors.white,
appBar: MyAppBar(
title: "选择门店",
titleColor: Colors.black,
background: Colors.white,
leadingColor: Colors.black,
brightness: Brightness.dark,
),
body: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(
color: Colors.white,
),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () {
},
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: Container(
height: double.infinity,
padding: EdgeInsets.only(top: 13.h,left:16.w,right:16.w),
child:Column(
children: [
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)
),),
],
),
SizedBox(height:20.h,),
Expanded(child: ListView.builder(
padding: EdgeInsets.zero,
itemCount:20,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
},
child: shopsItem(),
);
},
)),
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(vertical:16.h),
margin: EdgeInsets.only(bottom:34.h,top: 10.h),
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(27.w),
),
child:Text(
S.of(context).queding,
style: TextStyle(
fontWeight: MyFontWeight.bold,
fontSize: 16.sp,
color: Colors.white,
),
),
),
],
),
),
),
);
}
Widget shopsItem(){
return Container(
height: 52.h,
margin: EdgeInsets.only(bottom: 12),
child: Stack(
alignment: Alignment.bottomRight,
children: [
Container(
height: 52.h,
width: double.infinity,
decoration: BoxDecoration(
color: Color(0xFFEFF5FF),
borderRadius: BorderRadius.circular(4.w),
border: Border.all(
color: Color(0xFF30415B),
width: 1.w,
),
),
padding: EdgeInsets.only(top:16.h,bottom:16.h,left: 16.w,right: 17.w),
child: Text("前进麦味烘焙*海峡姐妹茶(哈乐城店)",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B)
),),
),
Image.asset(
"assets/image/bs_shop.webp",
width: 20,
height: 20,
fit: BoxFit.fill,
),
],
),
);
}
}

3
lib/main.dart

@ -87,6 +87,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'business_system/business_page.dart'; import 'business_system/business_page.dart';
import 'business_system/home/business_home_page.dart'; import 'business_system/home/business_home_page.dart';
import 'business_system/home/flow_page.dart'; import 'business_system/home/flow_page.dart';
import 'business_system/home/select_shop.dart';
import 'business_system/login/business_login_page.dart'; import 'business_system/login/business_login_page.dart';
import 'community/community_view/class_details.dart'; import 'community/community_view/class_details.dart';
import 'community/headlines/headlines_column_details.dart'; import 'community/headlines/headlines_column_details.dart';
@ -450,4 +451,6 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
BusinessPage(arguments: arguments), BusinessPage(arguments: arguments),
'/router/flow_page': (context, {arguments}) => '/router/flow_page': (context, {arguments}) =>
FlowPage(), FlowPage(),
'/router/select_shop': (context, {arguments}) =>
SelectShop(),
}; };

Loading…
Cancel
Save