Introduction
Flutter is a powerful framework for developing the app for different platforms without redevelopment.
Although I still want to use Vue and Django as the main skill in my full-stack career, I think it’s a good idea to learn Flutter as my secondary skill due to the main idea of Flutter being quite attractive.
Set up for windows desktop app development
To concentrate learn Flutter, I convinced my team to develop a windows desktop app. Therefore, I can learn Flutter at work.
The set-up is quite simple, just follow the “Get started” of the
document.
main.dart
main.dart is the entry point of your app, which is located at your-project/lib.
material is the default UI component library for Flutter. Basically, we would
import ‘package:flutter/material.dart’; in every dart file.
The runApp in main() is to decide how to run this app. We create MyApp for example. We should return a MaterialApp in it to create an app.
route
routing map
Let’s add the routing settings for this app.
Add routes in MaterialApp , and define the URL to which page. I prefer to write the different pages in each dart file. For example, I define the HomePage() in home.dart and import it from above. Then set the URL for it in routes .
initialRoute is which page would show when this app is opened.
pushNamed
In home.dart
we could use Navigator.pushNamed to go to another URL.
MaterialAPP & Scaffold
To build an app, we need to build a MaterialAPP . To write a page, we need to write it in a Scaffold .
That’s what I learn so far. Maybe what I write above is not perfect, but I think it’s still useful for a beginner.