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: Scaffold(
      appBar: AppBar( title: Text('My First Flutter App'),),
      body: Container(
        child: Text('Hello World'),
      ),
    ),);
  }
}

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

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

Final Source code (main.dart)

import 'package:flutter/material.dart';

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

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

About the author: Hi! I'm Sundaravel (codesundar), Founder of codesundar.com. I have been a Web, Mobile App developer, Author, and Teacher since 2014. I also worked as a software consultant for fortune 500 companies. I created codesundar.com to share my real-time knowledge in various technologies such as PhoneGap, Ionic, Flutter and more.