Flutter for a very beginner

2022/08/30閱讀時間約 4 分鐘

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.
為什麼會看到廣告
張哲嘉
張哲嘉
I'm a full-stack engineer in Senao Networks. Vue/Django/MongoDB/Nginx
留言0
查看全部
發表第一個留言支持創作者!