Skip to content

Instantly share code, notes, and snippets.

@FlutterZeroGit
Created August 13, 2022 05:38
Show Gist options
  • Save FlutterZeroGit/d860ae809ffda43be61c67a440e7629d to your computer and use it in GitHub Desktop.
Save FlutterZeroGit/d860ae809ffda43be61c67a440e7629d to your computer and use it in GitHub Desktop.
automaticallyImplyLeading
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