Commit cc3df142 authored by Dragoș Tiselice's avatar Dragoș Tiselice Committed by GitHub

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.
parent 7cf47ca4
......@@ -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<RecipeGridPage> {
final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
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<RecipeGridPage> {
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<RecipeGridPage> {
);
}
Widget buildDrawer(BuildContext context) {
return new Drawer(
child: new Block(
children: <Widget>[
new DrawerHeader(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
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(
......
......@@ -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<Null> 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(
......
......@@ -50,18 +50,10 @@ Future<Null> 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;
}
......
......@@ -23,7 +23,7 @@ final List<String> demoCategories = <String>[
// kAllGalleryItems.map((GalleryItem item) => item.title).toList();
final List<String> demoTitles = <String>[
// Demos
// 'Pesto', TODO(hansmuller): restore when Pesto has a back button.
'Pesto',
'Shrine',
'Contact profile',
// Components
......
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