Gallery cosmetic updates (#17310)

This commit is contained in:
Hans Muller
2018-05-07 09:25:50 -07:00
committed by GitHub
parent e8d0874468
commit eee986b076
7 changed files with 53 additions and 18 deletions

View File

@@ -32,7 +32,7 @@ class GalleryDemoCategory {
}
const GalleryDemoCategory _kDemos = const GalleryDemoCategory._(
name: 'Vignettes',
name: 'Studies',
icon: GalleryIcons.animation,
);

View File

@@ -122,7 +122,6 @@ class _CategoriesPage extends StatelessWidget {
// LayoutBuilder.
return new RepaintBoundary(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: new List<Widget>.generate(rowCount, (int rowIndex) {
@@ -289,11 +288,21 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat
super.dispose();
}
static Widget _animatedSwitcherLayoutBuilder(List<Widget> children) {
return new Stack(
children: children,
alignment: Alignment.topLeft,
);
}
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final bool isDark = theme.brightness == Brightness.dark;
const Curve switchOutCurve = const Interval(0.4, 1.0, curve: Curves.fastOutSlowIn);
const Curve switchInCurve = const Interval(0.4, 1.0, curve: Curves.fastOutSlowIn);
Widget home = new Scaffold(
key: _scaffoldKey,
backgroundColor: isDark ? _kFlutterBlue : theme.primaryColor,
@@ -313,6 +322,9 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat
backLayer: widget.optionsPage,
frontAction: new AnimatedSwitcher(
duration: _kFrontLayerSwitchDuration,
switchOutCurve: switchOutCurve,
switchInCurve: switchInCurve,
layoutBuilder: _animatedSwitcherLayoutBuilder,
child: _category == null
? const _FlutterLogo()
: new IconButton(
@@ -330,6 +342,9 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat
frontHeading: new Container(height: 24.0),
frontLayer: new AnimatedSwitcher(
duration: _kFrontLayerSwitchDuration,
switchOutCurve: switchOutCurve,
switchInCurve: switchInCurve,
layoutBuilder: _animatedSwitcherLayoutBuilder,
child: _category != null
? new _DemosPage(_category)
: new _CategoriesPage(