-
-
Save mmanflori/2beaa8a509f373cae85696cf109f9b44 to your computer and use it in GitHub Desktop.
Drawer Example
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 'ZweiterBildschirm.dart'; | |
class Hauptbildschirm extends StatelessWidget { | |
GlobalKey<ScaffoldState>_scaffoldKey = new GlobalKey(); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
key: _scaffoldKey, | |
appBar: AppBar( | |
leading: IconButton(icon: Icon(Icons.menu), onPressed: () { | |
_scaffoldKey.currentState.openDrawer(); | |
}), | |
title: Text("Hauptbildschirm"), | |
actions: <Widget>[ | |
IconButton(icon: Icon(Icons.search), onPressed: () {}), | |
], | |
), | |
body: Center( | |
child: RaisedButton( | |
child: Text( | |
"Nächster Bildschirm", | |
style: TextStyle( | |
color: Colors.white, | |
), | |
), | |
color: Colors.green, | |
onPressed: () { | |
Navigator.push( | |
context, | |
MaterialPageRoute(builder: (context) => ZweiterBildschirm()), | |
); | |
}, | |
), | |
), | |
drawer: Drawer( | |
child: ListView( | |
padding: EdgeInsets.zero, | |
children: <Widget>[ | |
DrawerHeader( | |
child: Text("Willkommen zurück", | |
style: TextStyle( | |
color:Colors.white, | |
) | |
), | |
decoration: BoxDecoration( | |
color: Colors.orange, | |
), | |
), | |
ListTile( | |
title: Text( | |
"Menu 1" | |
), | |
onTap: (){ | |
Navigator.pop(context); | |
}, | |
), | |
ListTile( | |
title: Text( | |
"Menu 2" | |
), | |
onTap: (){ | |
Navigator.pop(context); | |
}, | |
), | |
ListTile( | |
title: Text( | |
"Menu 3" | |
), | |
onTap: (){ | |
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'; | |
import 'hauptbildschirm.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
title: 'Flutter Demo', | |
theme: ThemeData( | |
canvasColor: Colors.white, | |
primarySwatch: Colors.green, | |
), | |
home: Hauptbildschirm(), | |
); | |
} | |
} |
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 ZweiterBildschirm extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title:Text("Zweiter Bildschirm"), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment