Skip to content

Instantly share code, notes, and snippets.

@rubywai
Created May 10, 2023 11:19
Show Gist options
  • Save rubywai/0b720c420847b5f752da926773638d54 to your computer and use it in GitHub Desktop.
Save rubywai/0b720c420847b5f752da926773638d54 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:flutter_ui_lesson/screens/third_screen.dart';
class SecondScreen extends StatelessWidget {
const SecondScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Second Screen'),),
body: Center(
child: Column(
children: [
ElevatedButton(
child: const Text('Go to Third screen'),
onPressed: (){
Navigator.push(context,
MaterialPageRoute(builder: (_) => const ThirdScreen()));
},
),
ElevatedButton(
child: const Text('Go back first screen'),
onPressed: (){
Navigator.pop(context);
},
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment