From c177ecd86c1b5bba8b3524fe12d22c31ff1e51c0 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Sat, 26 Sep 2015 13:07:21 -0700 Subject: [PATCH 1/3] Add missing export --- packages/flutter/lib/src/fn3.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/flutter/lib/src/fn3.dart b/packages/flutter/lib/src/fn3.dart index e6a93bbcc70..ba781851444 100644 --- a/packages/flutter/lib/src/fn3.dart +++ b/packages/flutter/lib/src/fn3.dart @@ -32,6 +32,7 @@ export 'fn3/ink_well.dart'; export 'fn3/input.dart'; export 'fn3/material.dart'; export 'fn3/material_button.dart'; +export 'fn3/mimic.dart'; export 'fn3/mixed_viewport.dart'; export 'fn3/navigator.dart'; export 'fn3/popup_menu.dart'; From a01aa6ffbb2539ef12cc0757f56b4cbdfd05c259 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Sat, 26 Sep 2015 13:07:31 -0700 Subject: [PATCH 2/3] Fix analyzer warnings --- examples/fitness/lib/feed.dart | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/examples/fitness/lib/feed.dart b/examples/fitness/lib/feed.dart index 83e9ee29d6d..9b50c953e31 100644 --- a/examples/fitness/lib/feed.dart +++ b/examples/fitness/lib/feed.dart @@ -244,13 +244,11 @@ class FeedFragment extends StatefulComponent { }); } - Anchor _snackBarAnchor = new Anchor(); Widget buildSnackBar() { if (_snackBarStatus == AnimationStatus.dismissed) return null; return new SnackBar( showing: _isShowingSnackBar, - anchor: _snackBarAnchor, content: new Text("Item deleted."), actions: [new SnackBarAction(label: "UNDO", onPressed: _handleUndo)], onDismissed: () { setState(() { _snackBarStatus = AnimationStatus.dismissed; }); } @@ -267,11 +265,10 @@ class FeedFragment extends StatefulComponent { Widget buildFloatingActionButton() { switch (_fitnessMode) { case FitnessMode.feed: - return _snackBarAnchor.build( - new FloatingActionButton( - child: new Icon(type: 'content/add', size: 24), - onPressed: _handleActionButtonPressed - )); + return new FloatingActionButton( + child: new Icon(type: 'content/add', size: 24), + onPressed: _handleActionButtonPressed + ); case FitnessMode.chart: return null; } From 1424f351d968929bdaa7463c382273dc468156fa Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Sat, 26 Sep 2015 13:07:46 -0700 Subject: [PATCH 3/3] Update navigation example after Navigator changes Now this example uses the App widget to drive the adventure game. --- examples/widgets/navigation.dart | 122 +++++++++++++------------------ 1 file changed, 50 insertions(+), 72 deletions(-) diff --git a/examples/widgets/navigation.dart b/examples/widgets/navigation.dart index d86940cd6b6..e26d6299366 100644 --- a/examples/widgets/navigation.dart +++ b/examples/widgets/navigation.dart @@ -2,87 +2,65 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:sky/material.dart'; import 'package:sky/src/fn3.dart'; -List routes = [ - new Route( - name: 'home', - builder: (navigator, route) => new Container( - padding: const EdgeDims.all(30.0), - decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)), - child: new Column([ - new Text("You are at home"), - new RaisedButton( - child: new Text('GO SHOPPING'), - onPressed: () => navigator.pushNamed('shopping') - ), - new RaisedButton( - child: new Text('START ADVENTURE'), - onPressed: () => navigator.pushNamed('adventure') - )], - justifyContent: FlexJustifyContent.center - ) +final Map routes = { + '/': (NavigatorState navigator, Route route) => new Container( + padding: const EdgeDims.all(30.0), + decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)), + child: new Column([ + new Text("You are at home"), + new RaisedButton( + child: new Text('GO SHOPPING'), + onPressed: () => navigator.pushNamed('/shopping') + ), + new RaisedButton( + child: new Text('START ADVENTURE'), + onPressed: () => navigator.pushNamed('/adventure') + )], + justifyContent: FlexJustifyContent.center ) ), - new Route( - name: 'shopping', - builder: (navigator, route) => new Container( - padding: const EdgeDims.all(20.0), - decoration: new BoxDecoration(backgroundColor: const Color(0xFFBF5FFF)), - child: new Column([ - new Text("Village Shop"), - new RaisedButton( - child: new Text('RETURN HOME'), - onPressed: () => navigator.pop() - ), - new RaisedButton( - child: new Text('GO TO DUNGEON'), - onPressed: () => navigator.push(routes[2]) - )], - justifyContent: FlexJustifyContent.center - ) + '/shopping': (NavigatorState navigator, Route route) => new Container( + padding: const EdgeDims.all(20.0), + decoration: new BoxDecoration(backgroundColor: const Color(0xFFBF5FFF)), + child: new Column([ + new Text("Village Shop"), + new RaisedButton( + child: new Text('RETURN HOME'), + onPressed: () => navigator.pop() + ), + new RaisedButton( + child: new Text('GO TO DUNGEON'), + onPressed: () => navigator.pushNamed('/adventure') + )], + justifyContent: FlexJustifyContent.center ) ), - new Route( - name: 'adventure', - builder: (navigator, route) => new Container( - padding: const EdgeDims.all(20.0), - decoration: new BoxDecoration(backgroundColor: const Color(0xFFDC143C)), - child: new Column([ - new Text("Monster's Lair"), - new RaisedButton( - child: new Text('RUN!!!'), - onPressed: () => navigator.pop() - )], - justifyContent: FlexJustifyContent.center - ) + '/adventure': (NavigatorState navigator, Route route) => new Container( + padding: const EdgeDims.all(20.0), + decoration: new BoxDecoration(backgroundColor: const Color(0xFFDC143C)), + child: new Column([ + new Text("Monster's Lair"), + new RaisedButton( + child: new Text('RUN!!!'), + onPressed: () => navigator.pop() + )], + justifyContent: FlexJustifyContent.center ) ) -]; +}; -class NavigationExampleApp extends StatefulComponent { - NavigationExampleAppState createState() => new NavigationExampleAppState(); -} - -class NavigationExampleAppState extends State { - NavigatorHistory _history = new NavigatorHistory(routes); - - void onBack() { - if (_history.hasPrevious()) { - setState(() { - _history.pop(); - }); - } else { - // TODO(abarth): Integrate with the system navigator. - // super.onBack(); - } - } - - Widget build(BuildContext context) { - return new Row([new Navigator(_history)]); - } -} +final ThemeData theme = new ThemeData( + brightness: ThemeBrightness.light, + primarySwatch: Colors.purple +); void main() { - runApp(new NavigationExampleApp()); + runApp(new App( + title: 'Navigation Example', + theme: theme, + routes: routes + )); }