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
7511d8c0
Unverified
Commit
7511d8c0
authored
Jan 03, 2020
by
LongCatIsLooong
Committed by
GitHub
Jan 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix MediaQuery override in CupertinoDatePicker (#48001)
parent
c924f499
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
7 deletions
+50
-7
date_picker.dart
packages/flutter/lib/src/cupertino/date_picker.dart
+5
-7
date_picker_test.dart
packages/flutter/test/cupertino/date_picker_test.dart
+45
-0
No files found.
packages/flutter/lib/src/cupertino/date_picker.dart
View file @
7511d8c0
...
...
@@ -777,7 +777,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
}
return
MediaQuery
(
data:
const
MediaQueryData
(
textScaleFactor:
1.0
),
data:
MediaQuery
.
of
(
context
).
copyWith
(
textScaleFactor:
1.0
),
child:
DefaultTextStyle
.
merge
(
style:
_kDefaultPickerTextStyle
,
child:
CustomMultiChildLayout
(
...
...
@@ -1145,7 +1145,7 @@ class _CupertinoDatePickerDateState extends State<CupertinoDatePicker> {
}
return
MediaQuery
(
data:
const
MediaQueryData
(
textScaleFactor:
1.0
),
data:
MediaQuery
.
of
(
context
).
copyWith
(
textScaleFactor:
1.0
),
child:
DefaultTextStyle
.
merge
(
style:
_kDefaultPickerTextStyle
,
child:
CustomMultiChildLayout
(
...
...
@@ -1669,11 +1669,9 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
}
final
CupertinoThemeData
themeData
=
CupertinoTheme
.
of
(
context
);
return
MediaQuery
(
data:
const
MediaQueryData
(
// The native iOS picker's text scaling is fixed, so we will also fix it
// as well in our picker.
textScaleFactor:
1.0
,
),
// The native iOS picker's text scaling is fixed, so we will also fix it
// as well in our picker.
data:
MediaQuery
.
of
(
context
).
copyWith
(
textScaleFactor:
1.0
),
child:
CupertinoTheme
(
data:
themeData
.
copyWith
(
textTheme:
themeData
.
textTheme
.
copyWith
(
...
...
packages/flutter/test/cupertino/date_picker_test.dart
View file @
7511d8c0
...
...
@@ -1187,6 +1187,51 @@ void main() {
handle
.
dispose
();
});
testWidgets
(
'CupertinoDataPicker does not provide invalid MediaQuery'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/47989.
Brightness
brightness
=
Brightness
.
light
;
StateSetter
setState
;
await
tester
.
pumpWidget
(
CupertinoApp
(
theme:
const
CupertinoThemeData
(
textTheme:
CupertinoTextThemeData
(
dateTimePickerTextStyle:
TextStyle
(
color:
CupertinoDynamicColor
.
withBrightness
(
color:
Color
(
0xFFFFFFFF
),
darkColor:
Color
(
0xFF000000
),
),
),
),
),
home:
StatefulBuilder
(
builder:
(
BuildContext
context
,
StateSetter
stateSetter
)
{
setState
=
stateSetter
;
return
MediaQuery
(
data:
MediaQuery
.
of
(
context
).
copyWith
(
platformBrightness:
brightness
),
child:
CupertinoDatePicker
(
initialDateTime:
DateTime
(
2019
),
mode:
CupertinoDatePickerMode
.
date
,
onDateTimeChanged:
(
DateTime
date
)
{},
),
);
}),
),
);
expect
(
tester
.
widget
<
Text
>(
find
.
text
(
'2019'
)).
style
.
color
,
isSameColorAs
(
const
Color
(
0xFFFFFFFF
)),
);
setState
(()
{
brightness
=
Brightness
.
dark
;
});
await
tester
.
pump
();
expect
(
tester
.
widget
<
Text
>(
find
.
text
(
'2019'
)).
style
.
color
,
isSameColorAs
(
const
Color
(
0xFF000000
)),
);
});
testWidgets
(
'picker exports semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
debugResetSemanticsIdCounter
();
...
...
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