
flutter
文章平均质量分 82
Litwak
- 为 未 来 实 现 你 想 要 的 改 变 -
展开
-
2021年 Flutter 展望
Null safety Flutter 将支持 Dart 的 sound null safety(空安全),并将插件和软件包生态系统的迁移扩展到支持空安全,包括Flutter团队直接维护的软件包和插件。 在此过程中,Flutter 团队计划提供迁移工具,示例和文档,以帮助迁移现有代码。 Null safety 已经发布了 beta 版本,2021年将会迁移到稳定版本,此特性有效的避免了空指针异常,kotlin 和 swift 中都包含此特性,如果以前接触过,基本没有学习成本。 Androi...翻译 2021-02-07 19:56:52 · 1175 阅读 · 0 评论 -
How to Combine Lists in Dart? dart里合并list
Using addAll() method to add all the elements of other lists to the existing list main() { // Creating lists List gfg1 = ['Welcome','to']; List gfg2 = ['GeeksForGeeks']; // Combining lists gfg1.addAll(gfg2); // Printing c转载 2020-10-28 12:04:52 · 337 阅读 · 0 评论 -
Uncaught Error: Cannot hit test a render box that has never been laid out
问题是你把ListView放在一个Column/Row里面。异常中的文本很好地解释了错误。 为了避免错误,你需要提供一个有大小的组件包起ListView。 我建议你使用Expanded组件,来告知水平/垂直大小(最大可用)和SizedBox组件(可以是一个容器)。 错误代码示例一 class ListFormState extends State<ListForm> { List<String> products = ["Test1", "Test2", "T.原创 2020-10-27 11:06:24 · 3931 阅读 · 0 评论 -
flutter: NoSuchMethodError:the method ‘-‘ was called on null
写了个Tween<Color> 报错:NoSuchMethodError:the method '-' was called on null color = Tween<Color>(begin: Colors.green, end: Colors.red).animate( CurvedAnimation( parent: controller, curve: Interval(.0, .6, curve: Curves.ease))).原创 2020-10-22 15:24:39 · 1375 阅读 · 0 评论 -
Unhandled Exception: Cannot hit test a render box with no size
使用列表时,如果直接使用listView,flutter不能命中没有大小的渲染框。 比如下面这个例子,错误的做法: import 'package:flutter/material.dart'; import 'package:flutter_practice/practice-advanced/router/event-bus-ex.dart'; import 'package:flutter_practice/practice-advanced/router/gesture-detector-..原创 2020-10-20 17:37:27 · 3936 阅读 · 0 评论