diff --git a/assets/image/2x/bs_shop.webp b/assets/image/2x/bs_shop.webp new file mode 100644 index 00000000..5308f65d Binary files /dev/null and b/assets/image/2x/bs_shop.webp differ diff --git a/assets/image/3x/bs_shop.webp b/assets/image/3x/bs_shop.webp new file mode 100644 index 00000000..e2e0745e Binary files /dev/null and b/assets/image/3x/bs_shop.webp differ diff --git a/assets/image/bs_shop.webp b/assets/image/bs_shop.webp new file mode 100644 index 00000000..cc55983a Binary files /dev/null and b/assets/image/bs_shop.webp differ diff --git a/lib/business_system/home/business_home_page.dart b/lib/business_system/home/business_home_page.dart index e66925f2..4cf51021 100644 --- a/lib/business_system/home/business_home_page.dart +++ b/lib/business_system/home/business_home_page.dart @@ -22,13 +22,13 @@ class _BusinessHomePage extends State final RefreshController refreshController = RefreshController(); final ScrollController scrollController = ScrollController(); List 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 GestureDetector( onTap: (){ showAlertDialog(); + // Navigator.of(context).pushNamed('/router/select_shop'); }, child: Row( children: [ @@ -303,101 +304,94 @@ class _BusinessHomePage extends State 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) - ),), - ], - )) - ], - ), + 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(), - ); + ), + 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) + ),), + ], + ),), + Expanded(child:ListView.builder( + padding: EdgeInsets.zero, + itemCount:5, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { }, - ), - ) - , - 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 - ),),), - ], - ), + 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 + ),),), + ], ), ), ),); diff --git a/lib/business_system/home/my_line_chart.dart b/lib/business_system/home/my_line_chart.dart index 635116e3..851b22da 100644 --- a/lib/business_system/home/my_line_chart.dart +++ b/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 { } 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 { } 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 { 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 { 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 { 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 { }).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: 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(); }, @@ -168,11 +202,11 @@ class _LineChartSample2State extends State { 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, diff --git a/lib/business_system/home/select_shop.dart b/lib/business_system/home/select_shop.dart new file mode 100644 index 00000000..92845cc0 --- /dev/null +++ b/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 createState() { + return _SelectShop(); + } +} + +class _SelectShop extends State { + 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, + ), + ], + ), + ); + } + +} diff --git a/lib/main.dart b/lib/main.dart index 47db611f..a055da2d 100644 --- a/lib/main.dart +++ b/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 routers = { BusinessPage(arguments: arguments), '/router/flow_page': (context, {arguments}) => FlowPage(), + '/router/select_shop': (context, {arguments}) => + SelectShop(), };