当前位置:网站首页>Flutter series: offstage in flutter
Flutter series: offstage in flutter
2022-06-24 03:48:00 【InfoQ】
brief introduction
Offstage Detailed explanation
class Offstage extends SingleChildRenderObjectWidget
const Offstage({ Key? key, this.offstage = true, Widget? child })
: assert(offstage != null),
super(key: key, child: child);
RenderOffstage createRenderObject(BuildContext context) => RenderOffstage(offstage: offstage);
void paint(PaintingContext context, Offset offset) {
if (offstage)
return;
super.paint(context, offset);
}
Offstage Use
State<OffstageApp>Offstage(
offstage: _offstage,
child: SizedBox(
key: _key,
width: 150.0,
height: 150.0,
child: Container(
color: Colors.red,
),
),
)
ElevatedButton(
child: const Text(' Switch offstage'),
onPressed: () {
setState(() {
_offstage = !_offstage;
});
},
),
ElevatedButton(
child: const Text(' testing SizedBox size '),
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content:
Text('SizedBox is ${_getSizedBoxSize()}'),
),
);
})
Size _getSizedBoxSize() {
final RenderBox renderBox =
_key.currentContext!.findRenderObject()! as RenderBox;
return renderBox.size;
}



summary
边栏推荐
- [code Capriccio - dynamic planning] t392 Judgement subsequence
- Why do I need a code signing certificate? Where can I get a code signing certificate?
- [Numpy] Numpy对于NaN值的判断
- Grp: how to add Prometheus monitoring in GRP service?
- Coding Ci of Devops
- 黑帽实战SEO之永不被发现的劫持
- take the crown! Tencent security won the 2021 national network security week outstanding innovation achievement award
- 13. Tencent cloud IOT device side learning - data template function and Implementation
- Modstartcms enterprise content site building system (supporting laravel9) v4.2.0
- How to build glasses website what are the functions of glasses website construction
猜你喜欢

Modstartcms enterprise content site building system (supporting laravel9) v4.2.0

Clickhouse (02) Clickhouse architecture design introduction overview and Clickhouse data slicing design
Thank you for your recognition! One thank-you note after another

ClickHouse(02)ClickHouse架构设计介绍概述与ClickHouse数据分片设计

Pine Script脚本常用内容

Koom of memory leak

Black hat SEO practice: General 301 weight PR hijacking

一次 MySQL 误操作导致的事故,「高可用」都顶不住了!

浅谈游戏安全 (一)

halcon知识:区域(Region)上的轮廓算子(2)
随机推荐
Tencent cloud ASR product -php realizes the authentication request of the extremely fast version of recording file identification
SQL注入绕过安全狗思路一
Several key tools for cloud native implementation
What is the impact on the server rental or server hosting price?
Why install code signing certificate to scan and eliminate virus software from security
[congratulations] rock solid! A new generation of AMD Blackstone architecture instance is launched!
Dialogue with Google technical experts: soundstream is expected to be used for general audio coding in the future
Web penetration test - 5. Brute force cracking vulnerability - (2) SNMP password cracking
Common content of pine script script
What should I pay attention to when choosing a data center?
LeetCode 1281. Difference of sum of bit product of integer
How to select the application of the server?
Live broadcast Reservation: cloud hosting or cloud function, how can the business do a good job in technology selection?
Cross platform RDP protocol, RDP like protocol and non RDP protocol remote software
Using RDM (Remote Desktop Manager) to import CSV batch remote
Record the creation process of a joke widget (II)
How to install CentOS 6.5 PHP extension
Mocktio usage (Part 2)
A figure showing the price and expense structure of Tencent cloud real-time audio and video TRTC
TRTC audio quality problem