Navigate to a new screen in Flutter
Navigate to a new screen: Navigator.of(context).push(MaterialPageRoute(builder: (context) => NewScreen())); where context is the BuildContext of a widget and NewScreen is the name of the second widget layout. Code main.dart import ‘package:flutter/material.dart’; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: ‘Flutter Demo’, theme: ThemeData(primarySwatch: Colors.blue), home: HomeScreen(), … Read more