implement-material-design

Flutter Tutorial Series #2: In this article, we’re going to implement the material design with your flutter app.

Since we don’t have any state for our current project. we need to create a StatelessWidget, which returns widgets of MaterialApp() also Scaffold(), AppBar(), Container()

class FirstApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: new Scaffold(
      appBar: new AppBar( title: new Text('My First Flutter App'),),
      body: new Container(
        child: new Text('Hello World'),
      ),
    ),);
  }
}

then, we’re calling FirstApp() inside runApp()

void main() => runApp(new FirstApp());

Final Source code (main.dart)

import 'package:flutter/material.dart';

void main() => runApp(new FirstApp());

class FirstApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: new Scaffold(
      appBar: new AppBar( title: new Text('My First Flutter App'),),
      body: new Container(
        child: new Text('Hello World'),
      ),
    ),);
  }
}
Sundaravel M

About the author: Hey! It's me sundar. (Yea, I'm the founder of codesundar.com). I'm a passionate computer programmer who loves modern web and mobile development. feel free to reach me : Facebook - Twitter - Google+