Skip to content

Commit cc3df14

Browse files
authored
Removed Pesto's drawer. (flutter#5722)
The drawer was confusing without adding much value. It was especially confusing when wanting to go back to the Gallery on iOS. Fixes flutter#5713.
1 parent 7cf47ca commit cc3df14

File tree

4 files changed

+5
-118
lines changed

4 files changed

+5
-118
lines changed

examples/flutter_gallery/lib/demo/pesto_demo.dart

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ class PestoDemo extends StatelessWidget {
1515
Widget build(BuildContext context) => new PestoHome();
1616
}
1717

18-
const String _kUserName = 'Jonathan';
19-
const String _kUserEmail = 'jonathan@example.com';
20-
const String _kUserImage = 'packages/flutter_gallery_assets/pesto/avatar.jpg';
2118
const String _kSmallLogoImage = 'packages/flutter_gallery_assets/pesto/logo_small.png';
2219
const String _kMediumLogoImage = 'packages/flutter_gallery_assets/pesto/logo_medium.png';
2320
const double _kAppBarHeight = 128.0;
@@ -79,11 +76,6 @@ class RecipeGridPage extends StatefulWidget {
7976

8077
class _RecipeGridPageState extends State<RecipeGridPage> {
8178
final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
82-
final TextStyle favoritesMessageStyle = const PestoStyle(fontSize: 16.0);
83-
final TextStyle userStyle = const PestoStyle(fontWeight: FontWeight.bold);
84-
final TextStyle emailStyle = const PestoStyle(color: Colors.black54);
85-
86-
bool showFavorites = false;
8779

8880
@override
8981
Widget build(BuildContext context) {
@@ -95,7 +87,6 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
9587
scrollableKey: config.scrollableKey,
9688
appBarBehavior: AppBarBehavior.under,
9789
appBar: buildAppBar(context, statusBarHeight),
98-
drawer: buildDrawer(context),
9990
floatingActionButton: new FloatingActionButton(
10091
child: new Icon(Icons.edit),
10192
onPressed: () {
@@ -145,74 +136,9 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
145136
);
146137
}
147138

148-
Widget buildDrawer(BuildContext context) {
149-
return new Drawer(
150-
child: new Block(
151-
children: <Widget>[
152-
new DrawerHeader(
153-
child: new Column(
154-
mainAxisAlignment: MainAxisAlignment.center,
155-
children: <Widget>[
156-
new Container(
157-
decoration: new BoxDecoration(
158-
border: new Border.all(color: _kTheme.primaryColor, width: 2.0),
159-
shape: BoxShape.circle
160-
),
161-
width: 72.0,
162-
height: 72.0,
163-
padding: const EdgeInsets.all(2.0),
164-
margin: const EdgeInsets.only(bottom: 16.0),
165-
child: new ClipOval(
166-
child: new Image.asset(_kUserImage, fit: ImageFit.contain)
167-
)
168-
),
169-
new Text(_kUserName, style: userStyle),
170-
new Text(_kUserEmail, style: emailStyle)
171-
]
172-
)
173-
),
174-
new DrawerItem(
175-
child: new Text('Home'),
176-
icon: new Icon(Icons.home),
177-
selected: !showFavorites,
178-
onPressed: () {
179-
Navigator.popUntil(context, ModalRoute.withName('/pesto'));
180-
}
181-
),
182-
new DrawerItem(
183-
child: new Text('Favorites'),
184-
icon: new Icon(Icons.favorite),
185-
selected: showFavorites,
186-
onPressed: () {
187-
if (showFavorites)
188-
Navigator.pop(context);
189-
else
190-
showFavoritesPage(context);
191-
}
192-
),
193-
new Divider(),
194-
new DrawerItem(
195-
child: new Text('Return to Gallery'),
196-
icon: new Icon(Icons.arrow_back),
197-
onPressed: () {
198-
Navigator.popUntil(context, ModalRoute.withName('/'));
199-
}
200-
),
201-
]
202-
)
203-
);
204-
}
205-
206139
Widget buildBody(BuildContext context, double statusBarHeight) {
207140
final EdgeInsets padding = new EdgeInsets.fromLTRB(8.0, 8.0 + _kAppBarHeight + statusBarHeight, 8.0, 8.0);
208141

209-
if (config.recipes.isEmpty) {
210-
return new Padding(
211-
padding: padding,
212-
child: new Text('Save your favorite recipes to see them here.', style: favoritesMessageStyle)
213-
);
214-
}
215-
216142
return new ScrollableGrid(
217143
scrollableKey: config.scrollableKey,
218144
delegate: new MaxTileWidthGridDelegate(

examples/flutter_gallery/test/pesto_test.dart

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,6 @@ void main() {
2121
if (binding is LiveTestWidgetsFlutterBinding)
2222
binding.allowAllFrames = true;
2323

24-
// Regression test for https://github.com/flutter/flutter/pull/5168
25-
testWidgets('Pesto route management', (WidgetTester tester) async {
26-
await tester.pumpWidget(new GalleryApp());
27-
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865
28-
await tester.pump(); // triggers a frame
29-
30-
expect(find.text('Pesto'), findsOneWidget);
31-
await tester.tap(find.text('Pesto'));
32-
await tester.pump(); // Launch pesto
33-
await tester.pump(const Duration(seconds: 1)); // transition is complete
34-
35-
Future<Null> tapDrawerItem(String title) async {
36-
await tester.tap(findNavigationMenuButton(tester));
37-
await tester.pump();
38-
await tester.pump(const Duration(seconds: 1)); // drawer opening animation
39-
await tester.tap(find.text(title));
40-
await tester.pump();
41-
await tester.pump(const Duration(seconds: 1)); // drawer closing animation
42-
await tester.pump(); // maybe open a new page
43-
return tester.pump(const Duration(seconds: 1)); // new page transition
44-
}
45-
await tapDrawerItem('Home');
46-
await tapDrawerItem('Favorites');
47-
await tapDrawerItem('Home');
48-
await tapDrawerItem('Favorites');
49-
await tapDrawerItem('Home');
50-
await tapDrawerItem('Return to Gallery');
51-
52-
expect(find.text('Flutter Gallery'), findsOneWidget);
53-
});
54-
5524
// Regression test for https://github.com/flutter/flutter/pull/5168
5625
testWidgets('Pesto appbar heroics', (WidgetTester tester) async {
5726
await tester.pumpWidget(

examples/flutter_gallery/test/smoke_test.dart

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,10 @@ Future<Null> smokeDemo(WidgetTester tester, String routeName) async {
5050
expect(find.text(kCaption), findsNothing);
5151

5252
// Go back
53-
if (routeName == '/pesto') {
54-
// TODO(mpcomplete): workaround for Pesto, which has a drawer instead of a
55-
// back button. Figure out how to have both.
56-
Finder drawer = find.byType(Scaffold); // get a Widget for the BuildContext
57-
expect(drawer, findsOneWidget);
58-
Navigator.pop(drawer.evaluate().first);
59-
} else {
60-
Finder backButton = findBackButton(tester);
61-
expect(backButton, findsOneWidget);
62-
await tester.tap(backButton);
63-
await tester.pump(); // Start the pop "back" operation.
64-
}
53+
Finder backButton = findBackButton(tester);
54+
expect(backButton, findsOneWidget);
55+
await tester.tap(backButton);
56+
await tester.pump(); // Start the pop "back" operation.
6557
await tester.pump(const Duration(seconds: 1)); // Wait until it has finished.
6658
return null;
6759
}

examples/flutter_gallery/test_driver/transitions_perf_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final List<String> demoCategories = <String>[
2323
// kAllGalleryItems.map((GalleryItem item) => item.title).toList();
2424
final List<String> demoTitles = <String>[
2525
// Demos
26-
// 'Pesto', TODO(hansmuller): restore when Pesto has a back button.
26+
'Pesto',
2727
'Shrine',
2828
'Contact profile',
2929
// Components

0 commit comments

Comments
 (0)