Basic Flutter Assignment
Basic Flutter Assignment
Training Assignments
R2S Academy Flutter Internal Use
In this practice, you will learn how to create a Simple Hello World Fuller application.
Tasks
1. Open Android Studio and select Select Flutter, verify the Flutter SDK path with the SDK’s
location. Then click Next.
2. Enter a project name (for example, myapp). Select Application as the project type. Then
click Finish.
4. Open the main.dart file and modify the given code below:
1. import 'my_app.dart';
2.
3. void main() {
4. runApp(const MyApp());
5. }
Type MyApp
- In the target selector, select an Android device for running the app. If none are listed as available,
select Tools > AVD Manager and create one there.
In this practice, you will learn about Flutter platform specific widgets.
Tasks
1. Open the Android Studio, navigate to the project folder and create file named
pavlova_recipe.dart
+ Create an images directory at the top of the project and add pavlova.jpeg
+ Update the pubspec.yaml file to include an assets tag. This makes the image available to your
code.
Building layouts
Overview
Tasks
In this step, you'll start using an open-source package named english_words, which contains a few
thousand of the most-used English words, plus some utility functions.
+ english_words: ^4.0.0
+ In lib/startup_namer.dart, start typing stful, the editor asks if you want to create a Stateful widget.
Press Return to accept. The boilerplate code for two classes appears, and the cursor is positioned
for you to enter the name of your stateful widget. Enter RandomWords as the name of your
widget. As you can see in the code below
Tasks
1. Get the starting app
+ Open the Android Studio and add the english_words package as a dependency of this app:
english_words: ^4.0.0
2. Write code
+ Delete all of the code from lib/startup_namer.dart. Replace it with the follow code
The building layouts tutorial showed you how to create the layout for the following screenshot.
When the app first launches, the star is solid red, indicating that this lake has previously been
favorited. The number next to the star indicates that 41 people have favorited this lake. After
completing this tutorial, tapping the star removes its favorited status, replacing the solid star with an
outline and decreasing the count. Tapping again favorites the lake, drawing a solid star and
increasing the count.
Tasks
2. Subclass State
+ The class also defines a build() method, which creates a row containing a red IconButton,
and Text. You use IconButton (instead of Icon) because it has an onPressed property that defines
the callback function (_toggleFavorite) for handling a tap.
Extra tasks
Tips:
Tips
+ In the lib folder, add a new Flutter Widget file named items_screen.dart
+ The project structure:
Database Structure
You are going to create an SQLite database called news.db. It has only a single table
named account. Below is the structure of the table:
password TEXT
email TEXT
--THE END—