You can nudge your life in a new direction every day.

Flutter: Use the Material App widget

Submitted by admin on Mon, 09/21/2020 - 15:54
import 'package:flutter/material.dart';

void main() => runApp(

class MyApp extends StatelessWidget {

  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Home')
        body: Text('Body'),

The function runApp requires you pass it an object of type Widget to render the screen.

The MaterialApp class provides a widget with some built in functionality. If we look at the constructor of MaterialApp what named parameters we can pass. 

  • home takes a Widget
  • routes take a map of Strings and Widgets
  • title takes a strong.

Scaffold creates a visual scaffold for material design widgets. It provides a framework of common elements found in mobile applications like AppBarBottomAppBarFloatingActionButtonBottomSheetDrawerSnackbar.