Flutter App Example | Flutter Tutorial | For Flutter Developer
Flutter Basic Concept with Example
Before you start writing the actual code let's begin with a basic understanding of the generated code from flutter project π€Step 1: Create the starter Flutter app
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
title: Text('Welcome to Flutter'),
),
body: Center(
child: Text('Hello World'),
),
),
);
}
}
- First-line above code to import the default flutter package which contains the material design.
- `void main()=> runApp(MyApp());` : - The main method is bootstrapper here for running the app, which required a Class (MyApp).
- The MyApp class is StatelessWidget, as I explained the other part in this series in flutter everything mostly considered as a widget. there are two types of widget
- A) Stateless. B) Stateful
- there are few builds in methods for all the widgets & we can override them according to our need
- In build method - it's returning a Material App which is having many default properties like Title, Home, Theme, etc. to support the Material concept.
- home: - require Scaffold and Scaffold can contain many props like appBar(its App Title) etc. Scaffold also requires the main props is "body" its the whole app screen body where you can place the different layout in other work you can drow anything in this canvas.
- the body may contain different widgets according to your need in this example we are having the Center and again Center widget is having Text Widget. and this process goes on with layout builder like in HTML divs.
Upcomming Blogs I will explore the most amazing features of Flutter App development
Happy Fluttering π¨π»π»