0% found this document useful (0 votes)
19 views7 pages

Lect 2

Uploaded by

mohammedrobid99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views7 pages

Lect 2

Uploaded by

mohammedrobid99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Mobile application

Flutter
lect2

T\ Sondos Saif
Important command

• flutter doctor
It used to check flutter and its dependcies
• emulator –avd [emulator_name]
It used to run the emulator you already created
• flutter run
It used to run the app you develop on the emulator, to make this command
work you have to go to the directory of the app and then run this command.

2
File Structur
• After creating the flutter project, you will see the following folders:
• android/ and ios/: These folders contain platform-specific code for each OS and
they’re automatically managed by the IDE and the compiler.
• lib/: This folder is essential: it contains the Dart source code of your Flutter app.
You’re going to spend a countless amount of hours in here.
• test/: Unit tests, widget tests and integration tests all go in this folder.
• pubspec.yaml: This file is fundamental as it defines a Dart package and lists
dependencies of your Flutter app.
• README.md: It’s the typical markdown file you can find in any git repository. It’s
used for your git repository and at the same time as "home page" at
https://pub.dev in case you wanted to publish a package.
3
File Structur
• YAML is a data-serialization language commonly used for configuration files. It exposes a series of settings
in a human-readable way; it has no punctuation as it relies on indentation and line breaks.
• version. Any package is required to specify a version number which increments at any release.
• sdk. This section contains the constraints indicating which SDK versions your app supports. The Dart team
recommends to always include a lower and an upper bound but you could simply use ">= 2.7" and it’d be
valid anyway.
• uses-material-design. Ensures that your Flutter app is able to use icons from the Google Material design 3
project. They are pretty common in the Google world, especially in Android as they’re the default icons
being used in many apps.
• dependencies. This is probably the most important label because it declares any package the app is going
to depend on. You just need to go to https://pub.dev, look for a package and add a new line.
dependencies:
flutter:
sdk: flutter
http: ^0.12.2 4

provider: ^4.3.2+2
flutter_svg: ^0.18.1
Hot reload

• It is the same as refreshing a browser in an HTML developing, if we make


changes then we press hot reload it will take a seconds from us to reload.
• It can be used in any changes except for:
• when you make changes to the initState() method .
• when you change the definition of a class into an enum and vice versa,
• when you make changes to static fields in classes,
• when you make changes to code inside void main() {}

5
Widgets

• Everything that appears on the screen is called "widget" because,


technically speaking, it’s a descendant of the Widget class. When you create
user interfaces in Flutter you make a composition of widgets by nesting
them one inside the other.
• Buttons, text fields, animations, containers and even the UI page itself.
Anything appearing on the screen or interacting with it is a widget. Widgets
everywhere!
• When you nest widgets one inside the other you create a hierarchy called
"widget tree" in which there are parents and children.
6
Widgets
• Stateful vs Stateless Vs State
A stateless widget never changes. Icon, IconButton, and Text are examples of stateless
widgets. Stateless widgets subclass StatelessWidget.
 A stateful widget is dynamic: for example, it can change its appearance in response to
events triggered by user interactions or when it receives data. Checkbox, Radio, Slider,
InkWell, Form, and TextField are examples of stateful widgets. Stateful widgets
subclass StatefulWidget. It needs state towork.

You might also like