From cc3df142684ceec3ffddbdd1059e2ed3dff17a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99=20Tiselice?= Date: Fri, 9 Sep 2016 13:19:03 -0700 Subject: [PATCH] Removed Pesto's drawer. (#5722) The drawer was confusing without adding much value. It was especially confusing when wanting to go back to the Gallery on iOS. Fixes #5713. --- .../flutter_gallery/lib/demo/pesto_demo.dart | 74 ------------------- examples/flutter_gallery/test/pesto_test.dart | 31 -------- examples/flutter_gallery/test/smoke_test.dart | 16 +--- .../test_driver/transitions_perf_test.dart | 2 +- 4 files changed, 5 insertions(+), 118 deletions(-) diff --git a/examples/flutter_gallery/lib/demo/pesto_demo.dart b/examples/flutter_gallery/lib/demo/pesto_demo.dart index 6d47de42b98..f52dad56d0a 100644 --- a/examples/flutter_gallery/lib/demo/pesto_demo.dart +++ b/examples/flutter_gallery/lib/demo/pesto_demo.dart @@ -15,9 +15,6 @@ class PestoDemo extends StatelessWidget { Widget build(BuildContext context) => new PestoHome(); } -const String _kUserName = 'Jonathan'; -const String _kUserEmail = 'jonathan@example.com'; -const String _kUserImage = 'packages/flutter_gallery_assets/pesto/avatar.jpg'; const String _kSmallLogoImage = 'packages/flutter_gallery_assets/pesto/logo_small.png'; const String _kMediumLogoImage = 'packages/flutter_gallery_assets/pesto/logo_medium.png'; const double _kAppBarHeight = 128.0; @@ -79,11 +76,6 @@ class RecipeGridPage extends StatefulWidget { class _RecipeGridPageState extends State { final GlobalKey scaffoldKey = new GlobalKey(); - final TextStyle favoritesMessageStyle = const PestoStyle(fontSize: 16.0); - final TextStyle userStyle = const PestoStyle(fontWeight: FontWeight.bold); - final TextStyle emailStyle = const PestoStyle(color: Colors.black54); - - bool showFavorites = false; @override Widget build(BuildContext context) { @@ -95,7 +87,6 @@ class _RecipeGridPageState extends State { scrollableKey: config.scrollableKey, appBarBehavior: AppBarBehavior.under, appBar: buildAppBar(context, statusBarHeight), - drawer: buildDrawer(context), floatingActionButton: new FloatingActionButton( child: new Icon(Icons.edit), onPressed: () { @@ -145,74 +136,9 @@ class _RecipeGridPageState extends State { ); } - Widget buildDrawer(BuildContext context) { - return new Drawer( - child: new Block( - children: [ - new DrawerHeader( - child: new Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - new Container( - decoration: new BoxDecoration( - border: new Border.all(color: _kTheme.primaryColor, width: 2.0), - shape: BoxShape.circle - ), - width: 72.0, - height: 72.0, - padding: const EdgeInsets.all(2.0), - margin: const EdgeInsets.only(bottom: 16.0), - child: new ClipOval( - child: new Image.asset(_kUserImage, fit: ImageFit.contain) - ) - ), - new Text(_kUserName, style: userStyle), - new Text(_kUserEmail, style: emailStyle) - ] - ) - ), - new DrawerItem( - child: new Text('Home'), - icon: new Icon(Icons.home), - selected: !showFavorites, - onPressed: () { - Navigator.popUntil(context, ModalRoute.withName('/pesto')); - } - ), - new DrawerItem( - child: new Text('Favorites'), - icon: new Icon(Icons.favorite), - selected: showFavorites, - onPressed: () { - if (showFavorites) - Navigator.pop(context); - else - showFavoritesPage(context); - } - ), - new Divider(), - new DrawerItem( - child: new Text('Return to Gallery'), - icon: new Icon(Icons.arrow_back), - onPressed: () { - Navigator.popUntil(context, ModalRoute.withName('/')); - } - ), - ] - ) - ); - } - Widget buildBody(BuildContext context, double statusBarHeight) { final EdgeInsets padding = new EdgeInsets.fromLTRB(8.0, 8.0 + _kAppBarHeight + statusBarHeight, 8.0, 8.0); - if (config.recipes.isEmpty) { - return new Padding( - padding: padding, - child: new Text('Save your favorite recipes to see them here.', style: favoritesMessageStyle) - ); - } - return new ScrollableGrid( scrollableKey: config.scrollableKey, delegate: new MaxTileWidthGridDelegate( diff --git a/examples/flutter_gallery/test/pesto_test.dart b/examples/flutter_gallery/test/pesto_test.dart index c4a226b3895..fca24169b22 100644 --- a/examples/flutter_gallery/test/pesto_test.dart +++ b/examples/flutter_gallery/test/pesto_test.dart @@ -21,37 +21,6 @@ void main() { if (binding is LiveTestWidgetsFlutterBinding) binding.allowAllFrames = true; - // Regression test for https://github.com/flutter/flutter/pull/5168 - testWidgets('Pesto route management', (WidgetTester tester) async { - await tester.pumpWidget(new GalleryApp()); - await tester.pump(); // see https://github.com/flutter/flutter/issues/1865 - await tester.pump(); // triggers a frame - - expect(find.text('Pesto'), findsOneWidget); - await tester.tap(find.text('Pesto')); - await tester.pump(); // Launch pesto - await tester.pump(const Duration(seconds: 1)); // transition is complete - - Future tapDrawerItem(String title) async { - await tester.tap(findNavigationMenuButton(tester)); - await tester.pump(); - await tester.pump(const Duration(seconds: 1)); // drawer opening animation - await tester.tap(find.text(title)); - await tester.pump(); - await tester.pump(const Duration(seconds: 1)); // drawer closing animation - await tester.pump(); // maybe open a new page - return tester.pump(const Duration(seconds: 1)); // new page transition - } - await tapDrawerItem('Home'); - await tapDrawerItem('Favorites'); - await tapDrawerItem('Home'); - await tapDrawerItem('Favorites'); - await tapDrawerItem('Home'); - await tapDrawerItem('Return to Gallery'); - - expect(find.text('Flutter Gallery'), findsOneWidget); - }); - // Regression test for https://github.com/flutter/flutter/pull/5168 testWidgets('Pesto appbar heroics', (WidgetTester tester) async { await tester.pumpWidget( diff --git a/examples/flutter_gallery/test/smoke_test.dart b/examples/flutter_gallery/test/smoke_test.dart index 47c09533051..62d925ba4c5 100644 --- a/examples/flutter_gallery/test/smoke_test.dart +++ b/examples/flutter_gallery/test/smoke_test.dart @@ -50,18 +50,10 @@ Future smokeDemo(WidgetTester tester, String routeName) async { expect(find.text(kCaption), findsNothing); // Go back - if (routeName == '/pesto') { - // TODO(mpcomplete): workaround for Pesto, which has a drawer instead of a - // back button. Figure out how to have both. - Finder drawer = find.byType(Scaffold); // get a Widget for the BuildContext - expect(drawer, findsOneWidget); - Navigator.pop(drawer.evaluate().first); - } else { - Finder backButton = findBackButton(tester); - expect(backButton, findsOneWidget); - await tester.tap(backButton); - await tester.pump(); // Start the pop "back" operation. - } + Finder backButton = findBackButton(tester); + expect(backButton, findsOneWidget); + await tester.tap(backButton); + await tester.pump(); // Start the pop "back" operation. await tester.pump(const Duration(seconds: 1)); // Wait until it has finished. return null; } diff --git a/examples/flutter_gallery/test_driver/transitions_perf_test.dart b/examples/flutter_gallery/test_driver/transitions_perf_test.dart index 20a439fad3e..88bd9557a5a 100644 --- a/examples/flutter_gallery/test_driver/transitions_perf_test.dart +++ b/examples/flutter_gallery/test_driver/transitions_perf_test.dart @@ -23,7 +23,7 @@ final List demoCategories = [ // kAllGalleryItems.map((GalleryItem item) => item.title).toList(); final List demoTitles = [ // Demos - // 'Pesto', TODO(hansmuller): restore when Pesto has a back button. + 'Pesto', 'Shrine', 'Contact profile', // Components