Fix Flutter-related bugs in syncslides:
Joining a presentation goes to slidelist page instead of slideshow
https://github.com/vanadium/syncslides/issues/22
Tapping back button on main decks grid page crashes the app
https://github.com/vanadium/syncslides/issues/23
Update Flutter version. Update the app to use the new Drawer API.
Change-Id: Id98233ca52d336e160696358c8d30263b6b533cb
diff --git a/dart/FLUTTER_VERSION b/dart/FLUTTER_VERSION
index 774d413..09f48c6 100644
--- a/dart/FLUTTER_VERSION
+++ b/dart/FLUTTER_VERSION
@@ -1 +1 @@
-c13fe8eb5a67d550d2b9742831aa7d15dc80f649
+519b190c0f2e87f2e03326c0d41566c9d32fc4f6
diff --git a/dart/lib/components/deckgrid.dart b/dart/lib/components/deckgrid.dart
index fc7b71a..b87e395 100644
--- a/dart/lib/components/deckgrid.dart
+++ b/dart/lib/components/deckgrid.dart
@@ -35,32 +35,31 @@
p.deck.key == d.deck.key))
.map((DeckState d) => d.deck);
- Widget title = new Text('SyncSlides');
- Widget drawer = new IconButton(icon: "navigation/menu", onPressed: () {
- showDrawer(
- context: context,
- child: new Block([
- new DrawerItem(
- icon: 'action/account_circle',
- child: stopWrapping(new Text(appState.user.name,
- style: style.Text.titleStyle))),
- new DrawerItem(
- icon: 'action/perm_device_information',
- child: stopWrapping(new Text(appState.settings.deviceId,
- style: style.Text.titleStyle)))
- ]));
- });
-
return new Scaffold(
key: _scaffoldKey,
- toolBar: new ToolBar(left: drawer, center: title),
+ toolBar: new ToolBar(center: new Text('SyncSlides')),
floatingActionButton: new FloatingActionButton(
child: new Icon(icon: 'content/add'), onPressed: () {
appActions.loadDemoDeck();
}),
+ drawer: _buildDrawer(context, appState),
body: new Material(
child: new DeckGrid(decks, presentations, appActions)));
}
+
+ Widget _buildDrawer(BuildContext context, AppState appState) {
+ return new Drawer(
+ child: new Block([
+ new DrawerItem(
+ icon: 'action/account_circle',
+ child: stopWrapping(
+ new Text(appState.user.name, style: style.Text.titleStyle))),
+ new DrawerItem(
+ icon: 'action/perm_device_information',
+ child: stopWrapping(new Text(appState.settings.deviceId,
+ style: style.Text.titleStyle)))
+ ]));
+ }
}
// DeckGrid is scrollable grid view of decks.
@@ -119,17 +118,15 @@
toast.info(
_scaffoldKey, 'Joined presentation ${presentationData.deck.name}.');
- // Push slides list page first before navigating to the slideshow.
- Navigator.push(
- context,
- new MaterialPageRoute(
- builder: (context) =>
- new SlideListPage(presentationData.deck.key)));
- Navigator.push(
- context,
- new MaterialPageRoute(
- builder: (context) =>
- new SlideshowPage(presentationData.deck.key)));
+ Navigator.openTransaction(context, (NavigatorTransaction transaction) {
+ // Push slides list page first before navigating to the slideshow.
+ transaction.push(new MaterialPageRoute(
+ builder: (context) =>
+ new SlideListPage(presentationData.deck.key)));
+ transaction.push(new MaterialPageRoute(
+ builder: (context) =>
+ new SlideshowPage(presentationData.deck.key)));
+ });
} catch (e) {
toast.error(_scaffoldKey,
'Failed to start presentation ${presentationData.deck.name}.', e);
diff --git a/dart/lib/main.dart b/dart/lib/main.dart
index 039f701..efcdbe4 100644
--- a/dart/lib/main.dart
+++ b/dart/lib/main.dart
@@ -40,15 +40,10 @@
void _initBackButtonHandler() {
backButtonUtil.onBackButton(() {
- if (_navigator != null) {
+ if (_navigator != null && _navigator.canPop()) {
bool returnValue;
_navigator.openTransaction((NavigatorTransaction transaction) {
returnValue = transaction.pop(null);
- if (!returnValue) {
- // pop() returns false when we popped the top-level route.
- // To stay on the landing page, we re-push its route.
- transaction.pushNamed('/');
- }
});
return returnValue;
}
diff --git a/dart/pubspec.lock b/dart/pubspec.lock
index 6899ca3..d803339 100644
--- a/dart/pubspec.lock
+++ b/dart/pubspec.lock
@@ -120,7 +120,7 @@
mojo:
description: mojo
source: hosted
- version: "0.4.5"
+ version: "0.4.6"
mojo_apptest:
description: mojo_apptest
source: hosted
@@ -128,15 +128,15 @@
mojo_sdk:
description: mojo_sdk
source: hosted
- version: "0.2.4"
+ version: "0.2.5"
mojo_services:
description: mojo_services
source: hosted
- version: "0.4.7"
+ version: "0.4.8"
mojom:
description: mojom
source: hosted
- version: "0.2.9"
+ version: "0.2.10"
mustache4dart:
description: mustache4dart
source: hosted
@@ -186,11 +186,11 @@
sky_engine:
description: sky_engine
source: hosted
- version: "0.0.65"
+ version: "0.0.67"
sky_services:
description: sky_services
source: hosted
- version: "0.0.65"
+ version: "0.0.67"
source_map_stack_trace:
description: source_map_stack_trace
source: hosted