当前位置:网站首页>Flutter 实现每次进来界面都刷新数据
Flutter 实现每次进来界面都刷新数据
2022-07-01 05:08:00 【明似水】
前言
最近做flutter项目的时候,想每次进入我的界面都刷新数据,发现了一个很好用的方法,在此分享给大家:
@override
Widget build(BuildContext context) {
return VisibilityDetector(
key: const Key('my-menu-key'),
onVisibilityChanged: (VisibilityInfo visibilityInfo) {
if (visibilityInfo.visibleFraction == 0.0) {
} else {
_getMemberInfo();
}
},
child: Scaffold(
backgroundColor: color_FFFFFFFF,
body: Container(
color: Colors.red,
),
),
);
}
}
关键是VisibilityDetector,然后判断是否显示,就可以实现自己的效果了!
END.
边栏推荐
- Global and Chinese market of enterprise wireless LAN 2022-2028: Research Report on technology, participants, trends, market size and share
- LeetCode_ 66 (plus one)
- 【暑期每日一题】洛谷 P1629 邮递员送信(未完待续...)
- Use of dataloader
- C# wpf 使用DockPanel实现截屏框
- Global and Chinese markets of Ethernet communication modules 2022-2028: Research Report on technology, participants, trends, market size and share
- LeetCode316-去除重复字母-栈-贪心-字符串
- Use and modification of prior network model
- 解决:拖动xib控件到代码文件中,报错setValue:forUndefinedKey:this class is not key value coding-compliant for the key
- The longest increasing subsequence and its optimal solution, total animal weight problem
猜你喜欢

How to use common datasets in pytorch

Leetcode522- longest special sequence ii- hash table - String - double pointer

el-form表单新增表单项动态校验;el-form校验动态表单v-if不生效;

如何选择导电滑环材料

RuntimeError: “max_pool2d“ not implemented for ‘Long‘
![AssertionError assert I.ndim == 4 and I.shape[1] == 3](/img/b1/0109bb0f893eb4c8915df36c100907.png)
AssertionError assert I.ndim == 4 and I.shape[1] == 3

Neural networks - use of maximum pooling
![解决:Thread 1:[<*>setValue:forUndefinedKey]:this class is not key value coding-compliant for the key *](/img/88/0b99d1db2cdc70ab72d2b3c623dfaa.jpg)
解决:Thread 1:[<*>setValue:forUndefinedKey]:this class is not key value coding-compliant for the key *

Fitness without equipment

手动实现一个简单的栈
随机推荐
Leetcode522- longest special sequence ii- hash table - String - double pointer
解决:Thread 1:[<*>setValue:forUndefinedKey]:this class is not key value coding-compliant for the key *
Neural networks - use sequential to build neural networks
AcWing 885. Find the combination number I (recursive preprocessing)
Global and Chinese market of digital badge 2022-2028: Research Report on technology, participants, trends, market size and share
1076 Forwards on Weibo
Global and Chinese markets of gps/gnss receiver modules 2022-2028: Research Report on technology, participants, trends, market size and share
Technology sharing | broadcast function design in integrated dispatching
【暑期每日一題】洛穀 P1568 賽跑
Actual combat: gateway api-2022.2.13
Worried about infringement? Must share copyrightless materials on the website. Don't worry about the lack of materials for video clips
如何选择导电滑环材料
1076 Forwards on Weibo
担心侵权?必备无版权素材网站分享,不用担心视频剪辑缺素材
Neural network convolution layer
LeetCode1497-检查数组对是否可以被 k 整除-数组-哈希表-计数
AcWing 886. Finding combinatorial number II (pretreatment factorial)
Data loading and preprocessing
Thread safety issues
el-cascader回显失败;el-cascader回显不出来