Created
September 1, 2021 07:26
-
-
Save om-chauhan/470e6f42fc8c8333e74e6b265876391e 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
// First Screen | |
import 'package:flutter/material.dart'; | |
import 'package:garment_ecommerce/secon_screen.dart'; | |
class FirstScreen extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: TextButton( | |
onPressed: () { | |
Navigator.push( | |
context, | |
MaterialPageRoute( | |
builder: (context) => SecondScreen( | |
userName: 'UserName', | |
), | |
), | |
); | |
}, | |
child: Text('Second Screen'), | |
), | |
); | |
} | |
} | |
// | |
Second Screen | |
import 'package:flutter/material.dart'; | |
class SecondScreen extends StatelessWidget { | |
final String userName; | |
const SecondScreen({Key key, this.userName}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: Text(userName), | |
), | |
); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment