mirror of
https://github.com/Iconica-Development/flutter_date_time_picker.git
synced 2025-05-18 10:23:50 +02:00
Merge pull request #29 from Iconica-Development/feature/month-change-callback
feature: added call back for whenever the user navigates to a differe…
This commit is contained in:
commit
e9ddc95993
4 changed files with 32 additions and 23 deletions
|
@ -1,3 +1,6 @@
|
|||
## 3.2.0
|
||||
- Added call back for whenever the user navigates to a different month
|
||||
|
||||
## 3.1.0
|
||||
- Add compatibility with flutter 3.10
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ packages:
|
|||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "3.1.1"
|
||||
version: "3.2.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
|
|
@ -59,27 +59,32 @@ class DateTimePicker extends StatefulWidget {
|
|||
final Widget Function(void Function()? onPressed)?
|
||||
onPreviousPageButtonBuilder;
|
||||
|
||||
const DateTimePicker(
|
||||
{super.key,
|
||||
this.child,
|
||||
required this.theme,
|
||||
this.weekdayTextStyle = const TextStyle(),
|
||||
this.onTapDay,
|
||||
this.highlightToday = true,
|
||||
this.alwaysUse24HourFormat = true,
|
||||
this.pickTime = false,
|
||||
this.initialDate,
|
||||
this.markedDates,
|
||||
this.disabledDates,
|
||||
this.disabledTimes,
|
||||
required this.size,
|
||||
this.buttonBuilder,
|
||||
this.closeOnSelectDate = false,
|
||||
this.showWeekDays = true,
|
||||
this.dateTimeConstraint = const DateTimeConstraint(),
|
||||
this.onNextPageButtonBuilder,
|
||||
this.onPreviousPageButtonBuilder});
|
||||
//final DateTime MonthChangeCallback = void Function(DateTime newMonth);
|
||||
final void Function(DateTime newMonth)? onMonthChanged;
|
||||
|
||||
const DateTimePicker({
|
||||
super.key,
|
||||
this.child,
|
||||
required this.theme,
|
||||
this.weekdayTextStyle = const TextStyle(),
|
||||
this.onTapDay,
|
||||
this.highlightToday = true,
|
||||
this.alwaysUse24HourFormat = true,
|
||||
this.pickTime = false,
|
||||
this.initialDate,
|
||||
this.markedDates,
|
||||
this.disabledDates,
|
||||
this.disabledTimes,
|
||||
required this.size,
|
||||
this.buttonBuilder,
|
||||
this.closeOnSelectDate = false,
|
||||
this.showWeekDays = true,
|
||||
this.dateTimeConstraint = const DateTimeConstraint(),
|
||||
this.onNextPageButtonBuilder,
|
||||
this.onPreviousPageButtonBuilder,
|
||||
this.onMonthChanged,
|
||||
});
|
||||
//final MonthChangeCallback? onMonthChanged;
|
||||
@override
|
||||
State<DateTimePicker> createState() => _DateTimePickerState();
|
||||
}
|
||||
|
@ -103,7 +108,6 @@ class _DateTimePickerState extends State<DateTimePicker> {
|
|||
browsingDate: widget.initialDate ?? DateTime.now(),
|
||||
selectedDate: widget.initialDate ?? DateTime.now(),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
|
@ -164,6 +168,7 @@ class _DateTimePickerState extends State<DateTimePicker> {
|
|||
_dateTimePickerController.browsingDate.month + 1,
|
||||
_dateTimePickerController.browsingDate.day,
|
||||
);
|
||||
widget.onMonthChanged?.call(_dateTimePickerController.browsingDate);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -175,6 +180,7 @@ class _DateTimePickerState extends State<DateTimePicker> {
|
|||
_dateTimePickerController.browsingDate.month - 1,
|
||||
_dateTimePickerController.browsingDate.day,
|
||||
);
|
||||
widget.onMonthChanged?.call(_dateTimePickerController.browsingDate);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: flutter_date_time_picker
|
||||
description: A Flutter package for date and time picker.
|
||||
version: 3.1.1
|
||||
version: 3.2.0
|
||||
homepage: https://iconica.nl/
|
||||
|
||||
environment:
|
||||
|
|
Loading…
Reference in a new issue