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
f5865e5c
Unverified
Commit
f5865e5c
authored
May 02, 2022
by
Taha Tesser
Committed by
GitHub
May 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `CupertinoFormRow`dark mode text color (#100313)
Improved code
parent
07014d57
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
1 deletion
+46
-1
form_row.dart
packages/flutter/lib/src/cupertino/form_row.dart
+4
-1
form_row_test.dart
packages/flutter/test/cupertino/form_row_test.dart
+42
-0
No files found.
packages/flutter/lib/src/cupertino/form_row.dart
View file @
f5865e5c
...
...
@@ -148,7 +148,10 @@ class CupertinoFormRow extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
final
TextStyle
textStyle
=
CupertinoTheme
.
of
(
context
).
textTheme
.
textStyle
;
final
CupertinoThemeData
theme
=
CupertinoTheme
.
of
(
context
);
final
TextStyle
textStyle
=
theme
.
textTheme
.
textStyle
.
copyWith
(
color:
CupertinoDynamicColor
.
maybeResolve
(
theme
.
textTheme
.
textStyle
.
color
,
context
)
);
return
Padding
(
padding:
padding
??
_kDefaultPadding
,
...
...
packages/flutter/test/cupertino/form_row_test.dart
View file @
f5865e5c
...
...
@@ -3,6 +3,8 @@
// found in the LICENSE file.
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
...
...
@@ -163,4 +165,44 @@ void main() {
expect
(
errorTextStyle
.
style
.
color
,
CupertinoColors
.
destructiveRed
);
});
testWidgets
(
'CupertinoFormRow adapts to MaterialApp dark mode'
,
(
WidgetTester
tester
)
async
{
const
Widget
prefix
=
Text
(
'Prefix'
);
const
Widget
helper
=
Text
(
'Helper'
);
Widget
_buildFormRow
(
Brightness
brightness
)
{
return
MaterialApp
(
theme:
ThemeData
(
brightness:
brightness
),
home:
const
Center
(
child:
CupertinoFormRow
(
prefix:
prefix
,
helper:
helper
,
child:
CupertinoTextField
(),
),
),
);
}
// CupertinoFormRow with light theme.
await
tester
.
pumpWidget
(
_buildFormRow
(
Brightness
.
light
));
RenderParagraph
helperParagraph
=
tester
.
renderObject
(
find
.
text
(
'Helper'
));
expect
(
helperParagraph
.
text
.
style
!.
color
,
CupertinoColors
.
label
);
// Text style should not return unresolved color.
expect
(
helperParagraph
.
text
.
style
!.
color
.
toString
().
contains
(
'UNRESOLVED'
),
isFalse
);
RenderParagraph
prefixParagraph
=
tester
.
renderObject
(
find
.
text
(
'Prefix'
));
expect
(
prefixParagraph
.
text
.
style
!.
color
,
CupertinoColors
.
label
);
// Text style should not return unresolved color.
expect
(
prefixParagraph
.
text
.
style
!.
color
.
toString
().
contains
(
'UNRESOLVED'
),
isFalse
);
// CupertinoFormRow with light theme.
await
tester
.
pumpWidget
(
_buildFormRow
(
Brightness
.
dark
));
helperParagraph
=
tester
.
renderObject
(
find
.
text
(
'Helper'
));
expect
(
helperParagraph
.
text
.
style
!.
color
,
CupertinoColors
.
label
);
// Text style should not return unresolved color.
expect
(
helperParagraph
.
text
.
style
!.
color
.
toString
().
contains
(
'UNRESOLVED'
),
isFalse
);
prefixParagraph
=
tester
.
renderObject
(
find
.
text
(
'Prefix'
));
expect
(
prefixParagraph
.
text
.
style
!.
color
,
CupertinoColors
.
label
);
// Text style should not return unresolved color.
expect
(
prefixParagraph
.
text
.
style
!.
color
.
toString
().
contains
(
'UNRESOLVED'
),
isFalse
);
});
}
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