diff --git a/lib/business_system/business_page.dart b/lib/business_system/business_page.dart index b015c79a..aa1af9c0 100644 --- a/lib/business_system/business_page.dart +++ b/lib/business_system/business_page.dart @@ -22,7 +22,6 @@ class BusinessPage extends StatefulWidget { class _BusinessPage extends State with AutomaticKeepAliveClientMixin { int choiceIndex = 0; - @override void initState() { super.initState(); @@ -56,9 +55,10 @@ class _BusinessPage extends State Align( alignment: Alignment.bottomCenter, child: Container( - height:95.h, + height:85.h, width: double.infinity, - padding: EdgeInsets.only(top: 30.h), + color: Colors.white, + padding: EdgeInsets.only(top:20.h), child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/business_system/date_select/day_report_page.dart b/lib/business_system/date_select/day_report_page.dart new file mode 100644 index 00000000..ca41ce18 --- /dev/null +++ b/lib/business_system/date_select/day_report_page.dart @@ -0,0 +1,91 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:syncfusion_flutter_datepicker/datepicker.dart'; + +import '../../view_widget/my_appbar.dart'; + +class DayReportPage extends StatefulWidget { + + @override + State createState() { + return _DayReportPage(); + } +} + +class _DayReportPage extends State{ + String _selectedDate = ''; + String _dateCount = ''; + String _range = ''; + String _rangeCount = ''; + + @override + void initState() { + super.initState(); + } + + void _onSelectionChanged(DateRangePickerSelectionChangedArgs args) { + setState(() { + if (args.value is PickerDateRange) { + _range = + DateFormat('dd/MM/yyyy').format(args.value.startDate).toString() + + ' - ' + + DateFormat('dd/MM/yyyy') + .format(args.value.endDate ?? args.value.startDate) + .toString(); + } else if (args.value is DateTime) { + _selectedDate = args.value.toString(); + } else if (args.value is List) { + _dateCount = args.value.length.toString(); + } else { + _rangeCount = args.value.length.toString(); + } + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppBar( + title: "时间选择", + titleColor: Colors.black, + leadingColor: Colors.black, + background: Colors.white, + ), + body: Stack( + children: [ + Positioned( + left: 0, + right: 0, + top: 0, + height: 80, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Selected date: ' + _selectedDate), + Text('Selected date count: ' + _dateCount), + Text('Selected range: ' + _range), + Text('Selected ranges count: ' + _rangeCount) + ], + ), + ), + Positioned( + left: 0, + top: 80, + right: 0, + bottom: 0, + child: SfDateRangePicker( + onSelectionChanged: _onSelectionChanged, + selectionMode: DateRangePickerSelectionMode.single, + selectionColor: Color(0xFF30415B), + initialSelectedRange: PickerDateRange( + DateTime.now().subtract(const Duration(days: 4)), + DateTime.now().add(const Duration(days: 3))), + ), + ) + ], + )); + } +} diff --git a/lib/business_system/date_select/monthly_report_page.dart b/lib/business_system/date_select/monthly_report_page.dart new file mode 100644 index 00000000..c7af9817 --- /dev/null +++ b/lib/business_system/date_select/monthly_report_page.dart @@ -0,0 +1,86 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:syncfusion_flutter_datepicker/datepicker.dart'; + +import '../../view_widget/my_appbar.dart'; + +class MonthlyReportPage extends StatefulWidget { + + @override + State createState() { + return _MonthlyReportPage(); + } +} + +class _MonthlyReportPage extends State{ + String _selectedDate = ''; + String _dateCount = ''; + String _range = ''; + String _rangeCount = ''; + + void _onSelectionChanged(DateRangePickerSelectionChangedArgs args) { + setState(() { + if (args.value is PickerDateRange) { + _range = + DateFormat('dd/MM/yyyy').format(args.value.startDate).toString() + + ' - ' + + DateFormat('dd/MM/yyyy') + .format(args.value.endDate ?? args.value.startDate) + .toString(); + } else if (args.value is DateTime) { + _selectedDate = args.value.toString(); + } else if (args.value is List) { + _dateCount = args.value.length.toString(); + } else { + _rangeCount = args.value.length.toString(); + } + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppBar( + title: "时间选择", + titleColor: Colors.black, + leadingColor: Colors.black, + background: Colors.white, + ), + body: Stack( + children: [ + Positioned( + left: 0, + right: 0, + top: 0, + height: 80, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Selected date: ' + _selectedDate), + Text('Selected date count: ' + _dateCount), + Text('Selected range: ' + _range), + Text('Selected ranges count: ' + _rangeCount) + ], + ), + ), + Positioned( + left: 0, + top: 80, + right: 0, + bottom: 0, + child: SfDateRangePicker( + onSelectionChanged: _onSelectionChanged, + selectionMode: DateRangePickerSelectionMode.range, + selectionShape: DateRangePickerSelectionShape.rectangle, + initialSelectedRange: PickerDateRange( + DateTime.now().subtract(const Duration(days: 4)), + DateTime.now().add(const Duration(days: 3))), + ), + ) + ], + )); + } +} diff --git a/lib/business_system/date_select/week_report_page.dart b/lib/business_system/date_select/week_report_page.dart new file mode 100644 index 00000000..f0c240d0 --- /dev/null +++ b/lib/business_system/date_select/week_report_page.dart @@ -0,0 +1,87 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:syncfusion_flutter_datepicker/datepicker.dart'; + +import '../../view_widget/my_appbar.dart'; + +class WeekReportPage extends StatefulWidget { + + @override + State createState() { + return _WeekReportPage(); + } +} + +class _WeekReportPage extends State{ + String _selectedDate = ''; + String _dateCount = ''; + String _range = ''; + String _rangeCount = ''; + + void _onSelectionChanged(DateRangePickerSelectionChangedArgs args) { + setState(() { + if (args.value is PickerDateRange) { + _range = + DateFormat('dd/MM/yyyy').format(args.value.startDate).toString() + + ' - ' + + DateFormat('dd/MM/yyyy') + .format(args.value.endDate ?? args.value.startDate) + .toString(); + } else if (args.value is DateTime) { + _selectedDate = args.value.toString(); + } else if (args.value is List) { + _dateCount = args.value.length.toString(); + } else { + _rangeCount = args.value.length.toString(); + } + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppBar( + title: "时间选择", + titleColor: Colors.black, + leadingColor: Colors.black, + background: Colors.white, + ), + body: Stack( + children: [ + Positioned( + left: 0, + right: 0, + top: 0, + height: 80, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Selected date: ' + _selectedDate), + Text('Selected date count: ' + _dateCount), + Text('Selected range: ' + _range), + Text('Selected ranges count: ' + _rangeCount) + ], + ), + ), + Positioned( + left: 0, + top: 80, + right: 0, + bottom: 0, + child: SfDateRangePicker( + onSelectionChanged: _onSelectionChanged, + selectionMode: DateRangePickerSelectionMode.range, + startRangeSelectionColor:Color(0xFF30415B), + endRangeSelectionColor:Color(0xFF30415B), + initialSelectedRange: PickerDateRange( + DateTime.now().subtract(const Duration(days: 4)), + DateTime.now().add(const Duration(days: 3))), + ), + ) + ], + )); + } +} diff --git a/lib/business_system/goods/goods_search_page.dart b/lib/business_system/goods/goods_search_page.dart index 6c510f2e..c137b019 100644 --- a/lib/business_system/goods/goods_search_page.dart +++ b/lib/business_system/goods/goods_search_page.dart @@ -92,7 +92,6 @@ class _GoodsSearchPage extends State child: Container( height: 40.h, margin: EdgeInsets.only(left: 18.w,right: 18.w,top:17.h,bottom: 10.h), - padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), decoration: BoxDecoration( color: Color(0xFFF7F8FA), borderRadius: BorderRadius.circular(2), @@ -116,9 +115,6 @@ class _GoodsSearchPage extends State fontSize: 15.sp, fontWeight: MyFontWeight.regular ), - contentPadding: EdgeInsets.symmetric( - vertical: 12.h, - ), prefixIcon: Image.asset( "assets/image/bs_goods_search.webp", width: 20, diff --git a/lib/business_system/home/business_home_page.dart b/lib/business_system/home/business_home_page.dart index a697f861..858aa3fb 100644 --- a/lib/business_system/home/business_home_page.dart +++ b/lib/business_system/home/business_home_page.dart @@ -683,7 +683,7 @@ class _BusinessHomePage extends State Widget todayFlow(){ return Container( color: Colors.white, - margin: EdgeInsets.only(top: 16.h), + margin: EdgeInsets.only(top: 16.h,bottom: 26.h), padding: EdgeInsets.only(left: 16.w, right:21.w, top: 12.h, bottom: 16.h), child:Column( children: [ diff --git a/lib/business_system/home/overview/trade_summary.dart b/lib/business_system/home/overview/trade_summary.dart index e7cc7cb1..d0a7a7df 100644 --- a/lib/business_system/home/overview/trade_summary.dart +++ b/lib/business_system/home/overview/trade_summary.dart @@ -1,11 +1,13 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.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 '../../date_select/monthly_report_page.dart'; import '../home_view/donut_auto_label_chart.dart'; import '../home_view/my_line_chart.dart'; import 'package:charts_flutter/flutter.dart' as charts; @@ -22,6 +24,7 @@ class _TradeSummary extends State { final ScrollController scrollController = ScrollController(); int operateSelect = 0; int expensesSelect = 0; + int dateIndex = 0; List lineChartSample2DataAmount = [LineChartSample2Data(0,40,"2023-03-09"), LineChartSample2Data(1,10,"2023-03-10"), @@ -97,27 +100,41 @@ class _TradeSummary extends State { top: 16.h, right: 20.w, left: 20.w, bottom: 12.h), child: Row( children: [ - Expanded(child: Container( - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2), - color: Color(0xFF30415B), - ), - padding: EdgeInsets.symmetric(vertical: 9.h), - child: Text( - "日报", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white, + Expanded(child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + setState((){ + dateIndex = 0; + }); + }, + child: Container( + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + color: dateIndex == 0 ? Color(0xFF30415B):Colors.transparent, + ), + padding: EdgeInsets.symmetric(vertical: 9.h), + child: Text( + "日报", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: dateIndex == 0 ? Colors.white:Color(0xFF30415B), + ), ), ), - ),), - Expanded(child: Container( + )), + Expanded(child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + setState((){ + dateIndex = 1; + });}, + child: Container( alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(2), - // color: Color(0xFF30415B), + color: dateIndex == 1 ? Color(0xFF30415B):Colors.transparent, ), padding: EdgeInsets.symmetric(vertical: 9.h), child: Text( @@ -125,15 +142,22 @@ class _TradeSummary extends State { style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.medium, - color: Color(0xFF30415B), + color: dateIndex == 1 ? Colors.white:Color(0xFF30415B), ), ), - ),), - Expanded(child: Container( + ),)), + Expanded(child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + setState((){ + dateIndex = 2; + }); + }, + child: Container( alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(2), - // color: Color(0xFF30415B), + color: dateIndex == 2 ? Color(0xFF30415B):Colors.transparent, ), padding: EdgeInsets.symmetric(vertical: 9.h), child: Text( @@ -141,15 +165,22 @@ class _TradeSummary extends State { style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.medium, - color: Color(0xFF30415B), + color: dateIndex == 2 ? Colors.white:Color(0xFF30415B), ), ), - ),), - Expanded(child: Container( + ),)), + Expanded(child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + setState((){ + dateIndex = 3; + }); + }, + child: Container( alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(2), - // color: Color(0xFF30415B), + color: dateIndex == 3 ? Color(0xFF30415B):Colors.transparent, ), padding: EdgeInsets.symmetric(vertical: 9.h), child: Text( @@ -157,40 +188,57 @@ class _TradeSummary extends State { style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.medium, - color: Color(0xFF30415B), + color: dateIndex == 3 ? Colors.white:Color(0xFF30415B), ), ), - ),), + ),)), ], ), ), Align(alignment: Alignment.center, - child: Container( - width: 154.w, - alignment: Alignment.center, - padding: EdgeInsets.all(8), - decoration: BoxDecoration( - color: Color(0xFFF6F6F6), - borderRadius: BorderRadius.circular(2), - ), - margin: EdgeInsets.only(bottom:16.h), - child: Row( - children: [ - Padding(padding: EdgeInsets.only(right: 20.w), - child: Text( - "2023年06月01日(今日)", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.regular, - color: Colors.black, - ), - ),), - Image.asset( - "assets/image/bs_calendar_logo.webp", - width:15, - height:15, - ), - ], + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + if(dateIndex == 0){ + Navigator.of(context).pushNamed('/router/day_report_page'); + } + else if(dateIndex == 1){ + Navigator.of(context).pushNamed('/router/week_report_page'); + } + else if(dateIndex == 2){ + Navigator.of(context).pushNamed('/router/monthly_report_page'); + } + else if(dateIndex == 3){ + Navigator.of(context).pushNamed('/router/monthly_report_page'); + } + }, + child: Container( + width: 154.w, + alignment: Alignment.center, + padding: EdgeInsets.all(8), + decoration: BoxDecoration( + color: Color(0xFFF6F6F6), + borderRadius: BorderRadius.circular(2), + ), + margin: EdgeInsets.only(bottom:16.h), + child: Row( + children: [ + Padding(padding: EdgeInsets.only(right: 20.w), + child: Text( + "2023年06月01日(今日)", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, + ), + ),), + Image.asset( + "assets/image/bs_calendar_logo.webp", + width:15, + height:15, + ), + ], + ), ), ),), Padding(padding:EdgeInsets.only(left:16.w,bottom:15.h), @@ -446,4 +494,18 @@ class _TradeSummary extends State { ), ); } + + showAlertDialog() { + showCupertinoModalPopup( + context: context, + builder: (context) { + return MaterialApp( + title: 'CalendarDatePicker2 Demo', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + localizationsDelegates: GlobalMaterialLocalizations.delegates, + home: MonthlyReportPage(), + );},); + } } diff --git a/lib/business_system/order/business_order_page.dart b/lib/business_system/order/business_order_page.dart index ba1939c3..6c403f0f 100644 --- a/lib/business_system/order/business_order_page.dart +++ b/lib/business_system/order/business_order_page.dart @@ -137,7 +137,7 @@ class _BusinessOrderPage extends State color: Colors.white, child: Container( height: 40.h, - margin: EdgeInsets.only(left: 18.w,right: 18.w,top:40.h,), + margin: EdgeInsets.only(left: 18.w,right: 18.w,top:55.h,), decoration: BoxDecoration( color: Color(0xFFF7F8FA), borderRadius: BorderRadius.circular(2), diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index 2e7d8051..bf5754cd 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -544,6 +544,9 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { if(homeRank != null && homeRank.commodityZone.length != 0) HomeRecommendGoods(homeRank), + if((homeRank?.commodityZone?.length ??0) == 0) + SizedBox(height: 20.h,), + ///助农专区 // if(mRaiseMoney != 0) HappyHelpFarmers(), diff --git a/lib/main.dart b/lib/main.dart index f1a6faae..ae703533 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -85,6 +85,9 @@ import 'package:huixiang/web/web_turntable_activity.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'business_system/business_page.dart'; +import 'business_system/date_select/day_report_page.dart'; +import 'business_system/date_select/monthly_report_page.dart'; +import 'business_system/date_select/week_report_page.dart'; import 'business_system/goods/goods_search_page.dart'; import 'business_system/goods/on_sale/add_assort.dart'; import 'business_system/goods/on_sale/batch_shelf.dart'; @@ -492,4 +495,10 @@ Map routers = { AccountInformation(), '/router/request_refund': (context, {arguments}) => RequestRefund(), + '/router/day_report_page': (context, {arguments}) => + DayReportPage(), + '/router/week_report_page': (context, {arguments}) => + WeekReportPage(), + '/router/monthly_report_page': (context, {arguments}) => + MonthlyReportPage(), }; diff --git a/pubspec.lock b/pubspec.lock index 7a64c269..1ac499f2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -781,14 +781,14 @@ packages: name: syncfusion_flutter_core url: "https://pub.flutter-io.cn" source: hosted - version: "21.2.10" + version: "19.4.56" syncfusion_flutter_datepicker: dependency: "direct main" description: name: syncfusion_flutter_datepicker url: "https://pub.flutter-io.cn" source: hosted - version: "21.2.3" + version: "19.4.56" table_calendar: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 643db6b4..8899ea71 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -113,7 +113,7 @@ dependencies: # 时间选择器 flutter_datetime_picker: ^1.5.1 - syncfusion_flutter_datepicker: ^21.2.3 + syncfusion_flutter_datepicker: ^19.2.44 dev_dependencies: