上一页 1 2 3 4 5 6 7 8 ··· 30 下一页

2022年9月20日

flutter 基础 —— Focus 组件的使用

摘要: Focus 组件 class HomePage extends StatefulWidget { const HomePage({Key? key}) : super(key: key); @override State<HomePage> createState() => _HomePageSta 阅读全文

posted @ 2022-09-20 11:25 Lemo_wd 阅读(489) 评论(0) 推荐(0) 编辑

2022年9月18日

flutter 效果实现 —— 去除水波纹效果

摘要: 修改主题 theme: ThemeData( splashColor: Colors.transparent, highlightColor: Colors.transparent, splashFactory: NoSplash.splashFactory, ), 或者修改单个 ElevatedB 阅读全文

posted @ 2022-09-18 21:59 Lemo_wd 阅读(958) 评论(0) 推荐(0) 编辑

2022年9月15日

dart 基础知识查漏补缺

摘要: 一、基础类型 1. late 关键字 有两种用法: 第一种是告知编译器该变量在使用前会执行初始化。因为 dart 编译器要求非空变量必须在初始化后才能使用: late String description; void main() { description = 'Feijoada!'; print 阅读全文

posted @ 2022-09-15 11:38 Lemo_wd 阅读(118) 评论(0) 推荐(0) 编辑

2022年9月5日

flutter 效果实现 —— 可拖拽 GridView

摘要: 效果: 代码: class GridDragView extends StatefulWidget { const GridDragView({Key? key}) : super(key: key); @override State<GridDragView> createState() => _ 阅读全文

posted @ 2022-09-05 22:38 Lemo_wd 阅读(922) 评论(0) 推荐(0) 编辑

2022年8月21日

flutter 效果实现 —— 全局点击空白处隐藏键盘

摘要: 为什么要实现点击空白处隐藏键盘?因为这是 iOS 平台的默认行为,Android 平台由于其弹出的键盘右上角默认带有关闭键盘的按钮,所以点击空白处不会隐藏键盘。 单个页面,可以这样做: class DismissKeyboardPage extends StatelessWidget { final 阅读全文

posted @ 2022-08-21 14:10 Lemo_wd 阅读(508) 评论(0) 推荐(0) 编辑

2022年8月19日

flutter 效果实现 —— sliver 固定

摘要: 效果: 说明:绿色块在向上滑动,距离顶部 103 的高度(即 AppBar 下面)时固定 示例 1: 解决问题的关键是修正 paintOffset,以使最终的 offset 在 pinned 位置固定不变。(不推荐使用,示例 3 中有说明原由) class PinnedSliverPage exte 阅读全文

posted @ 2022-08-19 18:08 Lemo_wd 阅读(1007) 评论(0) 推荐(0) 编辑

2022年8月17日

flutter 杂项 —— Stateful 与 Stateless 的更新

摘要: 一、使用 StatefulBuilder 单独更新某个组件的状态 示例: await showDialog<void>( context: context, builder: (BuildContext context) { int? selectedRadio = 0; return AlertD 阅读全文

posted @ 2022-08-17 21:54 Lemo_wd 阅读(308) 评论(0) 推荐(0) 编辑

2022年8月16日

flutter —— 布局原理与约束 (Sliver 布局)

摘要: 布局模型 RenderBox 布局,移步 flutter —— 布局原理与约束 Sliver 的布局流程如下: Viewport 将当前布局和配置信息通过 SliverConstraints 传递给 Sliver。 Sliver 确定自身的位置、绘制等信息,保存在 geometry 中(一个 Sli 阅读全文

posted @ 2022-08-16 21:38 Lemo_wd 阅读(1082) 评论(0) 推荐(1) 编辑

flutter 技术选型 —— 视频播放器插件

摘要: chewie 依赖:video_player + chewie 缺点:ui 简陋 class VideoPlayerScreen extends StatefulWidget { const VideoPlayerScreen({Key? key}) : super(key: key); @over 阅读全文

posted @ 2022-08-16 21:17 Lemo_wd 阅读(1331) 评论(0) 推荐(0) 编辑

flutter 基础 —— 缓存页面与滚动位置等信息

摘要: 一、缓存页面 比如 Tab 切换,旧的 Tab 可能被销毁,我们需要做缓存。 解决方法:如果是 PageView 可以更改 allowImplicitScrolling 值为 true,会缓存前后各一页。 其它组件,可以实现 AutomaticKeepAliveClientMixin 接口。 注:T 阅读全文

posted @ 2022-08-16 14:55 Lemo_wd 阅读(640) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 ··· 30 下一页

导航