当前位置:网站首页>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.
边栏推荐
- 1076 Forwards on Weibo
- 缓冲流与转换流
- Technology sharing | broadcast function design in integrated dispatching
- Explanation of characteristics of hydraulic slip ring
- How to use common datasets in pytorch
- [daily question in summer] Luogu p5740 [deep foundation 7. Example 9] the best student
- Data consistency between redis and database
- AcWing 884. Gauss elimination for solving XOR linear equations
- AcWing 885. Find the combination number I (recursive preprocessing)
- Global and Chinese markets of superconductor 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢

液压滑环的特点讲解

Data loading and preprocessing

Neural network - nonlinear activation

Detailed explanation of distributed global unique ID solution

Unity drags and modifies scene camera parameters under the editor

【暑期每日一题】洛谷 P5886 Hello, 2020!

每日一题-LeetCode1175-质数排列-数学

Precautions for use of conductive slip ring

解决:拖动xib控件到代码文件中,报错setValue:forUndefinedKey:this class is not key value coding-compliant for the key

Sqlplus connects using the instance name
随机推荐
[FTP] common FTP commands, updating continuously
Distributed - summary list
What can the points mall Games bring to businesses? How to build a points mall?
Daily question -leetcode1175- permutation of prime numbers - Mathematics
C read / write application configuration file app exe. Config and display it on the interface
Global and Chinese market of digital badge 2022-2028: Research Report on technology, participants, trends, market size and share
Intelligent operation and maintenance: visual management system based on BIM Technology
Global and Chinese market of search engine optimization (SEO) software 2022-2028: Research Report on technology, participants, trends, market size and share
Single page application
Actual combat: gateway api-2022.2.13
FileInputStream
How to start learning editing? Detailed analysis of zero basis
Software intelligence: the "world" and "boundary" of AI sentient beings in AAAs system
Oracle views the creation time of the tablespace in the database
Pytoch (III) -- function optimization
Design experience of Meizhou clinical laboratory
【暑期每日一题】洛谷 P2637 第一次,第二次,成交!
Simple read / write verification of qdatastream
【暑期每日一题】洛谷 P1629 邮递员送信(未完待续...)
Global and Chinese markets of InGaAs APD arrays 2022-2028: Research Report on technology, participants, trends, market size and share