Last active
March 24, 2019 13:31
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This live template is used in this video:
https://www.youtube.com/watch?v=Me7n92nH6FY&index=13&list=PLBbgqtDgdc_RUWUCInIqxpY--C94C6Xjh - YouTube Episode