# 01.初见Flutter

### 一、 Flutter的特点

* 不依赖原生UI
  * 拥有独立的渲染引擎
  * 包体积会变大
* 界面更新逻辑和原生不一样（`增量渲染`）
  * 重新创建一个新的 `Widget`
* 为什么 `Flutter` 中大量 `final` 修饰的属性， `const` 修饰的构造方法（`常量对象`）
  * 因为 `Flutter` 的渲染逻辑，是`增量渲染`。 `Widget` 结构是`树状结构`
  * 想改变屏幕内容就直接改变 `Widget` 对象
  * `常量对象` 的创建效率更高

### 二、 万物皆 Widget

* Flutter的Widget分两类
  * 有状态： StatefulWidget
  * 无状态： StatelessWidget

### 三、 MaterialApp（App素材

* home属性（主页面）
  * 需要一个Widget
  * Scaffold小部件
    * 带有导航栏（appBar）的小部件
    * 导航栏可以设置文字、颜色。而且可以自定义Widget
  * body属性。
    * 显示在导航栏下面的区域。传递一个Widget给他
* debugShowCheckedModeBanner属性。
  * 是否显示Debug标记（便于我们在调试版本中做操作）

### 小Tips

#### 1. 未导入相关文件

`option` + `enter` 即可快捷导入

#### 2. 强退AS缓存的问题

清理下面的文件即可

![1](/files/WHCn3HsdaMM2E9lqAbxm)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ryukiedev.gitbook.io/wiki/flutter/01.-chu-jian-flutter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
