Last active
May 10, 2023 11:21
-
-
Save rubywai/b36615c2c417160110698c26fa185c34 to your computer and use it in GitHub Desktop.
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'; | |
import 'package:flutter_ui_lesson/screens/first_screen.dart'; | |
class ThirdScreen extends StatelessWidget { | |
const ThirdScreen({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar(title: const Text('Third Screen'),), | |
body: Center( | |
child: Column( | |
children: [ | |
ElevatedButton( | |
child: const Text('Go back second screen'), | |
onPressed: (){ | |
Navigator.pop(context); | |
}, | |
), | |
ElevatedButton( | |
child: const Text('Go back first screen'), | |
onPressed: (){ | |
Navigator.pushAndRemoveUntil(context,MaterialPageRoute(builder: (_) => const FirstScreen()), (route) => false); | |
}, | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment