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