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
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
visualDensity: VisualDensity.adaptivePlatformDensity, | |
), | |
home: MyHomePage(title: 'Flutter Demo Home Page'), | |
); | |
} | |
} | |
class MyHomePage extends StatefulWidget { | |
MyHomePage({Key key, this.title}) : super(key: key); | |
final String title; | |
@override | |
_MyHomePageState createState() => _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
drawer: new Drawer( | |
child: new ListView( | |
padding: EdgeInsets.zero, | |
children: <Widget>[ | |
new DrawerHeader( | |
child: new Text("Header"), | |
decoration: new BoxDecoration(color: Colors.blue), | |
), | |
new ListTile( | |
title: new Text("Item 1"), | |
onTap: () { | |
Navigator.pop(context); | |
}, | |
), | |
new ListTile( | |
title: new Text("Item 2"), | |
onTap: () { | |
Navigator.pop(context); | |
}, | |
) | |
], | |
), | |
), | |
appBar: AppBar( | |
title: Text(widget.title), | |
), | |
body: Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Text( | |
'Hello World!', | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.