-
-
Save mmanflori/27653948d9dd6a79fa14a6f51a31285d to your computer and use it in GitHub Desktop.
Basic Routing
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'; | |
class DritteSeite extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: MeinInhalt3(), | |
); | |
} | |
} | |
class MeinInhalt3 extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Container( | |
child: Text( | |
"Dritte Seite", | |
style: TextStyle( | |
fontSize:30.0, | |
) | |
), | |
), | |
RaisedButton( | |
child: Text("Zurück"), | |
onPressed: () { | |
Navigator.pop(context); | |
}, | |
), | |
], | |
) | |
], | |
); | |
} | |
} |
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:container_videotut/zweite_seite.dart'; | |
import 'package:flutter/material.dart'; | |
class HomeSeite extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: MeinInhalt1(), | |
); | |
} | |
} | |
class MeinInhalt1 extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Container( | |
color: Theme.of(context).primaryColorLight, | |
child: Text( | |
"Homepage", | |
style: TextStyle( | |
fontSize:30.0, | |
) | |
), | |
), | |
RaisedButton( | |
child: Text("Zweite Seite"), | |
onPressed: () { | |
Route route = MaterialPageRoute(builder: (context)=>ZweiteSeite()); | |
Navigator.push(context, route); | |
}, | |
), | |
RaisedButton( | |
child: Text("Dritte Seite"), | |
onPressed: () { | |
Navigator.pushNamed(context, "/DritteSeite"); | |
}, | |
), | |
RaisedButton( | |
child: Text("Vierte Seite"), | |
onPressed: () { | |
Navigator.pushNamed(context, "/VierteSeite"); | |
}, | |
), | |
], | |
) | |
], | |
); | |
} | |
} |
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:container_videotut/vierte_seite.dart'; | |
import 'package:container_videotut/zweite_seite.dart'; | |
import 'package:flutter/material.dart'; | |
import 'dritte_seite.dart'; | |
import 'home_seite.dart'; | |
void main()=> runApp(MeineApp()); | |
class MeineApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
routes: { | |
"/":(BuildContext context) => HomeSeite(), | |
"/DritteSeite":(BuildContext context) => DritteSeite(), | |
"/VierteSeite":(BuildContext context) => VierteSeite(), | |
}, | |
); | |
} | |
} |
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'; | |
class VierteSeite extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: MeinInhalt4(), | |
); | |
} | |
} | |
class MeinInhalt4 extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Container( | |
child: Text( | |
"Vierte Seite", | |
style: TextStyle( | |
fontSize:30.0, | |
) | |
), | |
), | |
RaisedButton( | |
child: Text("Zurück"), | |
onPressed: () { | |
Navigator.pop(context); | |
}, | |
), | |
], | |
), | |
], | |
); | |
} | |
} |
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'; | |
class ZweiteSeite extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: MeinInhalt2(), | |
); | |
} | |
} | |
class MeinInhalt2 extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Container( | |
child: Text( | |
"Zweite Seite", | |
style: TextStyle( | |
fontSize:30.0, | |
) | |
), | |
), | |
RaisedButton( | |
child: Text("Zurück"), | |
onPressed: () { | |
Navigator.pop(context); | |
}, | |
), | |
], | |
) | |
], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment