Last active
November 11, 2022 01:04
-
-
Save dnfield/96075efc997ccc9b14396728906de3ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp( | |
MaterialApp( | |
theme: ThemeData( | |
pageTransitionsTheme: const PageTransitionsTheme(builders: { | |
TargetPlatform.android: CupertinoPageTransitionsBuilder(), | |
TargetPlatform.windows: CupertinoPageTransitionsBuilder(), | |
TargetPlatform.macOS: CupertinoPageTransitionsBuilder(), | |
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), | |
TargetPlatform.linux: CupertinoPageTransitionsBuilder(), | |
}), | |
), | |
routes: <String, WidgetBuilder>{ | |
'/': (context) => Scaffold( | |
appBar: AppBar(), | |
body: const Center( | |
child: Text('Page 1'), | |
), | |
drawer: Drawer( | |
backgroundColor: Colors.red, | |
child: ListView( | |
children: <Widget>[ | |
TextButton( | |
child: const Text('Nav home'), | |
onPressed: () {}, | |
), | |
TextButton( | |
child: const Text('Nav to Page 2'), | |
onPressed: () { | |
Navigator.of(context).pushNamed('/2'); | |
}, | |
), | |
], | |
), | |
), | |
), | |
'/2': (context) => Scaffold( | |
appBar: AppBar(), | |
body: const Center( | |
child: Text('Page 2'), | |
), | |
drawer: Drawer( | |
backgroundColor: Colors.red, | |
child: ListView( | |
children: <Widget>[ | |
TextButton( | |
child: const Text('Nav home'), | |
onPressed: () async { | |
Navigator.of(context).pop(); | |
Navigator.of(context).pop(); | |
}, | |
), | |
TextButton( | |
child: const Text('Nav to Page 2'), | |
onPressed: () {}, | |
), | |
], | |
), | |
), | |
), | |
}, | |
), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment