From 97e58ecb2c58e6670ecfea7a3ebd3ea2acc1f7e7 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Wed, 20 Jun 2018 15:15:03 -0700 Subject: [PATCH] Make expansion panel have a minHeight instead (#18623) --- .../lib/src/material/expansion_panel.dart | 4 ++-- .../test/material/expansion_panel_test.dart | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/flutter/lib/src/material/expansion_panel.dart b/packages/flutter/lib/src/material/expansion_panel.dart index cc46150c08..1a29208e48 100644 --- a/packages/flutter/lib/src/material/expansion_panel.dart +++ b/packages/flutter/lib/src/material/expansion_panel.dart @@ -143,8 +143,8 @@ class ExpansionPanelList extends StatelessWidget { duration: animationDuration, curve: Curves.fastOutSlowIn, margin: _isChildExpanded(index) ? kExpandedEdgeInsets : EdgeInsets.zero, - child: new SizedBox( - height: _kPanelHeaderCollapsedHeight, + child: new ConstrainedBox( + constraints: const BoxConstraints(minHeight: _kPanelHeaderCollapsedHeight), child: children[index].headerBuilder( context, children[index].isExpanded, diff --git a/packages/flutter/test/material/expansion_panel_test.dart b/packages/flutter/test/material/expansion_panel_test.dart index cc88bd6c4c..d65937d07b 100644 --- a/packages/flutter/test/material/expansion_panel_test.dart +++ b/packages/flutter/test/material/expansion_panel_test.dart @@ -126,17 +126,25 @@ void main() { animationDuration: kSizeAnimationDuration, children: [ new ExpansionPanel( - headerBuilder: (BuildContext context, bool isExpanded) => const Placeholder(), - body: const SizedBox(height: 100.0, child: const Placeholder()), + headerBuilder: (BuildContext context, bool isExpanded) => const Placeholder( + fallbackHeight: 12.0, + ), + body: const SizedBox(height: 100.0, child: const Placeholder( + fallbackHeight: 12.0, + )), isExpanded: a, ), 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()), isExpanded: b, ), 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()), isExpanded: c, ),