0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Flutterで画面遷移を実装する

0
Posted at

実装するごとに追加していきます

ルーティングで遷移する

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      initialRoute: "/",
      routes: {
        "/": (context) => BasePage(),
        "/login": (context) => LoginPage(),
      },
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
    );
  }
}
class BasePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return RaisedButton(child: Text("Show Login"), onPressed: () async {
//      await Navigator.pushReplacementNamed(context, "/login");
      await Navigator.pushNamed(context, "/login");
// pop時の処理
      print("logined!");
    },);
  }

}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?