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
beb86d2c
Commit
beb86d2c
authored
Dec 18, 2019
by
Michael Goderbauer
Committed by
Flutter GitHub Bot
Dec 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Simplify Chip slightly (#47254)" (#47353)
parent
b2323889
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
11 deletions
+20
-11
chip.dart
packages/flutter/lib/src/material/chip.dart
+4
-1
chip_test.dart
packages/flutter/test/material/chip_test.dart
+14
-8
chip_theme_test.dart
packages/flutter/test/material/chip_theme_test.dart
+2
-2
No files found.
packages/flutter/lib/src/material/chip.dart
View file @
beb86d2c
...
...
@@ -1851,7 +1851,10 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
animation:
Listenable
.
merge
(<
Listenable
>[
selectController
,
enableController
]),
builder:
(
BuildContext
context
,
Widget
child
)
{
return
Container
(
color:
getBackgroundColor
(
chipTheme
),
decoration:
ShapeDecoration
(
shape:
shape
,
color:
getBackgroundColor
(
chipTheme
),
),
child:
child
,
);
},
...
...
packages/flutter/test/material/chip_test.dart
View file @
beb86d2c
...
...
@@ -178,7 +178,13 @@ Future<void> _pumpCheckmarkChip(
void
_expectCheckmarkColor
(
Finder
finder
,
Color
color
)
{
expect
(
finder
,
paints
..
path
(
color:
color
)
paints
// The first path that is painted is the selection overlay. We do not care
// how it is painted but it has to be added it to this pattern so that the
// check mark can be checked next.
..
path
()
// The second path that is painted is the check mark.
..
path
(
color:
color
),
);
}
...
...
@@ -1429,7 +1435,7 @@ void main() {
),
);
expect
(
materialBox
,
paints
..
rect
(
color:
chipTheme
.
disabledColor
));
expect
(
materialBox
,
paints
..
path
(
color:
chipTheme
.
disabledColor
));
});
testWidgets
(
'Chip size is configurable by ThemeData.materialTapTargetSize'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -1529,13 +1535,13 @@ void main() {
DefaultTextStyle
labelStyle
=
getLabelStyle
(
tester
);
// Check default theme for enabled widget.
expect
(
materialBox
,
paints
..
rect
(
color:
defaultChipTheme
.
backgroundColor
));
expect
(
materialBox
,
paints
..
path
(
color:
defaultChipTheme
.
backgroundColor
));
expect
(
iconData
.
color
,
equals
(
const
Color
(
0xde000000
)));
expect
(
labelStyle
.
style
.
color
,
equals
(
Colors
.
black
.
withAlpha
(
0xde
)));
await
tester
.
tap
(
find
.
byType
(
RawChip
));
await
tester
.
pumpAndSettle
();
materialBox
=
getMaterialBox
(
tester
);
expect
(
materialBox
,
paints
..
rect
(
color:
defaultChipTheme
.
selectedColor
));
expect
(
materialBox
,
paints
..
path
(
color:
defaultChipTheme
.
selectedColor
));
await
tester
.
tap
(
find
.
byType
(
RawChip
));
await
tester
.
pumpAndSettle
();
...
...
@@ -1544,7 +1550,7 @@ void main() {
await
tester
.
pumpAndSettle
();
materialBox
=
getMaterialBox
(
tester
);
labelStyle
=
getLabelStyle
(
tester
);
expect
(
materialBox
,
paints
..
rect
(
color:
defaultChipTheme
.
disabledColor
));
expect
(
materialBox
,
paints
..
path
(
color:
defaultChipTheme
.
disabledColor
));
expect
(
labelStyle
.
style
.
color
,
equals
(
Colors
.
black
.
withAlpha
(
0xde
)));
// Apply a custom theme.
...
...
@@ -1566,13 +1572,13 @@ void main() {
labelStyle
=
getLabelStyle
(
tester
);
// Check custom theme for enabled widget.
expect
(
materialBox
,
paints
..
rect
(
color:
customTheme
.
backgroundColor
));
expect
(
materialBox
,
paints
..
path
(
color:
customTheme
.
backgroundColor
));
expect
(
iconData
.
color
,
equals
(
customTheme
.
deleteIconColor
));
expect
(
labelStyle
.
style
.
color
,
equals
(
Colors
.
black
.
withAlpha
(
0xde
)));
await
tester
.
tap
(
find
.
byType
(
RawChip
));
await
tester
.
pumpAndSettle
();
materialBox
=
getMaterialBox
(
tester
);
expect
(
materialBox
,
paints
..
rect
(
color:
customTheme
.
selectedColor
));
expect
(
materialBox
,
paints
..
path
(
color:
customTheme
.
selectedColor
));
await
tester
.
tap
(
find
.
byType
(
RawChip
));
await
tester
.
pumpAndSettle
();
...
...
@@ -1586,7 +1592,7 @@ void main() {
await
tester
.
pumpAndSettle
();
materialBox
=
getMaterialBox
(
tester
);
labelStyle
=
getLabelStyle
(
tester
);
expect
(
materialBox
,
paints
..
rect
(
color:
customTheme
.
disabledColor
));
expect
(
materialBox
,
paints
..
path
(
color:
customTheme
.
disabledColor
));
expect
(
labelStyle
.
style
.
color
,
equals
(
Colors
.
black
.
withAlpha
(
0xde
)));
});
...
...
packages/flutter/test/material/chip_theme_test.dart
View file @
beb86d2c
...
...
@@ -107,7 +107,7 @@ void main() {
final
RenderBox
materialBox
=
getMaterialBox
(
tester
);
expect
(
materialBox
,
paints
..
rect
(
color:
chipTheme
.
backgroundColor
));
expect
(
materialBox
,
paints
..
path
(
color:
chipTheme
.
backgroundColor
));
});
testWidgets
(
'Chip overrides ThemeData theme if ChipTheme present'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -161,7 +161,7 @@ void main() {
final
RenderBox
materialBox
=
getMaterialBox
(
tester
);
final
Material
material
=
getMaterial
(
tester
);
expect
(
materialBox
,
paints
..
rect
(
color:
Color
(
customTheme
.
backgroundColor
.
value
)));
expect
(
materialBox
,
paints
..
path
(
color:
Color
(
customTheme
.
backgroundColor
.
value
)));
expect
(
material
.
elevation
,
customTheme
.
elevation
);
expect
(
material
.
shadowColor
,
customTheme
.
shadowColor
);
},
skip:
isBrowser
);
...
...
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