Make expansion panel have a minHeight instead (#18623)

This commit is contained in:
Jonah Williams 2018-06-20 15:15:03 -07:00 committed by GitHub
parent fb8cbf216b
commit 97e58ecb2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 6 deletions

View File

@ -143,8 +143,8 @@ class ExpansionPanelList extends StatelessWidget {
duration: animationDuration, duration: animationDuration,
curve: Curves.fastOutSlowIn, curve: Curves.fastOutSlowIn,
margin: _isChildExpanded(index) ? kExpandedEdgeInsets : EdgeInsets.zero, margin: _isChildExpanded(index) ? kExpandedEdgeInsets : EdgeInsets.zero,
child: new SizedBox( child: new ConstrainedBox(
height: _kPanelHeaderCollapsedHeight, constraints: const BoxConstraints(minHeight: _kPanelHeaderCollapsedHeight),
child: children[index].headerBuilder( child: children[index].headerBuilder(
context, context,
children[index].isExpanded, children[index].isExpanded,

View File

@ -126,17 +126,25 @@ void main() {
animationDuration: kSizeAnimationDuration, animationDuration: kSizeAnimationDuration,
children: <ExpansionPanel>[ children: <ExpansionPanel>[
new ExpansionPanel( new ExpansionPanel(
headerBuilder: (BuildContext context, bool isExpanded) => const Placeholder(), headerBuilder: (BuildContext context, bool isExpanded) => const Placeholder(
body: const SizedBox(height: 100.0, child: const Placeholder()), fallbackHeight: 12.0,
),
body: const SizedBox(height: 100.0, child: const Placeholder(
fallbackHeight: 12.0,
)),
isExpanded: a, isExpanded: a,
), ),
new ExpansionPanel( new ExpansionPanel(
headerBuilder: (BuildContext context, bool isExpanded) => const Placeholder(), headerBuilder: (BuildContext context, bool isExpanded) => const Placeholder(
fallbackHeight: 12.0,
),
body: const SizedBox(height: 100.0, child: const Placeholder()), body: const SizedBox(height: 100.0, child: const Placeholder()),
isExpanded: b, isExpanded: b,
), ),
new ExpansionPanel( new ExpansionPanel(
headerBuilder: (BuildContext context, bool isExpanded) => const Placeholder(), headerBuilder: (BuildContext context, bool isExpanded) => const Placeholder(
fallbackHeight: 12.0,
),
body: const SizedBox(height: 100.0, child: const Placeholder()), body: const SizedBox(height: 100.0, child: const Placeholder()),
isExpanded: c, isExpanded: c,
), ),