This document shows how to build a basic Flutter app using MaterialApp, Scaffold, AppBar and other widgets. It imports necessary packages and defines a StatelessWidget class with a build method that returns the widget tree.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
12 views
Main Dart
This document shows how to build a basic Flutter app using MaterialApp, Scaffold, AppBar and other widgets. It imports necessary packages and defines a StatelessWidget class with a build method that returns the widget tree.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1
import 'package:flutter/material.
dart';
void main() { runApp(const MyApp()); }
// With Flutter, you create user interfaces by combining "widgets"
// You'll learn all about them (and much more) throughout this course! class MyApp extends StatelessWidget { const MyApp({super.key});
// Every custom widget must have a build() method
// It tells Flutter, which widgets make up your custom widget // Again: You'll learn all about that throughout the course! @override Widget build(BuildContext context) { // Below, a bunch of built-in widgets are used (provided by Flutter) // They will be explained in the next sections // In this course, you will, of course, not just use them a lot but // also learn about many other widgets! return MaterialApp( title: 'Flutter First App', theme: ThemeData(useMaterial3: true), home: Scaffold( appBar: AppBar( title: const Text('Welcome to Flutter'), ), body: Container( width: double.infinity, padding: const EdgeInsets.all(12), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: const [ Text( 'Flutter - The Complete Guide', textAlign: TextAlign.center, style: TextStyle( fontSize: 24, fontWeight: FontWeight.bold, ), ),