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. 94
      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>
with AutomaticKeepAliveClientMixin {
int choiceIndex = 0;
@override
void initState() {
super.initState();
@ -56,9 +55,10 @@ class _BusinessPage extends State<BusinessPage>
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,

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(
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<GoodsSearchPage>
fontSize: 15.sp,
fontWeight: MyFontWeight.regular
),
contentPadding: EdgeInsets.symmetric(
vertical: 12.h,
),
prefixIcon: Image.asset(
"assets/image/bs_goods_search.webp",
width: 20,

2
lib/business_system/home/business_home_page.dart

@ -683,7 +683,7 @@ class _BusinessHomePage extends State<BusinessHomePage>
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: [

94
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<TradeSummary> {
final ScrollController scrollController = ScrollController();
int operateSelect = 0;
int expensesSelect = 0;
int dateIndex = 0;
List<LineChartSample2Data> lineChartSample2DataAmount =
[LineChartSample2Data(0,40,"2023-03-09"),
LineChartSample2Data(1,10,"2023-03-10"),
@ -97,11 +100,18 @@ class _TradeSummary extends State<TradeSummary> {
top: 16.h, right: 20.w, left: 20.w, bottom: 12.h),
child: Row(
children: [
Expanded(child: Container(
Expanded(child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
setState((){
dateIndex = 0;
});
},
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: Color(0xFF30415B),
color: dateIndex == 0 ? Color(0xFF30415B):Colors.transparent,
),
padding: EdgeInsets.symmetric(vertical: 9.h),
child: Text(
@ -109,15 +119,22 @@ class _TradeSummary extends State<TradeSummary> {
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
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<TradeSummary> {
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<TradeSummary> {
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,14 +188,30 @@ class _TradeSummary extends State<TradeSummary> {
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF30415B),
color: dateIndex == 3 ? Colors.white:Color(0xFF30415B),
),
),
),),
),)),
],
),
),
Align(alignment: Alignment.center,
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,
@ -192,6 +239,7 @@ class _TradeSummary extends State<TradeSummary> {
),
],
),
),
),),
Padding(padding:EdgeInsets.only(left:16.w,bottom:15.h),
child:Text(
@ -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,
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),

3
lib/home/home_page.dart

@ -544,6 +544,9 @@ class HomePageState extends State<HomePage> 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(),

9
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<String, WidgetBuilder> routers = <String, WidgetBuilder>{
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(),
};

4
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:

2
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:

Loading…
Cancel
Save