Calendar Added

dev_ankit
Ankit Sharma 2025-02-08 16:28:28 +05:30
parent 597cedae0d
commit c54d5ec42d
7 changed files with 187 additions and 32 deletions

View File

@ -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",

View File

@ -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/

View File

@ -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);
}

View File

@ -107,13 +107,13 @@ class _TransportViewState extends State<InvoiceManagement> {
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<InvoiceManagement> {
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<InvoiceManagement> {
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"),

View File

@ -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<DateTime?> _selectedDate1 =
ValueNotifier<DateTime?>(null);
final ValueNotifier<DateTime?> _selectedDate2 =
ValueNotifier<DateTime?>(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<DateTime?> 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;
},
);
},
);
}
}

View File

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

View File

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