1. Flutter 的一些概念
- 有/无状态
- 懒加载
2. 一些特点
Dart
- 函数可以不加返回类型
- 函数参数可以不声明类型
- dart 运算符: ~/ ,取整 ,例:7~/2=3
Flutter
- flutter 会强制根widget铺满整个屏幕
- pubspec.yaml 文件中 flutter 部分有 uses-material-design: true 这条,它能让你使用预置的 Material icons(https://design.google.com/icons/)。
- Flutter 在 Release 下是 AOT 模式。
3. 问答
为啥这里需要const
home: Scaffold(
appBar: AppBar(
title: const Text('fuck flutter'),
),
body: const Center(
child: Text('fuck flutter'),
),
),
extend 后跟的with关键字,dart的继承原理
- SingleTickerProviderStateMixin 类
- 为什么TabBar 的 ‘isScrollable: true’ 会影响tab的长度?
4. 基础界面(UI)
4.1 基础控件/元素
4.1.1 元素
- Text
- string
- textStyle
- RichText 可以单独编辑某个单词的样式
- TextSpan
- TextField 文本框
- TextFromField
- Icon
- IconButton
- FloatingActionButton
- FlatButton(1.22后废弃,改为textbutton)
- PopupMenuButton
- OutlineButton(1.22后废弃,改为OutlinedButtonTheme)
- RaisedButton(1.22后废弃,改为ElevatedButton)
- ButtonBar
- BoxDecoration box装饰
- 圆角 borderRadius (BorderRadius)
- 渐变色背景 gradient (LinearGradient)
- 阴影boxShadow(BoxShadow)
- InputDecoration
- labelText
- labelStyle
- border
- Image (assets/network/原生/cache)
- AssetBundle
�
动画
- AnimatedContainer
- AnimatedCrossFade
- AnimatedOpacity 动画透明度调整
4.1.2 控件
- AppBar
- TabBar
- BottomAppBar
4.2 布局
- Scaffold 包含基本布局,appbar,悬浮按钮,左右页面等
- appBar / bottomNavigatorBar
- Container
- Center
- Column
- SafeArea
- PreferredSize
- PageView
- SingleChildScrollView
4.3 位置
- EdgeInsets.all(16.0)
- Offset
4.4 样式(style)
- Size.fromHeight(75.0)
- Radius.circular(100.0)
- 圆角 borderRadius
- �
5. 要实现的界面功能
- 九宫格输入
- Row + SizedBox 解决
- 点击提交自动聚焦到第一个没有按要求填写的输入框
- C++ 进行文件存储
- C++ 后端
- vue中使用 protobuf
6. 错误记录
error
- The parameter ‘’ can’t have a value of ‘null’ because of its type, but the implicit default value is ‘null’.
新版要求严格,参数要加 ? 或者 required
- Don’t put any logic in createState.
warring
- Prefer declaring const constructors on
@immutable
classes.
7. android studio 开发 flutter 技巧
- alt+enter wrap with new widget