Skip to content

Instantly share code, notes, and snippets.

@lbarqueira
Last active February 8, 2021 10:16
Show Gist options
  • Save lbarqueira/dc9a28ed4e4c448b2699ce4dd5e9458d to your computer and use it in GitHub Desktop.
Save lbarqueira/dc9a28ed4e4c448b2699ce4dd5e9458d to your computer and use it in GitHub Desktop.
Using Material Components - https://flutter.dev/docs/development/ui/widgets-intro#using-material-components - Flutter provides a number of widgets that help you build apps that follow Material Design. A Material app starts with the MaterialApp widget, which builds a number of useful widgets at the root of your app.
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Tutorial',
home: TutorialHome(),
),
);
}
class TutorialHome extends StatelessWidget {
@override
Widget build(BuildContext context) {
// Scaffold is a layout for the major Material Components.
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.menu),
tooltip: 'Navigation menu',
onPressed: null,
),
title: Text('Example title'),
actions: <Widget>[
IconButton(
icon: Icon(Icons.search),
tooltip: 'Search',
onPressed: null,
),
],
),
// body is the majority of the screen.
body: Center(
child: Text('Hello, world!'),
),
floatingActionButton: FloatingActionButton(
tooltip: 'Add', // used by assistive technologies
child: Icon(Icons.add),
onPressed: null,
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment