I've successfully navigated to a class in a new file, but now I'm not getting a backbutton on my appBar. Here is my navigation from main.dart...
new RaisedButton(
onPressed: () {
Navigator.pushNamed(context, '/searchpage');
},
and here is my SearchPage appBar..
class SearchPageState extends State<SearchPage> {
@override
Widget build(BuildContext context) {
return new MaterialApp(
routes: <String, WidgetBuilder>{
'/loginpage': (BuildContext context) => new Login.LoginPage(),
'/mainpage': (BuildContext context) => new Main.MyApp(),
},
home: new Scaffold(
appBar: new AppBar(
title: new Text(
"Search",
style: new TextStyle(fontWeight: FontWeight.bold),
),
),
You should only have one
MaterialAppat the root of your app. EachMaterialAppcreates its ownNavigator, and the existence of multiple routes on the navigation stack is what causes the implicit back button to appear in theleadingslot of theAppBar.