10. New Flutter Project
Step 1 Step 2 Step 3
• Flutter •
• Flutter SDK
•
•
•
Tip: If you don’t see “New Flutter Project” as
an option in your IDE, make sure you have
the plugins installed for Flutter and Dart.
11. import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
// This makes the visual density adapt to the platform that you run
// the app on. For desktop platforms, the controls will be smaller and
// closer together (more dense) than on mobile platforms.
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
15. pubspec.yaml
name: flutter_app
description: A new Flutter application.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
46. The Difference between Navigator & Router
Navigator Stack push pop
// Within the ‘FirstRoute’ widget
onPressed: () {
Navigator.push( context,
MaterialPageRoute(builder: (context) => SecondRoute()),
);
}
// Within the SecondRoute widget
onPressed: () {
Navigator.pop(context);
}
47. // Navigate to the second screen using a named route.
// Usually place in onPressed(){};
Navigator.pushNamed(context, '/second');
// Navigate back to the first screen by popping the current route
// off the stack.
Navigator.pop(context);
Router
The Difference between Navigator & Router (cont.)
48. Do we need to explain our workflow through flowcharts?
Workflow
52. API
Keyword:
● http (flutter package)
● JSON (data transfer format)
● Serialization (data process)
● Future (dart data type)
● async (dart keyword)
● FutureBuilder (flutter widget)
Fetch data from the internet:
https://flutter.dev/docs/cookbook/networki
ng/fetch-data
53. For more info about Flutter, head on over to flutter.dev
Resources
54. Resources
Flutter Official Documentation
● https://flutter.dev/docs
Flutter YouTube Channel
● Widget of the Week
● Flutter in Focus
Online Tutorials
● Udacity
● The App Brewery
The Speaker
Yes, it’s me. Feel free to ask me if you
have any problem on your way to learn
Flutter.
DSC Core Team
We’re here to help you. Contact us by
email, Facebook, or Discord.