Browse Source

时间选择器更改

wr_2023_business
wurong 2 years ago
parent
commit
4440c71973
  1. 6
      lib/business_system/business_page.dart
  2. 91
      lib/business_system/date_select/day_report_page.dart
  3. 86
      lib/business_system/date_select/monthly_report_page.dart
  4. 87
      lib/business_system/date_select/week_report_page.dart
  5. 4
      lib/business_system/goods/goods_search_page.dart
  6. 2
      lib/business_system/home/business_home_page.dart
  7. 166
      lib/business_system/home/overview/trade_summary.dart
  8. 2
      lib/business_system/order/business_order_page.dart
  9. 3
      lib/home/home_page.dart
  10. 9
      lib/main.dart
  11. 4
      pubspec.lock
  12. 2
      pubspec.yaml

6
lib/business_system/business_page.dart

@ -22,7 +22,6 @@ class BusinessPage extends StatefulWidget {
class _BusinessPage extends State<BusinessPage> class _BusinessPage extends State<BusinessPage>
with AutomaticKeepAliveClientMixin { with AutomaticKeepAliveClientMixin {
int choiceIndex = 0; int choiceIndex = 0;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -56,9 +55,10 @@ class _BusinessPage extends State<BusinessPage>
Align( Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: Container( child: Container(
height:95.h, height:85.h,
width: double.infinity, width: double.infinity,
padding: EdgeInsets.only(top: 30.h), color: Colors.white,
padding: EdgeInsets.only(top:20.h),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,

91
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<StatefulWidget> createState() {
return _DayReportPage();
}
}
class _DayReportPage extends State<DayReportPage>{
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<DateTime>) {
_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: <Widget>[
Positioned(
left: 0,
right: 0,
top: 0,
height: 80,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
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))),
),
)
],
));
}
}

86
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<StatefulWidget> createState() {
return _MonthlyReportPage();
}
}
class _MonthlyReportPage extends State<MonthlyReportPage>{
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<DateTime>) {
_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: <Widget>[
Positioned(
left: 0,
right: 0,
top: 0,
height: 80,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
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))),
),
)
],
));
}
}

87
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<StatefulWidget> createState() {
return _WeekReportPage();
}
}
class _WeekReportPage extends State<WeekReportPage>{
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<DateTime>) {
_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: <Widget>[
Positioned(
left: 0,
right: 0,
top: 0,
height: 80,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
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))),
),
)
],
));
}
}

4
lib/business_system/goods/goods_search_page.dart

