Share
Embed
Transcript
21 slides
-
• twitter : @sho5nn • Android ΞϓϦ։ൃ͕ϝΠϯ • ࠷ۙ ReactNative
• Flutter झຯͰ 15h ΄Ͳ 2 -
Cookbook • UI • SnackBar, Tab & ViewPager • Images,
Lists, Animation • Navigation, Forms, Handling Gestures • Networking • Persistence 8 -
Cookbook • UI • SnackBar, Tab & ViewPager • Images,
Lists, Animation • Navigation, Forms, Handling Gestures • Networking • Persistence 9 -
class SnackBarPage extends StatelessWidget { @override Widget build(BuildContext context) {
return new Center( child: new RaisedButton( onPressed: () { final snackBar = new SnackBar( content: new Text('Yay! A SnackBar!'), action: new SnackBarAction( label: 'Undo', onPressed: () { // Some code to undo the change! }, ), ); // Find the Scaffold in the Widget tree and use it to show a SnackBar! Scaffold.of(context).showSnackBar(snackBar); }, child: new Text('Show SnackBar'), 11 -
class SnackBarPage extends StatelessWidget { @override Widget build(BuildContext context) {
return new Center( child: new RaisedButton( onPressed: () { final snackBar = new SnackBar( content: new Text('Yay! A SnackBar!'), action: new SnackBarAction( label: 'Undo', onPressed: () { // Some code to undo the change! }, ), ); // Find the Scaffold in the Widget tree and use it to show a SnackBar! Scaffold.of(context).showSnackBar(snackBar); }, child: new Text('Show SnackBar'), 12 -
class SnackBarPage extends StatelessWidget { @override Widget build(BuildContext context) {
return new Center( child: new RaisedButton( onPressed: () { final snackBar = new SnackBar( content: new Text('Yay! A SnackBar!'), action: new SnackBarAction( label: 'Undo', onPressed: () { // Some code to undo the change! }, ), ); // Find the Scaffold in the Widget tree and use it to show a SnackBar! Scaffold.of(context).showSnackBar(snackBar); }, child: new Text('Show SnackBar'), 13 -
Networking / Fetch data from the internet Add the http
package to pubspec.yaml dependencies: http: <latest_version> 15 -
appBar: new AppBar( title: new Text('Fetch Data Example'), ), body:
new Center( child: new FutureBuilder<Post>( future: fetchPost(), builder: (context, snapshot) { if (snapshot.hasData) { return new Text(snapshot.data.title); } else if (snapshot.hasError) { return new Text("${snapshot.error}"); } // By default, show a loading spinner return new CircularProgressIndicator(); }, 16 -
appBar: new AppBar( title: new Text('Fetch Data Example'), ), body:
new Center( child: new FutureBuilder<Post>( future: fetchPost(), // original method, return Future<T> instance builder: (context, snapshot) { if (snapshot.hasData) { return new Text(snapshot.data.title); } else if (snapshot.hasError) { return new Text("${snapshot.error}"); } // By default, show a loading spinner return new CircularProgressIndicator(); }, 17 -
appBar: new AppBar( title: new Text('Fetch Data Example'), ), body:
new Center( child: new FutureBuilder<Post>( future: fetchPost(), builder: (context, snapshot) { // lambda if (snapshot.hasData) { return new Text(snapshot.data.title); } else if (snapshot.hasError) { return new Text("${snapshot.error}"); } // By default, show a loading spinner return new CircularProgressIndicator(); }, 18 -
appBar: new AppBar( title: new Text('Fetch Data Example'), ), body:
new Center( child: new FutureBuilder<Post>( // extends StatefulWidget future: fetchPost(), builder: (context, snapshot) { if (snapshot.hasData) { return new Text(snapshot.data.title); } else if (snapshot.hasError) { return new Text("${snapshot.error}"); } // By default, show a loading spinner return new CircularProgressIndicator(); }, 19 -
appBar: new AppBar( title: new Text('Fetch Data Example'), ), body:
new Center( child: new FutureBuilder<Post>( // extends StatefulWidget future: fetchPost(), builder: (context, snapshot) { if (snapshot.hasData) { return new Text(snapshot.data.title); } else if (snapshot.hasError) { return new Text("${snapshot.error}"); } // By default, show a loading spinner return new CircularProgressIndicator(); }, 20 -
·ͱΊ • Flutter ৮Γ࢝Ίʹ Cookbook Λࢀߟʹ͢Δͷ༗ޮ • ͦͷଞʹɺϦετදࣔɺσʔλ ӬଓԽɺը໘ؒͷσʔλड͚ ͠ͳͲͷίʔυ͋Γɺ͋Γ͕
ͪͳ࣮·͋·͋Χόʔ͞Ε ͯͯخ͍͠ • αϯϓϧίʔυͰ Flutter ʹ׳Ε͍ͯ͜͏ ✌ 21