🚎 Navigation

Screen routing with a navigation stack

Example Code

file_type_dartlang main.dart
class MyApp extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
   return MaterialApp(

    
     routes: {
       '/home': (context) => HomeScreen(),
       '/slideshow': (context) => SlideshowScreen()
     },

     home: HomeScreen(),
   );
 }
}

class HomeScreen extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
   return Scaffold(
     appBar: AppBar(title: Text('Home'), backgroundColor: Colors.red,),
     body: Center(
       child: Row(
         mainAxisAlignment: MainAxisAlignment.center,
         children: <Widget>[
           FlatButton(child: Text('push'), color: Colors.green, onPressed: () {

             // Navigator.push(
             //   context,
             //   MaterialPageRoute(builder: (context) => SlideshowScreen(name: 'Jeff'))
             // );


           //  Navigator.pushNamed(
           //     context,
           //     '/slideshow'
           //   );

             Navigator.pushNamed(
               context,
               '/slideshow'
             );

           },),

         ],
       ),
     ),
   );
 }
}

Questions? Let's chat

Open Discord