Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
07014d57
Unverified
Commit
07014d57
authored
May 02, 2022
by
Taha Tesser
Committed by
GitHub
May 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `CupertinoDatePicker`dark mode text color (#100312)
Improved code
parent
111eb93c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletion
+31
-1
date_picker.dart
packages/flutter/lib/src/cupertino/date_picker.dart
+3
-1
date_picker_test.dart
packages/flutter/test/cupertino/date_picker_test.dart
+28
-0
No files found.
packages/flutter/lib/src/cupertino/date_picker.dart
View file @
07014d57
...
...
@@ -53,7 +53,9 @@ const double _kTimerPickerColumnIntrinsicWidth = 106;
TextStyle
_themeTextStyle
(
BuildContext
context
,
{
bool
isValid
=
true
})
{
final
TextStyle
style
=
CupertinoTheme
.
of
(
context
).
textTheme
.
dateTimePickerTextStyle
;
return
isValid
?
style
:
style
.
copyWith
(
color:
CupertinoDynamicColor
.
resolve
(
CupertinoColors
.
inactiveGray
,
context
));
return
isValid
?
style
.
copyWith
(
color:
CupertinoDynamicColor
.
maybeResolve
(
style
.
color
,
context
))
:
style
.
copyWith
(
color:
CupertinoDynamicColor
.
resolve
(
CupertinoColors
.
inactiveGray
,
context
));
}
void
_animateColumnControllerToItem
(
FixedExtentScrollController
controller
,
int
targetItem
)
{
...
...
packages/flutter/test/cupertino/date_picker_test.dart
View file @
07014d57
...
...
@@ -15,6 +15,7 @@
import
'dart:ui'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
@@ -1515,6 +1516,33 @@ void main() {
expect
(
lastSelectedItem
,
1
);
handle
.
dispose
();
});
testWidgets
(
'DatePicker adapts to MaterialApp dark mode'
,
(
WidgetTester
tester
)
async
{
Widget
_buildDatePicker
(
Brightness
brightness
)
{
return
MaterialApp
(
theme:
ThemeData
(
brightness:
brightness
),
home:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
date
,
onDateTimeChanged:
(
DateTime
neData
)
{},
initialDateTime:
DateTime
(
2018
,
10
,
10
),
),
);
}
// CupertinoDatePicker with light theme.
await
tester
.
pumpWidget
(
_buildDatePicker
(
Brightness
.
light
));
RenderParagraph
paragraph
=
tester
.
renderObject
(
find
.
text
(
'October'
).
first
);
expect
(
paragraph
.
text
.
style
!.
color
,
CupertinoColors
.
label
);
// Text style should not return unresolved color.
expect
(
paragraph
.
text
.
style
!.
color
.
toString
().
contains
(
'UNRESOLVED'
),
isFalse
);
// CupertinoDatePicker with dark theme.
await
tester
.
pumpWidget
(
_buildDatePicker
(
Brightness
.
dark
));
paragraph
=
tester
.
renderObject
(
find
.
text
(
'October'
).
first
);
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
(
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment