From 804a36482a905089d0863098ede1bbe88d62ae2c Mon Sep 17 00:00:00 2001 From: Ankit Sharma Date: Wed, 5 Feb 2025 13:31:34 +0530 Subject: [PATCH] calendar Implemented --- .dart_tool/package_config.json | 6 +- .dart_tool/package_config_subset | 8 +- .../view/sub_views/generate_fright_bill.dart | 81 +++++++++++++------ pubspec.lock | 8 +- pubspec.yaml | 3 +- 5 files changed, 71 insertions(+), 35 deletions(-) diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index b5cd36e..827610e 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -183,13 +183,13 @@ }, { "name": "syncfusion_flutter_core", - "rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_core-28.2.3", + "rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_core-28.2.4", "packageUri": "lib/", "languageVersion": "3.3" }, { "name": "syncfusion_flutter_datepicker", - "rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_datepicker-28.2.3", + "rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_datepicker-28.2.4", "packageUri": "lib/", "languageVersion": "3.3" }, @@ -254,7 +254,7 @@ "languageVersion": "3.6" } ], - "generated": "2025-02-04T11:31:00.239574Z", + "generated": "2025-02-05T07:53:21.908016Z", "generator": "pub", "generatorVersion": "3.6.1", "flutterRoot": "file:///C:/src/flutter/flutter", diff --git a/.dart_tool/package_config_subset b/.dart_tool/package_config_subset index e2854db..995cc4f 100644 --- a/.dart_tool/package_config_subset +++ b/.dart_tool/package_config_subset @@ -108,12 +108,12 @@ file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/string_scanner-1.3 file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/string_scanner-1.3.0/lib/ syncfusion_flutter_core 3.3 -file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_core-28.2.3/ -file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_core-28.2.3/lib/ +file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_core-28.2.4/ +file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_core-28.2.4/lib/ syncfusion_flutter_datepicker 3.3 -file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_datepicker-28.2.3/ -file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_datepicker-28.2.3/lib/ +file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_datepicker-28.2.4/ +file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_datepicker-28.2.4/lib/ table_calendar 3.0 file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/table_calendar-3.2.0/ diff --git a/lib/feature/presentation/screens/transporter/view/sub_views/generate_fright_bill.dart b/lib/feature/presentation/screens/transporter/view/sub_views/generate_fright_bill.dart index d0b77ff..42b7eb0 100644 --- a/lib/feature/presentation/screens/transporter/view/sub_views/generate_fright_bill.dart +++ b/lib/feature/presentation/screens/transporter/view/sub_views/generate_fright_bill.dart @@ -6,6 +6,7 @@ import 'package:shayog/components/styles/app_colors.dart'; import 'package:shayog/components/styles/textStyles.dart'; import 'package:shayog/feature/presentation/widgets/text_view.dart'; import 'package:sizer/sizer.dart'; +import 'package:syncfusion_flutter_datepicker/datepicker.dart'; import 'package:vph_web_date_picker/vph_web_date_picker.dart'; import '../../../../../../../components/common/common_btn.dart'; import '../../../../../../../components/common/custom_drop_down.dart'; @@ -171,7 +172,7 @@ class GenerateFrightBill extends StatelessWidget { ], ), Padding( - padding: const EdgeInsets.only(top: 16.0, left: 0, right: 8), + padding: const EdgeInsets.only(top: 0, left: 0, right: 8), child: Row( children: [ Expanded( @@ -180,32 +181,13 @@ class GenerateFrightBill extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ TextView(text: "MRN Date Range"), - Container( - margin: EdgeInsets.only(top: 8), height: 35, child: TextFormField( - key: controller.fromTextFieldKey, controller: controller.fromController, onTap: () async { - final pickedDate = await showWebDatePicker( - width: 20.w, - context: controller - .fromTextFieldKey.currentContext!, - initialDate: controller.fromSelectedDate, - firstDate: DateTime(2000), - lastDate: DateTime.now(), - ); - - if (pickedDate != null) { - controller.fromSelectedDate = pickedDate; - String formattedDate = - controller.getFormattedDate(pickedDate); - controller.fromController.text = - formattedDate; - controller.dateCheck.value = true; - } + await _showDateRangePicker(context); }, decoration: InputDecoration( fillColor: AppColors.clrD9, @@ -524,6 +506,59 @@ class GenerateFrightBill extends StatelessWidget { ], ); } - - + Future _showDateRangePicker(BuildContext context) async { + showModalBottomSheet( + context: context, + builder: (BuildContext context) { + return Container( + padding: EdgeInsets.all(16), + height: 400, // Adjust the height as needed + child: Column( + children: [ + // Display two date pickers horizontally + Row( + children: [ + // First Date Picker + Expanded( + child: SfDateRangePicker( + view: DateRangePickerView.month, + selectionMode: DateRangePickerSelectionMode.range, + onSelectionChanged: (args) { + // Handle the date selection from the first calendar + print(args.value); + }, + ), + ), + SizedBox(width: 16), + // Second Date Picker + Expanded( + child: SfDateRangePicker( + view: DateRangePickerView.month, + selectionMode: DateRangePickerSelectionMode.range, + onSelectionChanged: (args) { + // Handle the date selection from the second calendar + print(args.value); + }, + ), + ), + ], + ), + SizedBox(height: 16), + ElevatedButton( + onPressed: () { + // You can extract the selected date range here + // Close the bottom sheet after selection + Navigator.pop(context); + }, + child: Text('Done'), + ), + ], + ), + ); + }, + ); + } } + + + diff --git a/pubspec.lock b/pubspec.lock index 9221432..f3bd619 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -236,18 +236,18 @@ packages: dependency: transitive description: name: syncfusion_flutter_core - sha256: "213ada2c3b3555a73cb0eb1530d24d27dcf1a0a1555c0f00dd3e1486b01878ad" + sha256: "3c1876b0a245de23de3b17a19e3106fed57d88f4fd2c8dc9bc1976705b1c31d5" url: "https://pub.dev" source: hosted - version: "28.2.3" + version: "28.2.4" syncfusion_flutter_datepicker: dependency: "direct main" description: name: syncfusion_flutter_datepicker - sha256: "9d2694d618d081c9477402175ff027936f60ac053d0989ca02ee65b2e27a65c7" + sha256: "889b716d9de344852f651ecdcc726b6eeb9e326d95c1bb54df95631a5d7ead68" url: "https://pub.dev" source: hosted - version: "28.2.3" + version: "28.2.4" table_calendar: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 66768e2..3f9db28 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -41,7 +41,8 @@ dependencies: intl: ^0.20.1 vph_web_date_picker: ^0.0.6 table_calendar: ^3.2.0 - syncfusion_flutter_datepicker: ^28.2.3 + syncfusion_flutter_datepicker: ^28.2.4 + dev_dependencies: