Unverified Commit 7b04435a authored by Hamdi Kahloun's avatar Hamdi Kahloun Committed by GitHub

Date Picker jumps back to initialDatePickerMode after day selection (#67926)

Date Picker jumps back to initialDatePickerMode after day selection.
parent 50a7da85
......@@ -163,6 +163,7 @@ class _CalendarDatePickerState extends State<CalendarDatePicker> {
@override
void initState() {
super.initState();
_mode = widget.initialCalendarMode;
_initWidgetState();
}
......@@ -190,7 +191,6 @@ class _CalendarDatePickerState extends State<CalendarDatePicker> {
}
void _initWidgetState() {
_mode = widget.initialCalendarMode;
_currentDisplayedMonthDate = DateTime(widget.initialDate.year, widget.initialDate.month);
_selectedDate = widget.initialDate;
}
......
......@@ -645,6 +645,21 @@ void main() {
);
});
});
testWidgets('Selecting date does not switch picker to year selection', (WidgetTester tester) async {
initialDate = DateTime(2020, DateTime.may, 10);
initialCalendarMode = DatePickerMode.year;
await prepareDatePicker(tester, (Future<DateTime> date) async {
await tester.pump();
await tester.tap(find.text('2017'));
await tester.pump();
expect(find.text('May 2017'), findsOneWidget);
await tester.tap(find.text('10'));
await tester.pump();
expect(find.text('May 2017'), findsOneWidget);
expect(find.text('2017'), findsNothing);
});
});
});
group('Input mode', () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment