|
|
(同じ利用者による、間の11版が非表示) |
行1: |
行1: |
− | ==画面遷移サンプル==
| + | [[flutter/画面遷移/基本]] |
− | ==その1==
| + | |
− | routerをMyAppの中に追加
| + | |
− | <pre>
| + | |
− | class MyApp extends StatelessWidget {
| + | |
− | @override
| + | |
− | Widget build(BuildContext context) {
| + | |
− | return MaterialApp(
| + | |
− | title: 'Flutter Demo',
| + | |
− | theme: ThemeData(
| + | |
− | primarySwatch: Colors.blue,
| + | |
− | ),
| + | |
− | home: MyHomePage(title: 'Flutter Demo Home Page'),
| + | |
− | routes: <String, WidgetBuilder> {
| + | |
− | '/help': (BuildContext context) => new MyHomePage(title: 'page help'),
| + | |
− | '/privacy': (BuildContext context) => new MyHomePage(title: 'page privacy'),
| + | |
− | '/use': (BuildContext context) => new MyHomePage(title: 'page use'),
| + | |
− | },
| + | |
− | );
| + | |
− | }
| + | |
− | }
| + | |
− | </pre>
| + | |
| | | |
− | 画面遷移 | + | [[flutter/画面遷移/応用]] |
− | Navigator.of(context).pushNamed('/use');
| + | |
| | | |
− | ==その2==
| + | [[flutter/画面遷移/画面遷移イベント検知]] |
− | router&画面遷移
| + | |
− | <pre>
| + | |
− | Navigator.push(context, new MaterialPageRoute<Null>(
| + | |
− | settings: const RouteSettings(name: "/use"),
| + | |
− | builder: (BuildContext context) => MyHomePage(title: 'page use')
| + | |
− | ));
| + | |
− | </pre>
| + | |
− | | + | |
− | ==参考==
| + | |
− | https://qiita.com/tatsu/items/38cd85efd93005b95af9
| + | |