diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index 8cf8525..8e346f4 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -259,6 +259,24 @@ "packageUri": "lib/", "languageVersion": "3.1" }, + { + "name": "syncfusion_flutter_calendar", + "rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_calendar-28.2.4", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "syncfusion_flutter_core", + "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.4", + "packageUri": "lib/", + "languageVersion": "3.3" + }, { "name": "table_calendar", "rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/table_calendar-3.2.0", @@ -277,6 +295,12 @@ "packageUri": "lib/", "languageVersion": "3.4" }, + { + "name": "timezone", + "rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/timezone-0.10.0", + "packageUri": "lib/", + "languageVersion": "2.19" + }, { "name": "typed_data", "rootUri": "file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/typed_data-1.4.0", @@ -332,7 +356,7 @@ "languageVersion": "3.6" } ], - "generated": "2025-02-07T11:05:55.892643Z", + "generated": "2025-02-08T10:58:04.981413Z", "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 a9515de..3a19efa 100644 --- a/.dart_tool/package_config_subset +++ b/.dart_tool/package_config_subset @@ -154,6 +154,18 @@ string_scanner 3.1 file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/string_scanner-1.3.0/ file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/string_scanner-1.3.0/lib/ +syncfusion_flutter_calendar +3.3 +file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_calendar-28.2.4/ +file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_calendar-28.2.4/lib/ +syncfusion_flutter_core +3.3 +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.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/ @@ -166,6 +178,10 @@ test_api 3.4 file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/test_api-0.7.3/ file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/test_api-0.7.3/lib/ +timezone +2.19 +file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/timezone-0.10.0/ +file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/timezone-0.10.0/lib/ typed_data 3.5 file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/typed_data-1.4.0/ diff --git a/lib/components/styles/app_colors.dart b/lib/components/styles/app_colors.dart index 9c47f20..b78b8bf 100644 --- a/lib/components/styles/app_colors.dart +++ b/lib/components/styles/app_colors.dart @@ -11,4 +11,5 @@ static Color black = Color(0xff000000); static Color white = Color(0xffFFFFFF); static Color green = Color(0xff10A711); static Color red = Colors.red; +static Color calendarBack = Color(0xff00008B); } \ No newline at end of file diff --git a/lib/feature/presentation/screens/transporter/view/sub_views/invoice_management_screen.dart b/lib/feature/presentation/screens/transporter/view/sub_views/invoice_management_screen.dart index cdd2758..ea29dec 100644 --- a/lib/feature/presentation/screens/transporter/view/sub_views/invoice_management_screen.dart +++ b/lib/feature/presentation/screens/transporter/view/sub_views/invoice_management_screen.dart @@ -107,13 +107,13 @@ class _TransportViewState extends State { onTap: () { print("cdgsa"); ctrl.isSelected.value = !ctrl.isSelected.value; - // if (ctrl.isSelected.value == 0) { - // ctrl.toggleFilter(); - // } else if (ctrl.isSelected.value == 1) { - // ctrl.toggleViewFreight(); - // } else if (ctrl.isSelected.value == 2) { - // ctrl.togglePending(); - // } + if (ctrl.isSelected.value == 0) { + ctrl.toggleFilter(); + } else if (ctrl.isSelected.value == 1) { + ctrl.toggleViewFreight(); + } else if (ctrl.isSelected.value == 2) { + ctrl.togglePending(); + } }, child: Row( children: [ @@ -190,6 +190,7 @@ class _TransportViewState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ TextView(text: "Freight Bill Date",isRequired: true,), + SizedBox(height: 8), Container( height: 35, child: TextFormField( @@ -419,8 +420,8 @@ class _TransportViewState extends State { dataColumn("Freight Bill No."), //dataColumn(AppStrings.getInvoiceDate), dataColumn("Freight Bill date"), - dataColumn("Plant Code/Plant Desc."), - dataColumn("Material Code/Material Desc."), + dataColumn("Plant Code - Plant Desc."), + dataColumn("Material Code - Material Desc."), dataColumn("Freight Bill Amount"), dataColumn("GST Amount"), dataColumn("Status"), diff --git a/lib/feature/presentation/screens/transporter/view/sub_views/view_freight_bill.dart b/lib/feature/presentation/screens/transporter/view/sub_views/view_freight_bill.dart index 770e344..cf2c0ba 100644 --- a/lib/feature/presentation/screens/transporter/view/sub_views/view_freight_bill.dart +++ b/lib/feature/presentation/screens/transporter/view/sub_views/view_freight_bill.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:intl/intl.dart'; import 'package:shayog/components/common/common_btn.dart'; import 'package:shayog/feature/presentation/widgets/custom_pagination.dart'; import 'package:sizer/sizer.dart'; +import 'package:table_calendar/table_calendar.dart'; import 'package:vph_web_date_picker/vph_web_date_picker.dart'; import '../../../../../../../components/common/data_cell.dart'; import '../../../../../../../components/styles/app_colors.dart'; @@ -17,6 +19,11 @@ class ViewFreightBill extends StatelessWidget { final ScrollController horizontalScrollController = ScrollController(); final ScrollController verticalScrollController = ScrollController(); + final TextEditingController _dateController = TextEditingController(); + final ValueNotifier _selectedDate1 = + ValueNotifier(null); + final ValueNotifier _selectedDate2 = + ValueNotifier(null); final controller = Get.put(TransportController()); @override @@ -27,7 +34,7 @@ class ViewFreightBill extends StatelessWidget { children: [ Obx(() => controller.isFilterVisibleViewFreight.value ? Container( - padding: EdgeInsets.symmetric(vertical: 10,horizontal: 16), + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 16), color: AppColors.clrF2, child: Column( mainAxisAlignment: MainAxisAlignment.start, @@ -159,29 +166,11 @@ class ViewFreightBill extends StatelessWidget { margin: EdgeInsets.only(top: 8), height: 35, child: TextFormField( + controller: _dateController, + readOnly: true, 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; - } + _showCalendars(context); }, decoration: InputDecoration( fillColor: AppColors.clrD9, @@ -740,4 +729,95 @@ class ViewFreightBill extends StatelessWidget { }, ); } + + void _showCalendars(BuildContext context) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (context) { + return Padding( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded(child: CalendarWidget(isFirstCalendar: true, selectedDateNotifier: _selectedDate1)), + SizedBox(width: 20), + Expanded(child: CalendarWidget(isFirstCalendar: false, selectedDateNotifier: _selectedDate2)), + ], + ), + SizedBox(height: 10), + ValueListenableBuilder( + valueListenable: _selectedDate2, + builder: (context, DateTime? date2, child) { + return ElevatedButton( + onPressed: (_selectedDate1.value != null && date2 != null) + ? () { + _dateController.text = + "${DateFormat('dd/MM/yyyy').format(_selectedDate1.value!)} - ${DateFormat('dd/MM/yyyy').format(date2)}"; + Navigator.pop(context); + } + : null, + child: Text("Confirm"), + ); + }, + ), + ], + ), + ); + }, + ); + } +} + +class CalendarWidget extends StatelessWidget { + final bool isFirstCalendar; + final ValueNotifier selectedDateNotifier; + + CalendarWidget({required this.isFirstCalendar, required this.selectedDateNotifier}); + + @override + Widget build(BuildContext context) { + DateTime initialMonth = isFirstCalendar ? DateTime.now() : DateTime(DateTime.now().year, DateTime.now().month + 1, 1); + + return ValueListenableBuilder( + valueListenable: selectedDateNotifier, + builder: (context, DateTime? selectedDate, child) { + return TableCalendar( + firstDay: DateTime.utc(2000, 1, 1), + lastDay: DateTime.utc(2100, 12, 31), + focusedDay: initialMonth, + calendarFormat: CalendarFormat.month, + headerStyle: HeaderStyle( + formatButtonVisible: false, + titleCentered: true, + titleTextStyle: TextStyle(fontSize: 14), // Smaller title + ), + daysOfWeekStyle: DaysOfWeekStyle( + weekdayStyle: TextStyle(fontSize: 12), + weekendStyle: TextStyle(fontSize: 12), + ), + calendarStyle: CalendarStyle( + defaultTextStyle: TextStyle(fontSize: 12), // Smaller day numbers + weekendTextStyle: TextStyle(fontSize: 12, color: AppColors.white), + selectedTextStyle: TextStyle(fontSize: 14, fontWeight: FontWeight.bold), + selectedDecoration: BoxDecoration( + color: Colors.blueAccent, + shape: BoxShape.circle, + ), + weekendDecoration: BoxDecoration( + color: AppColors.calendarBack, // Blue background for Sundays + shape: BoxShape.circle, + ), + ), + selectedDayPredicate: (day) => day == selectedDate, + onDaySelected: (selectedDay, focusedDay) { + selectedDateNotifier.value = selectedDay; + }, + ); + }, + ); + } } diff --git a/pubspec.lock b/pubspec.lock index b9ff739..7f4b8e1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -333,6 +333,30 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.0" + syncfusion_flutter_calendar: + dependency: "direct main" + description: + name: syncfusion_flutter_calendar + sha256: "593427a43fe5022955b1938d8b7f61bb000602bf835211e8c3fb8a0e3e2c04e1" + url: "https://pub.dev" + source: hosted + version: "28.2.4" + syncfusion_flutter_core: + dependency: transitive + description: + name: syncfusion_flutter_core + sha256: "3c1876b0a245de23de3b17a19e3106fed57d88f4fd2c8dc9bc1976705b1c31d5" + url: "https://pub.dev" + source: hosted + version: "28.2.4" + syncfusion_flutter_datepicker: + dependency: transitive + description: + name: syncfusion_flutter_datepicker + sha256: "889b716d9de344852f651ecdcc726b6eeb9e326d95c1bb54df95631a5d7ead68" + url: "https://pub.dev" + source: hosted + version: "28.2.4" table_calendar: dependency: "direct main" description: @@ -357,6 +381,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.3" + timezone: + dependency: transitive + description: + name: timezone + sha256: ffc9d5f4d1193534ef051f9254063fa53d588609418c84299956c3db9383587d + url: "https://pub.dev" + source: hosted + version: "0.10.0" typed_data: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index f211b83..fefd010 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -42,6 +42,7 @@ dependencies: table_calendar: ^3.2.0 file_picker: ^8.3.1 path_provider: ^2.1.5 + syncfusion_flutter_calendar: ^28.2.4 dev_dependencies: