Created
August 13, 2022 05:38
-
-
Save FlutterZeroGit/d860ae809ffda43be61c67a440e7629d to your computer and use it in GitHub Desktop.
automaticallyImplyLeading
This file contains 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(home: Screen1())); | |
class Screen1 extends StatelessWidget { | |
const Screen1({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Screen1'), | |
automaticallyImplyLeading: false, | |
), | |
body: Center( | |
child: ElevatedButton( | |
child: Text('Screen2'), | |
onPressed: () { | |
Navigator.push( | |
context, | |
MaterialPageRoute( | |
builder: (context) => const Screen2(), | |
), | |
); | |
}, | |
), | |
), | |
); | |
} | |
} | |
class Screen2 extends StatelessWidget { | |
const Screen2({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: const Text('Screen2'), | |
automaticallyImplyLeading: false, | |
), | |
body: Center( | |
child: ElevatedButton( | |
onPressed: () { | |
Navigator.pop(context); | |
}, | |
child: const Text('Screen1'), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment