Unverified Commit 35af0d7b authored by YeungKC's avatar YeungKC Committed by GitHub

Fix dateAndTime and time modes of CupertinoDatePicker. (#73276)

parent d0e9959a
...@@ -719,6 +719,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> { ...@@ -719,6 +719,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
Text(dateText, style: _themeTextStyle(context)), Text(dateText, style: _themeTextStyle(context)),
); );
}, },
selectionOverlay: selectionOverlay,
), ),
); );
} }
...@@ -802,6 +803,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> { ...@@ -802,6 +803,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
); );
}), }),
looping: true, looping: true,
selectionOverlay: selectionOverlay,
) )
); );
} }
......
...@@ -1147,24 +1147,38 @@ void main() { ...@@ -1147,24 +1147,38 @@ void main() {
}); });
testWidgets('DatePicker golden tests', (WidgetTester tester) async { testWidgets('DatePicker golden tests', (WidgetTester tester) async {
await tester.pumpWidget( Widget _buildApp(CupertinoDatePickerMode mode) {
CupertinoApp( return CupertinoApp(
home: Center( home: Center(
child: SizedBox( child: SizedBox(
width: 500, width: 500,
height: 400, height: 400,
child: RepaintBoundary( child: RepaintBoundary(
child: CupertinoDatePicker( child: CupertinoDatePicker(
mode: CupertinoDatePickerMode.dateAndTime, key: ValueKey<CupertinoDatePickerMode>(mode),
initialDateTime: DateTime(2019, 1, 1, 4), mode: mode,
initialDateTime: DateTime(2019, 1, 1, 4, 12, 30),
onDateTimeChanged: (_) {}, onDateTimeChanged: (_) {},
), ),
), ),
), ),
), ),
), );
}
await tester.pumpWidget(_buildApp(CupertinoDatePickerMode.time));
await expectLater(
find.byType(CupertinoDatePicker),
matchesGoldenFile('date_picker_test.time.initial.png'),
);
await tester.pumpWidget(_buildApp(CupertinoDatePickerMode.date));
await expectLater(
find.byType(CupertinoDatePicker),
matchesGoldenFile('date_picker_test.date.initial.png'),
); );
await tester.pumpWidget(_buildApp(CupertinoDatePickerMode.dateAndTime));
await expectLater( await expectLater(
find.byType(CupertinoDatePicker), find.byType(CupertinoDatePicker),
matchesGoldenFile('date_picker_test.datetime.initial.png'), matchesGoldenFile('date_picker_test.datetime.initial.png'),
......
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