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. 26
      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

26
lib/business_system/home/business_home_page.dart

@ -22,13 +22,13 @@ class _BusinessHomePage extends State<BusinessHomePage>
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")];
[LineChartSample2Data(0,100,"2023-03-09"),
LineChartSample2Data(1,200,"2023-03-10"),
LineChartSample2Data(2,400,"2023-03-11"),
LineChartSample2Data(3,10,"2023-03-12"),
LineChartSample2Data(4,250,"2023-03-13"),
LineChartSample2Data(5,175,"2023-03-14"),
LineChartSample2Data(6,500,"2023-03-15")];
@override
void initState() {
@ -93,6 +93,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
GestureDetector(
onTap: (){
showAlertDialog();
// Navigator.of(context).pushNamed('/router/select_shop');
},
child: Row(
children: [
@ -303,8 +304,6 @@ class _BusinessHomePage extends State<BusinessHomePage>
decoration: new BoxDecoration(
color: Colors.white,
),
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child:Container(
child:
Column(
@ -363,9 +362,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
),),
],
),),
Container(
height: 450.h,
child: ListView.builder(
Expanded(child:ListView.builder(
padding: EdgeInsets.zero,
itemCount:5,
scrollDirection: Axis.vertical,
@ -378,9 +375,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
child: shopItem(),
);
},
),
)
,
)),
Container(
alignment: Alignment.center,
width: double.infinity,
@ -399,7 +394,6 @@ class _BusinessHomePage extends State<BusinessHomePage>
],
),
),
),
),);
});
},

78
lib/business_system/home/my_line_chart.dart

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

Loading…
Cancel
Save