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
56716f61
Unverified
Commit
56716f61
authored
Dec 09, 2020
by
David Martos
Committed by
GitHub
Dec 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chip theme label style is merged with the provided label style (#70687)
parent
d553aa06
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
chip.dart
packages/flutter/lib/src/material/chip.dart
+1
-1
chip_test.dart
packages/flutter/test/material/chip_test.dart
+26
-0
No files found.
packages/flutter/lib/src/material/chip.dart
View file @
56716f61
...
...
@@ -1929,7 +1929,7 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
final
Color
?
checkmarkColor
=
widget
.
checkmarkColor
??
chipTheme
.
checkmarkColor
;
final
bool
showCheckmark
=
widget
.
showCheckmark
??
chipTheme
.
showCheckmark
??
true
;
final
TextStyle
effectiveLabelStyle
=
widget
.
labelStyle
??
chipTheme
.
labelStyle
;
final
TextStyle
effectiveLabelStyle
=
chipTheme
.
labelStyle
.
merge
(
widget
.
labelStyle
)
;
final
Color
?
resolvedLabelColor
=
MaterialStateProperty
.
resolveAs
<
Color
?>(
effectiveLabelStyle
.
color
,
_states
);
final
TextStyle
resolvedLabelStyle
=
effectiveLabelStyle
.
copyWith
(
color:
resolvedLabelColor
);
final
EdgeInsetsGeometry
labelPadding
=
widget
.
labelPadding
??
chipTheme
.
labelPadding
??
_defaultLabelPadding
;
...
...
packages/flutter/test/material/chip_test.dart
View file @
56716f61
...
...
@@ -1440,6 +1440,32 @@ void main() {
expect
(
materialBox
,
paints
..
path
(
color:
chipTheme
.
disabledColor
));
});
testWidgets
(
'Chip merges ChipThemeData label style with the provided label style'
,
(
WidgetTester
tester
)
async
{
// The font family should be preserved even if the chip overrides some label style properties
final
ThemeData
theme
=
ThemeData
(
fontFamily:
'MyFont'
);
Widget
buildChip
()
{
return
_wrapForChip
(
textDirection:
TextDirection
.
ltr
,
child:
Theme
(
data:
theme
,
child:
const
Chip
(
label:
Text
(
'Label'
),
labelStyle:
TextStyle
(
fontWeight:
FontWeight
.
w200
),
),
),
);
}
await
tester
.
pumpWidget
(
buildChip
());
final
TextStyle
labelStyle
=
getLabelStyle
(
tester
).
style
;
expect
(
labelStyle
.
fontFamily
,
'MyFont'
);
expect
(
labelStyle
.
fontWeight
,
FontWeight
.
w200
);
});
testWidgets
(
'Chip size is configurable by ThemeData.materialTapTargetSize'
,
(
WidgetTester
tester
)
async
{
final
Key
key1
=
UniqueKey
();
await
tester
.
pumpWidget
(
...
...
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