Unverified Commit adb8b607 authored by Taha Tesser's avatar Taha Tesser Committed by GitHub

Fix `CupertinoTimerPicker` dark mode text color (#100311)

parent a3c6395c
......@@ -1974,6 +1974,7 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
TextStyle _textStyleFrom(BuildContext context, [double magnification = 1.0]) {
final TextStyle textStyle = CupertinoTheme.of(context).textTheme.pickerTextStyle;
return textStyle.copyWith(
color: CupertinoDynamicColor.maybeResolve(textStyle.color, context),
fontSize: textStyle.fontSize! * magnification,
);
}
......
......@@ -1543,6 +1543,33 @@ void main() {
// Text style should not return unresolved color.
expect(paragraph.text.style!.color.toString().contains('UNRESOLVED'), isFalse);
});
testWidgets('TimerPicker adapts to MaterialApp dark mode', (WidgetTester tester) async {
Widget _buildTimerPicker(Brightness brightness) {
return MaterialApp(
theme: ThemeData(brightness: brightness),
home: CupertinoTimerPicker(
mode: CupertinoTimerPickerMode.hm,
onTimerDurationChanged: (Duration newDuration) {},
initialTimerDuration: const Duration(hours: 12, minutes: 30, seconds: 59),
),
);
}
// CupertinoTimerPicker with light theme.
await tester.pumpWidget(_buildTimerPicker(Brightness.light));
RenderParagraph paragraph = tester.renderObject(find.text('hours'));
expect(paragraph.text.style!.color, CupertinoColors.label);
// Text style should not return unresolved color.
expect(paragraph.text.style!.color.toString().contains('UNRESOLVED'), isFalse);
// CupertinoTimerPicker with light theme.
await tester.pumpWidget(_buildTimerPicker(Brightness.dark));
paragraph = tester.renderObject(find.text('hours'));
expect(paragraph.text.style!.color, CupertinoColors.label);
// Text style should not return unresolved color.
expect(paragraph.text.style!.color.toString().contains('UNRESOLVED'), isFalse);
});
}
Widget _buildPicker({
......
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