Skip to content

Instantly share code, notes, and snippets.

@branflake2267
Last active March 24, 2019 13:31
Show Gist options
  • Save branflake2267/3a27c6597bf8e1819228178b924f433c to your computer and use it in GitHub Desktop.
Save branflake2267/3a27c6597bf8e1819228178b924f433c to your computer and use it in GitHub Desktop.
Flutter - Basic Routing to Pages YouTube source code - This is the IntelliJ IDEA live template for a stateful widget for a page.
class $NAME$ extends StatefulWidget {
$NAME$({Key key, this.title}) : super(key: key);
static const String routeName = "/$NAME$";
final String title;
@override
_$NAME$State createState() => new _$NAME$State();
}
/// // 1. After the page has been created, register it with the app routes
/// routes: <String, WidgetBuilder>{
/// $NAME$.routeName: (BuildContext context) => new $NAME$(title: "$NAME$"),
/// },
///
/// // 2. Then this could be used to navigate to the page.
/// Navigator.pushNamed(context, $NAME$.routeName);
///
class _$NAME$State extends State<$NAME$> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: new Container($END$),
floatingActionButton: new FloatingActionButton(
onPressed: _onFloatingActionButtonPressed,
tooltip: 'Add',
child: new Icon(Icons.add),
),
);
}
void _onFloatingActionButtonPressed() {
}
}
@branflake2267
Copy link
Author

branflake2267 commented Apr 21, 2017

This live template is used in this video:

https://www.youtube.com/watch?v=Me7n92nH6FY&index=13&list=PLBbgqtDgdc_RUWUCInIqxpY--C94C6Xjh - YouTube Episode

screen shot 2017-05-01 at 7 44 28 am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment