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
37cb7b7b
Unverified
Commit
37cb7b7b
authored
Jun 17, 2020
by
Ayush Bherwani
Committed by
GitHub
Jun 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ExpansionPanelList] adds dividerColor property (#59641)
parent
fe15d1e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
1 deletion
+63
-1
expansion_panel.dart
packages/flutter/lib/src/material/expansion_panel.dart
+9
-0
expansion_panel_test.dart
packages/flutter/test/material/expansion_panel_test.dart
+54
-1
No files found.
packages/flutter/lib/src/material/expansion_panel.dart
View file @
37cb7b7b
...
...
@@ -230,6 +230,7 @@ class ExpansionPanelList extends StatefulWidget {
this
.
expansionCallback
,
this
.
animationDuration
=
kThemeAnimationDuration
,
this
.
expandedHeaderPadding
=
_kPanelHeaderExpandedDefaultPadding
,
this
.
dividerColor
,
})
:
assert
(
children
!=
null
),
assert
(
animationDuration
!=
null
),
_allowOnlyOnePanelOpen
=
false
,
...
...
@@ -319,6 +320,7 @@ class ExpansionPanelList extends StatefulWidget {
this
.
animationDuration
=
kThemeAnimationDuration
,
this
.
initialOpenPanelValue
,
this
.
expandedHeaderPadding
=
_kPanelHeaderExpandedDefaultPadding
,
this
.
dividerColor
,
})
:
assert
(
children
!=
null
),
assert
(
animationDuration
!=
null
),
_allowOnlyOnePanelOpen
=
true
,
...
...
@@ -363,6 +365,12 @@ class ExpansionPanelList extends StatefulWidget {
/// during expansion.
final
EdgeInsets
expandedHeaderPadding
;
/// Defines color for the divider when [ExpansionPanel.isExpanded] is false.
///
/// If `dividerColor` is null, then [DividerThemeData.color] is used. If that
/// is null, then [ThemeData.dividerColor] is used.
final
Color
dividerColor
;
@override
State
<
StatefulWidget
>
createState
()
=>
_ExpansionPanelListState
();
}
...
...
@@ -528,6 +536,7 @@ class _ExpansionPanelListState extends State<ExpansionPanelList> {
return
MergeableMaterial
(
hasDividers:
true
,
dividerColor:
widget
.
dividerColor
,
children:
items
,
);
}
...
...
packages/flutter/test/material/expansion_panel_test.dart
View file @
37cb7b7b
...
...
@@ -13,12 +13,14 @@ class SimpleExpansionPanelListTestWidget extends StatefulWidget {
this
.
firstPanelKey
,
this
.
secondPanelKey
,
this
.
canTapOnHeader
=
false
,
this
.
expandedHeaderPadding
this
.
expandedHeaderPadding
,
this
.
dividerColor
,
})
:
super
(
key:
key
);
final
Key
firstPanelKey
;
final
Key
secondPanelKey
;
final
bool
canTapOnHeader
;
final
Color
dividerColor
;
/// If null, the default [ExpansionPanelList]'s expanded header padding value is applied via [defaultExpandedHeaderPadding]
final
EdgeInsets
expandedHeaderPadding
;
...
...
@@ -45,6 +47,7 @@ class _SimpleExpansionPanelListTestWidgetState extends State<SimpleExpansionPane
extendedState
[
_index
]
=
!
extendedState
[
_index
];
});
},
dividerColor:
widget
.
dividerColor
,
children:
<
ExpansionPanel
>[
ExpansionPanel
(
headerBuilder:
(
BuildContext
context
,
bool
isExpanded
)
{
...
...
@@ -1343,4 +1346,54 @@ void main() {
expect
(
box
.
size
.
height
,
equals
(
128.0
));
// _kPanelHeaderCollapsedHeight + 80.0 (double padding)
expect
(
box
.
size
.
width
,
equals
(
736.0
));
});
testWidgets
(
'ExpansionPanelList respects dividerColor'
,
(
WidgetTester
tester
)
async
{
const
Color
dividerColor
=
Colors
.
red
;
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
SingleChildScrollView
(
child:
SimpleExpansionPanelListTestWidget
(
dividerColor:
dividerColor
,
),
),
));
final
DecoratedBox
decoratedBox
=
tester
.
widget
(
find
.
byType
(
DecoratedBox
).
last
);
final
BoxDecoration
decoration
=
decoratedBox
.
decoration
as
BoxDecoration
;
// For the last DecoratedBox, we will have a Border.top with the provided dividerColor.
expect
(
decoration
.
border
.
top
.
color
,
dividerColor
);
});
testWidgets
(
'ExpansionPanelList.radio respects DividerColor'
,
(
WidgetTester
tester
)
async
{
const
Color
dividerColor
=
Colors
.
red
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
SingleChildScrollView
(
child:
ExpansionPanelList
.
radio
(
dividerColor:
dividerColor
,
children:
<
ExpansionPanelRadio
>[
ExpansionPanelRadio
(
headerBuilder:
(
BuildContext
context
,
bool
isExpanded
)
{
return
Text
(
isExpanded
?
'B'
:
'A'
,
key:
const
Key
(
'firstKey'
));
},
body:
const
SizedBox
(
height:
100.0
),
value:
0
,
),
ExpansionPanelRadio
(
headerBuilder:
(
BuildContext
context
,
bool
isExpanded
)
{
return
Text
(
isExpanded
?
'D'
:
'C'
,
key:
const
Key
(
'secondKey'
));
},
body:
const
SizedBox
(
height:
100.0
),
value:
1
,
),
],
),
),
));
final
DecoratedBox
decoratedBox
=
tester
.
widget
(
find
.
byType
(
DecoratedBox
).
last
);
final
BoxDecoration
boxDecoration
=
decoratedBox
.
decoration
as
BoxDecoration
;
// For the last DecoratedBox, we will have a Border.top with the provided dividerColor.
expect
(
boxDecoration
.
border
.
top
.
color
,
dividerColor
);
});
}
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