@ -92,7 +92,6 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
child: Container( child: Container(
height: 40.h, height: 40.h,
margin: EdgeInsets.only(left: 18.w,right: 18.w,top:17.h,bottom: 10.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( decoration: BoxDecoration(
color: Color(0xFFF7F8FA), color: Color(0xFFF7F8FA),
borderRadius: BorderRadius.circular(2), borderRadius: BorderRadius.circular(2),
@ -116,9 +115,6 @@ class _GoodsSearchPage extends State<GoodsSearchPage>
fontSize: 15.sp, fontSize: 15.sp,
fontWeight: MyFontWeight.regular fontWeight: MyFontWeight.regular
), ),
contentPadding: EdgeInsets.symmetric(
vertical: 12.h,
),
prefixIcon: Image.asset( prefixIcon: Image.asset(
"assets/image/bs_goods_search.webp", "assets/image/bs_goods_search.webp",
width: 20, width: 20,

2
lib/business_system/home/business_home_page.dart

@ -683,7 +683,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
Widget todayFlow(){ Widget todayFlow(){
return Container( return Container(
color: Colors.white, 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), padding: EdgeInsets.only(left: 16.w, right:21.w, top: 12.h, bottom: 16.h),
child:Column( child:Column(
children: [ children: [

166
lib/business_system/home/overview/trade_summary.dart

@ -1,11 +1,13 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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/classic_header.dart';
import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../../utils/font_weight.dart'; import '../../../utils/font_weight.dart';
import '../../date_select/monthly_report_page.dart';
import '../home_view/donut_auto_label_chart.dart'; import '../home_view/donut_auto_label_chart.dart';
import '../home_view/my_line_chart.dart'; import '../home_view/my_line_chart.dart';
import 'package:charts_flutter/flutter.dart' as charts; import 'package:charts_flutter/flutter.dart' as charts;
@ -22,6 +24,7 @@ class _TradeSummary extends State<TradeSummary> {
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();
int operateSelect = 0; int operateSelect = 0;
int expensesSelect = 0; int expensesSelect = 0;
int dateIndex = 0;
List<LineChartSample2Data> lineChartSample2DataAmount = List<LineChartSample2Data> lineChartSample2DataAmount =
[LineChartSample2Data(0,40,"2023-03-09"), [LineChartSample2Data(0,40,"2023-03-09"),
LineChartSample2Data(1,10,"2023-03-10"), LineChartSample2Data(1,10,"2023-03-10"),
@ -97,27 +100,41 @@ class _TradeSummary extends State<TradeSummary> {
top: 16.h, right: 20.w, left: 20.w, bottom: 12.h), top: 16.h, right: 20.w, left: 20.w, bottom: 12.h),
child: Row( child: Row(
children: [ children: [
Expanded(child: Container( Expanded(child: GestureDetector(
alignment: Alignment.center, behavior: HitTestBehavior.opaque,
decoration: BoxDecoration( onTap: (){
borderRadius: BorderRadius.circular(2), setState((){
color: Color(0xFF30415B), dateIndex = 0;
), });
padding: EdgeInsets.symmetric(vertical: 9.h), },
child: Text( child: Container(
"日报", alignment: Alignment.center,
style: TextStyle( decoration: BoxDecoration(
fontSize: 12.sp, borderRadius: BorderRadius.circular(2),
fontWeight: MyFontWeight.medium, color: dateIndex == 0 ? Color(0xFF30415B):Colors.transparent,
color: Colors.white, ),
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, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2), borderRadius: BorderRadius.circular(2),
// color: Color(0xFF30415B), color: dateIndex == 1 ? Color(0xFF30415B):Colors.transparent,
), ),
padding: EdgeInsets.symmetric(vertical: 9.h), padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text( child: Text(
@ -125,15 +142,22 @@ class _TradeSummary extends State<TradeSummary> {
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.medium, 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, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2), borderRadius: BorderRadius.circular(2),
// color: Color(0xFF30415B), color: dateIndex == 2 ? Color(0xFF30415B):Colors.transparent,
), ),
padding: EdgeInsets.symmetric(vertical: 9.h), padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text( child: Text(
@ -141,15 +165,22 @@ class _TradeSummary extends State<TradeSummary> {
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.medium, 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, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2), borderRadius: BorderRadius.circular(2),
// color: Color(0xFF30415B), color: dateIndex == 3 ? Color(0xFF30415B):Colors.transparent,
), ),
padding: EdgeInsets.symmetric(vertical: 9.h), padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text( child: Text(
@ -157,40 +188,57 @@ class _TradeSummary extends State<TradeSummary> {
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B), color: dateIndex == 3 ? Colors.white:Color(0xFF30415B),
), ),
), ),
),), ),)),
], ],
), ),
), ),
Align(alignment: Alignment.center, Align(alignment: Alignment.center,
child: Container( child: GestureDetector(
width: 154.w, behavior: HitTestBehavior.opaque,
alignment: Alignment.center, onTap: (){
padding: EdgeInsets.all(8), if(dateIndex == 0){
decoration: BoxDecoration( Navigator.of(context).pushNamed('/router/day_report_page');
color: Color(0xFFF6F6F6), }
borderRadius: BorderRadius.circular(2), else if(dateIndex == 1){
), Navigator.of(context).pushNamed('/router/week_report_page');
margin: EdgeInsets.only(bottom:16.h), }
child: Row( else if(dateIndex == 2){
children: [ Navigator.of(context).pushNamed('/router/monthly_report_page');
Padding(padding: EdgeInsets.only(right: 20.w), }
child: Text( else if(dateIndex == 3){
"2023年06月01日(今日)", Navigator.of(context).pushNamed('/router/monthly_report_page');
style: TextStyle( }
fontSize: 10.sp, },
fontWeight: MyFontWeight.regular, child: Container(
color: Colors.black, width: 154.w,
), alignment: Alignment.center,
),), padding: EdgeInsets.all(8),
Image.asset( decoration: BoxDecoration(
"assets/image/bs_calendar_logo.webp", color: Color(0xFFF6F6F6),
width:15, borderRadius: BorderRadius.circular(2),
height:15, ),
), 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), Padding(padding:EdgeInsets.only(left:16.w,bottom:15.h),
@ -446,4 +494,18 @@ class _TradeSummary extends State<TradeSummary> {
), ),
); );
} }
showAlertDialog() {
showCupertinoModalPopup(
context: context,
builder: (context) {
return MaterialApp(
title: 'CalendarDatePicker2 Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
localizationsDelegates: GlobalMaterialLocalizations.delegates,
home: MonthlyReportPage(),
);},);
}
} }

2
lib/business_system/order/business_order_page.dart

@ -137,7 +137,7 @@ class _BusinessOrderPage extends State<BusinessOrderPage>
color: Colors.white, color: Colors.white,
child: Container( child: Container(
height: 40.h, 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( decoration: BoxDecoration(
color: Color(0xFFF7F8FA), color: Color(0xFFF7F8FA),
borderRadius: BorderRadius.circular(2), borderRadius: BorderRadius.circular(2),

3
lib/home/home_page.dart

@ -544,6 +544,9 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
if(homeRank != null && homeRank.commodityZone.length != 0) if(homeRank != null && homeRank.commodityZone.length != 0)
HomeRecommendGoods(homeRank), HomeRecommendGoods(homeRank),
if((homeRank?.commodityZone?.length ??0) == 0)
SizedBox(height: 20.h,),
/// ///
// if(mRaiseMoney != 0) // if(mRaiseMoney != 0)
HappyHelpFarmers(), HappyHelpFarmers(),

9
lib/main.dart

@ -85,6 +85,9 @@ import 'package:huixiang/web/web_turntable_activity.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'business_system/business_page.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/goods_search_page.dart';
import 'business_system/goods/on_sale/add_assort.dart'; import 'business_system/goods/on_sale/add_assort.dart';
import 'business_system/goods/on_sale/batch_shelf.dart'; import 'business_system/goods/on_sale/batch_shelf.dart';
@ -492,4 +495,10 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
AccountInformation(), AccountInformation(),
'/router/request_refund': (context, {arguments}) => '/router/request_refund': (context, {arguments}) =>
RequestRefund(), RequestRefund(),
'/router/day_report_page': (context, {arguments}) =>
DayReportPage(),
'/router/week_report_page': (context, {arguments}) =>
WeekReportPage(),
'/router/monthly_report_page': (context, {arguments}) =>
MonthlyReportPage(),
}; };

4
pubspec.lock

@ -781,14 +781,14 @@ packages:
name: syncfusion_flutter_core name: syncfusion_flutter_core
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "21.2.10" version: "19.4.56"
syncfusion_flutter_datepicker: syncfusion_flutter_datepicker:
dependency: "direct main" dependency: "direct main"
description: description:
name: syncfusion_flutter_datepicker name: syncfusion_flutter_datepicker
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "21.2.3" version: "19.4.56"
table_calendar: table_calendar:
dependency: "direct main" dependency: "direct main"
description: description:

2
pubspec.yaml

@ -113,7 +113,7 @@ dependencies:
# 时间选择器 # 时间选择器
flutter_datetime_picker: ^1.5.1 flutter_datetime_picker: ^1.5.1
syncfusion_flutter_datepicker: ^21.2.3 syncfusion_flutter_datepicker: ^19.2.44
dev_dependencies: dev_dependencies:

Loading…
Cancel
Save