Skip to content

Instantly share code, notes, and snippets.

@adityadroid
Created August 12, 2019 16:23
Show Gist options
  • Save adityadroid/20774dee5a549cbc249d79bdb9b2e6a4 to your computer and use it in GitHub Desktop.
Save adityadroid/20774dee5a549cbc249d79bdb9b2e6a4 to your computer and use it in GitHub Desktop.
cleaning up the main.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Messio',
theme: ThemeData(
primarySwatch: Colors.yellow,
),
home: MyHomePage(title: 'Messio'),
);
}
}
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) {
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
child:Text('Hello World!')
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment