突然发现自己还有一个database的分类,想想以前还在为了折腾怎么弄mysql更好,后面被各种数据库折腾(小型公司,不涉及大数据库,都是常规的,象pg/sqlite/sqlserver/mongodb/redis)。
Submitted by gouki on 2022, July 19, 2:45 PM
突然发现自己还有一个database的分类,想想以前还在为了折腾怎么弄mysql更好,后面被各种数据库折腾(小型公司,不涉及大数据库,都是常规的,象pg/sqlite/sqlserver/mongodb/redis)。
Submitted by gouki on 2022, July 19, 12:51 PM
本文属于记事
Submitted by gouki on 2022, June 29, 9:45 PM
在使用GetView的时候(其实StatelessWidget也一样)。只要使用了getX的Map<String,dynamic>,不管是get还是set,都会报setState的错误,(setState() or markNeedsBuild() called during build)。说白了和上次的问题一样:flutter中页面渲染完成的回调,但这次没有办法使用。上次是设置变量,这次是直接读变量。
当然,即使报错了,但页面还是可以正常渲染,上次是直接就红屏了。因为在项目中,没有细看原理,想了下还是应该没有设置初始值导致的。所以特别设置了一下初始值。问题解决。
做个笔记。
Submitted by gouki on 2022, June 28, 1:16 AM
这玩意就有点象vue中的mounted/或者其他的afterLoad等操作。怎么突然想要用到这个呢,是因为我用了getX,之前用riverpod,也没注意过这个问题。用了GetX之后,这个东西就被派上用场了。
原因是我有一个设置背景图的功能。本来想着一切换页面,背景图就加载出来,但事实上我把这个功能提前后,进入页面就直接报错,说是obx在页面没有渲染完成的时候不能调用。
This Obx widget cannot be marked as needing to build because the framework is already in the process of building widgets. A widget can be marked as needing to be built during the build phase only if one of its ancestors is currently building. This exception is allowed because the framework builds parent widgets before children, which means a dirty descendant will always be built. Otherwise, the framework might not visit this widget during this build phase.
于是,使用:
WidgetsBinding.instance.addPostFrameCallback((time) {
final back = Get.find<BackgroundController>();
back.set(Assets.backgroundImage);
});
问题解决
Submitted by gouki on 2022, June 7, 10:25 PM
比如我们常用的alertDialog,只要显示一个message,不显示title的话,有点象toast。这时候如何自定义宽度 呢?