Created
May 9, 2021 12:48
-
-
Save Pinaki93/9b3dc362145cfef589feff96c4c52ffb to your computer and use it in GitHub Desktop.
Basic Flutter Hello World 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'; | |
void main() => runApp( | |
MaterialApp(title: 'Test App', home: SafeArea(child: ScaffoldDemo()))); | |
class ScaffoldDemo extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Material( | |
child: Column(children: <Widget>[ | |
AppBarDemo( | |
title: Text('Scaffold Demo', | |
style: Theme.of(context).textTheme.headline6)), | |
Expanded(child: Center(child: Text('Hello world!'))) | |
])); | |
} | |
} | |
class AppBarDemo extends StatelessWidget { | |
AppBarDemo({required this.title}); | |
final Widget title; | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
height: 56.0, | |
padding: const EdgeInsets.symmetric(horizontal: 8.0), | |
decoration: BoxDecoration(color: Colors.blue[500]), | |
child: Row( | |
children: <Widget>[ | |
IconButton( | |
icon: Icon(Icons.menu), tooltip: 'Nav Icon', onPressed: null), | |
Expanded(child: title), | |
IconButton( | |
icon: Icon(Icons.search), tooltip: 'Search', onPressed: null) | |
], | |
)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment