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
4019956f
Unverified
Commit
4019956f
authored
Nov 03, 2020
by
Ayush Bherwani
Committed by
GitHub
Nov 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ExpansionTile] adds collapsedBackgroundColor property (#69575)
parent
d618b810
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
expansion_tile.dart
packages/flutter/lib/src/material/expansion_tile.dart
+7
-1
expansion_tile_test.dart
packages/flutter/test/material/expansion_tile_test.dart
+36
-0
No files found.
packages/flutter/lib/src/material/expansion_tile.dart
View file @
4019956f
...
...
@@ -46,6 +46,7 @@ class ExpansionTile extends StatefulWidget {
this
.
expandedCrossAxisAlignment
,
this
.
expandedAlignment
,
this
.
childrenPadding
,
this
.
collapsedBackgroundColor
,
})
:
assert
(
initiallyExpanded
!=
null
),
assert
(
maintainState
!=
null
),
assert
(
...
...
@@ -85,6 +86,9 @@ class ExpansionTile extends StatefulWidget {
/// The color to display behind the sublist when expanded.
final
Color
?
backgroundColor
;
/// When not null, defines the background color of tile when the sublist is collapsed.
final
Color
?
collapsedBackgroundColor
;
/// A widget to display instead of a rotating arrow icon.
final
Widget
?
trailing
;
...
...
@@ -261,7 +265,9 @@ class _ExpansionTileState extends State<ExpansionTile> with SingleTickerProvider
_iconColorTween
..
begin
=
theme
.
unselectedWidgetColor
..
end
=
theme
.
accentColor
;
_backgroundColorTween
.
end
=
widget
.
backgroundColor
;
_backgroundColorTween
..
begin
=
widget
.
collapsedBackgroundColor
..
end
=
widget
.
backgroundColor
;
super
.
didChangeDependencies
();
}
...
...
packages/flutter/test/material/expansion_tile_test.dart
View file @
4019956f
...
...
@@ -481,4 +481,40 @@ void main() {
expect
(
columnRect
.
bottom
,
paddingRect
.
bottom
-
4
);
});
testWidgets
(
'ExpansionTile.collapsedBackgroundColor'
,
(
WidgetTester
tester
)
async
{
const
Key
expansionTileKey
=
Key
(
'expansionTileKey'
);
const
Color
backgroundColor
=
Colors
.
red
;
const
Color
collapsedBackgroundColor
=
Colors
.
brown
;
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Material
(
child:
ExpansionTile
(
key:
expansionTileKey
,
title:
Text
(
'Title'
),
backgroundColor:
backgroundColor
,
collapsedBackgroundColor:
collapsedBackgroundColor
,
children:
<
Widget
>[
SizedBox
(
height:
100
,
width:
100
),
],
),
),
));
BoxDecoration
boxDecoration
=
tester
.
firstWidget
<
Container
>(
find
.
descendant
(
of:
find
.
byKey
(
expansionTileKey
),
matching:
find
.
byType
(
Container
),
)).
decoration
!
as
BoxDecoration
;
expect
(
boxDecoration
.
color
,
collapsedBackgroundColor
);
await
tester
.
tap
(
find
.
text
(
'Title'
));
await
tester
.
pumpAndSettle
();
boxDecoration
=
tester
.
firstWidget
<
Container
>(
find
.
descendant
(
of:
find
.
byKey
(
expansionTileKey
),
matching:
find
.
byType
(
Container
),
)).
decoration
!
as
BoxDecoration
;
expect
(
boxDecoration
.
color
,
backgroundColor
);
});
}
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