Unverified Commit eee986b0 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Gallery cosmetic updates (#17310)

parent e8d08744
...@@ -11,6 +11,10 @@ class BottomAppBarDemo extends StatefulWidget { ...@@ -11,6 +11,10 @@ class BottomAppBarDemo extends StatefulWidget {
State createState() => new _BottomAppBarDemoState(); State createState() => new _BottomAppBarDemoState();
} }
// Flutter generally frowns upon abbrevation however this class uses two
// abbrevations extensively: "fab" for floating action button, and "bab"
// for bottom application bar.
class _BottomAppBarDemoState extends State<BottomAppBarDemo> { class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
static final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>(); static final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
...@@ -138,6 +142,16 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> { ...@@ -138,6 +142,16 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
appBar: new AppBar( appBar: new AppBar(
title: const Text('Bottom app bar'), title: const Text('Bottom app bar'),
elevation: 0.0, elevation: 0.0,
actions: <Widget>[
new IconButton(
icon: const Icon(Icons.sentiment_very_satisfied),
onPressed: () {
setState(() {
_fabShape = _fabShape == kCircularFab ? kDiamondFab : kCircularFab;
});
},
),
],
), ),
body: new ListView( body: new ListView(
padding: const EdgeInsets.only(bottom: 88.0), padding: const EdgeInsets.only(bottom: 88.0),
...@@ -155,7 +169,7 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> { ...@@ -155,7 +169,7 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
new _RadioItem<bool>(kShowNotchFalse, _showNotch, _onShowNotchChanged), new _RadioItem<bool>(kShowNotchFalse, _showNotch, _onShowNotchChanged),
const Divider(), const Divider(),
const _Heading('Notch'), const _Heading('FAB Position'),
new _RadioItem<FloatingActionButtonLocation>(kFabEndDocked, _fabLocation, _onFabLocationChanged), new _RadioItem<FloatingActionButtonLocation>(kFabEndDocked, _fabLocation, _onFabLocationChanged),
new _RadioItem<FloatingActionButtonLocation>(kFabCenterDocked, _fabLocation, _onFabLocationChanged), new _RadioItem<FloatingActionButtonLocation>(kFabCenterDocked, _fabLocation, _onFabLocationChanged),
...@@ -214,10 +228,18 @@ class _RadioItem<T> extends StatelessWidget { ...@@ -214,10 +228,18 @@ class _RadioItem<T> extends StatelessWidget {
), ),
new Expanded( new Expanded(
child: new Semantics( child: new Semantics(
container: true,
button: true,
label: value.label, label: value.label,
child: new Text( child: new GestureDetector(
value.title, behavior: HitTestBehavior.opaque,
style: theme.textTheme.subhead, onTap: () {
onChanged(value);
},
child: new Text(
value.title,
style: theme.textTheme.subhead,
),
), ),
), ),
), ),
...@@ -252,7 +274,7 @@ class _ColorsItem extends StatelessWidget { ...@@ -252,7 +274,7 @@ class _ColorsItem extends StatelessWidget {
fillColor: color, fillColor: color,
shape: new CircleBorder( shape: new CircleBorder(
side: new BorderSide( side: new BorderSide(
color: color == null ? Colors.black : const Color(0xFFD5D7DA), color: color == selectedColor ? Colors.black : const Color(0xFFD5D7DA),
width: 2.0, width: 2.0,
), ),
), ),
...@@ -339,9 +361,7 @@ class _DemoBottomAppBar extends StatelessWidget { ...@@ -339,9 +361,7 @@ class _DemoBottomAppBar extends StatelessWidget {
return new BottomAppBar( return new BottomAppBar(
color: color, color: color,
hasNotch: showNotch, hasNotch: showNotch,
child: new Row( child: new Row(children: rowContents),
children: rowContents,
),
); );
} }
} }
......
...@@ -32,7 +32,7 @@ class GalleryDemoCategory { ...@@ -32,7 +32,7 @@ class GalleryDemoCategory {
} }
const GalleryDemoCategory _kDemos = const GalleryDemoCategory._( const GalleryDemoCategory _kDemos = const GalleryDemoCategory._(
name: 'Vignettes', name: 'Studies',
icon: GalleryIcons.animation, icon: GalleryIcons.animation,
); );
......
...@@ -122,7 +122,6 @@ class _CategoriesPage extends StatelessWidget { ...@@ -122,7 +122,6 @@ class _CategoriesPage extends StatelessWidget {
// LayoutBuilder. // LayoutBuilder.
return new RepaintBoundary( return new RepaintBoundary(
child: new Column( child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: new List<Widget>.generate(rowCount, (int rowIndex) { children: new List<Widget>.generate(rowCount, (int rowIndex) {
...@@ -289,11 +288,21 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat ...@@ -289,11 +288,21 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat
super.dispose(); super.dispose();
} }
static Widget _animatedSwitcherLayoutBuilder(List<Widget> children) {
return new Stack(
children: children,
alignment: Alignment.topLeft,
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
final bool isDark = theme.brightness == Brightness.dark; 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( Widget home = new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
backgroundColor: isDark ? _kFlutterBlue : theme.primaryColor, backgroundColor: isDark ? _kFlutterBlue : theme.primaryColor,
...@@ -313,6 +322,9 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat ...@@ -313,6 +322,9 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat
backLayer: widget.optionsPage, backLayer: widget.optionsPage,
frontAction: new AnimatedSwitcher( frontAction: new AnimatedSwitcher(
duration: _kFrontLayerSwitchDuration, duration: _kFrontLayerSwitchDuration,
switchOutCurve: switchOutCurve,
switchInCurve: switchInCurve,
layoutBuilder: _animatedSwitcherLayoutBuilder,
child: _category == null child: _category == null
? const _FlutterLogo() ? const _FlutterLogo()
: new IconButton( : new IconButton(
...@@ -330,6 +342,9 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat ...@@ -330,6 +342,9 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat
frontHeading: new Container(height: 24.0), frontHeading: new Container(height: 24.0),
frontLayer: new AnimatedSwitcher( frontLayer: new AnimatedSwitcher(
duration: _kFrontLayerSwitchDuration, duration: _kFrontLayerSwitchDuration,
switchOutCurve: switchOutCurve,
switchInCurve: switchInCurve,
layoutBuilder: _animatedSwitcherLayoutBuilder,
child: _category != null child: _category != null
? new _DemosPage(_category) ? new _DemosPage(_category)
: new _CategoriesPage( : new _CategoriesPage(
......
...@@ -26,7 +26,7 @@ void main() { ...@@ -26,7 +26,7 @@ void main() {
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865 await tester.pump(); // see https://github.com/flutter/flutter/issues/1865
await tester.pump(); // triggers a frame await tester.pump(); // triggers a frame
await tester.tap(find.text('Vignettes')); await tester.tap(find.text('Studies'));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await tester.tap(find.text('Pesto')); await tester.tap(find.text('Pesto'));
...@@ -47,7 +47,7 @@ void main() { ...@@ -47,7 +47,7 @@ void main() {
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865 await tester.pump(); // see https://github.com/flutter/flutter/issues/1865
await tester.pump(); // triggers a frame await tester.pump(); // triggers a frame
await tester.tap(find.text('Vignettes')); await tester.tap(find.text('Studies'));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await tester.tap(find.text('Pesto')); await tester.tap(find.text('Pesto'));
......
...@@ -31,8 +31,8 @@ void main() { ...@@ -31,8 +31,8 @@ void main() {
await tester.tap(showOptionsPageButton); await tester.tap(showOptionsPageButton);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
// Show the vignettes // Show the studies (aka "vignettes", aka "demos")
await tester.tap(find.text('Vignettes')); await tester.tap(find.text('Studies'));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
// Show the Contact profile demo and scroll it upwards // Show the Contact profile demo and scroll it upwards
......
...@@ -26,7 +26,7 @@ void main() { ...@@ -26,7 +26,7 @@ void main() {
await tester.tap(find.text('NO THANKS')); await tester.tap(find.text('NO THANKS'));
await tester.pump(); await tester.pump();
await tester.tap(find.text('Vignettes')); await tester.tap(find.text('Studies'));
await tester.pump(); // Launch await tester.pump(); // Launch
await tester.pump(const Duration(seconds: 1)); // transition is complete await tester.pump(const Duration(seconds: 1)); // transition is complete
......
...@@ -24,9 +24,9 @@ const FileSystem _fs = const LocalFileSystem(); ...@@ -24,9 +24,9 @@ const FileSystem _fs = const LocalFileSystem();
// These names must match GalleryItem titles from kAllGalleryDemos // These names must match GalleryItem titles from kAllGalleryDemos
// in examples/flutter_gallery/lib/gallery/demos.dart // in examples/flutter_gallery/lib/gallery/demos.dart
const List<String> kProfiledDemos = const <String>[ const List<String> kProfiledDemos = const <String>[
'Shrine@Vignettes', 'Shrine@Studies',
'Contact profile@Vignettes', 'Contact profile@Studies',
'Animation@Vignettes', 'Animation@Studies',
'Bottom navigation@Material', 'Bottom navigation@Material',
'Buttons@Material', 'Buttons@Material',
'Cards@Material', 'Cards@Material',
......
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