Skip to content

Instantly share code, notes, and snippets.

@Pinaki93
Created May 9, 2021 12:48
Show Gist options
  • Save Pinaki93/9b3dc362145cfef589feff96c4c52ffb to your computer and use it in GitHub Desktop.
Save Pinaki93/9b3dc362145cfef589feff96c4c52ffb to your computer and use it in GitHub Desktop.
Basic Flutter Hello World example
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