0% found this document useful (0 votes)
48 views1 page

Navigation Screen

Uploaded by

haftu gidey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views1 page

Navigation Screen

Uploaded by

haftu gidey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import 'package:flutter/material.

dart';
void main()=> runApp(MyApp());
class MyApp extends StatelessWidget{
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: "flutter demo",
theme: ThemeData(primarySwatch: Colors.blue),
home: HomeScreen(),
);
}
}
class HomeScreen extends StatelessWidget{
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Home Screen"),
),
body: RaisedButton(
child: Text("Navigate",
style: TextStyle(fontSize: 24.0),
textAlign: TextAlign.center,),
onPressed: (){
_navigateToNextScreen(context);
},
),
);
}
void _navigateToNextScreen(BuildContext context){
Navigator.of(context).push(MaterialPageRoute(builder: (context)
=>NewScreen()));
}
}
class NewScreen extends StatelessWidget{
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("New Screen"),
),
body: Center(
child: Text("This is new screen",style: TextStyle(fontSize: 24.0),),
),
);
}
}

You might also like