Unverified Commit 5cd825a8 authored by David Shuckerow's avatar David Shuckerow Committed by GitHub

Fix performance regression caused by the Bottom App Bar demo (#16389)

parent 49a3adc1
...@@ -271,35 +271,24 @@ class _DemoBottomAppBar extends StatelessWidget { ...@@ -271,35 +271,24 @@ class _DemoBottomAppBar extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final bool showsFirst = babMode == _BabMode.END_FAB;
return new BottomAppBar( return new BottomAppBar(
color: color, color: color,
hasNotch: enableNotch, hasNotch: enableNotch,
child: new Row( // TODO: Use an AnimatedCrossFade to build contents for centered FAB performantly.
children: <Widget> [ // Using AnimatedCrossFade here previously was causing https://github.com/flutter/flutter/issues/16377.
new IconButton( child: buildBabContents(context, _BabMode.END_FAB),
icon: const Icon(Icons.menu),
onPressed: () {
showModalBottomSheet<Null>(context: context, builder: (BuildContext context) => const _DemoDrawer());
},
),
new Expanded(
child: new AnimatedCrossFade(
duration: const Duration(milliseconds: 225),
firstChild: buildBabContents(context, _BabMode.END_FAB),
firstCurve: showsFirst ? fadeOutCurve : fadeInCurve,
secondChild: buildBabContents(context, _BabMode.CENTER_FAB),
secondCurve: showsFirst ? fadeInCurve : fadeOutCurve,
crossFadeState: showsFirst ? CrossFadeState.showFirst : CrossFadeState.showSecond,
),
),
],
),
); );
} }
Widget buildBabContents(BuildContext context, _BabMode babMode) { Widget buildBabContents(BuildContext context, _BabMode babMode) {
final List<Widget> rowContents = <Widget> []; final List<Widget> rowContents = <Widget> [
new IconButton(
icon: const Icon(Icons.menu),
onPressed: () {
showModalBottomSheet<Null>(context: context, builder: (BuildContext context) => const _DemoDrawer());
},
),
];
if (babMode == _BabMode.CENTER_FAB) { if (babMode == _BabMode.CENTER_FAB) {
rowContents.add( rowContents.add(
new Expanded( new Expanded(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment