Flutter 1
Flutter 1
Basic Flutter
Lamis Khaled Fouad
[email protected]
How to create a Flutter app
Method 1:
1. Open Vscode
2. Ctrl + shift +P
3. Choose Flutter : New Project
4. Choose Application
5. Choose your folder to create your project
6. Name your new flutter app
Ctrl+Shift+P :
Choose Application :
Name your new flutter app:
How to create a Flutter app
Method 2:
1. Open the folder you want to create your project into
2. In the path section write cmd
3. Write in the cmd [ flutter create project_name ]
Write in the cmd [ flutter create project_name ]:
What is Widgets ?
Widgets are the central class hierarchy in the Flutter
framework. A widget is an immutable description of part
of a user interface.
MaterialApp Widgets
First widgets in your applications
A convenience widget that wraps a number of widgets
that are commonly required for Material Design
applications.
import 'package:flutter/material.dart';
@override
Widget build(BuildContext context) {
return MaterialApp(
);
}
}
Importent wodgets to know:
• Scaffold
• Center
• Container
• Column
• Row
• CircleAvatar
• Image
• Icon
• Divider
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("Page 1"),
),
body: Center(child: Text("Hello world"),),
),
);
}
}
Container Widget
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("Page 1"),
),
body: Container(
height: 150,
width: 150,
child: Text("Hello World"),
color: Colors.brown,
),
),
);
}
Column widget