コンテンツにスキップ

flutter ページ遷移#

createPageRoute()を用意

import 'package:flutter/material.dart';

class SamplePage extends StatelessWidget {
  const SamplePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: const Text('Sample')),
        body: const SizedBox());
  }

  static PageRoute createPageRoute() {
    return MaterialPageRoute(builder: (context) {
      return const SamplePage();
    });
  }
}

を用意して
Navigator.of(context).push(SamplePage.createPageRoute());

を実行


References#

Tags#

  • #flutter