当前位置:网站首页>Flutter development: use safearea
Flutter development: use safearea
2022-07-05 09:48:00 【Third shopkeeper 666】
Preface
stay Flutter In development , The adaptation of various mobile phone models is a very important thing , In especial Android There are too many and miscellaneous models of the system , Fitting is not easy , And for iOS Systematic iPhone Mobile phone “ bang ” Adaptation is also a key knowledge point . So this blog post is about SafeArea Use ,SafeArea It is also the best weapon for all kinds of strange and irregular screens , Easy to read and use .
principle
SafeArea It's through MediaQuery To check the screen size , Make the size of the application fit the screen , And then back to a Padding Widget To wrap the compiled page , In this way, the page will not be blocked by the irregular screen .SafeArea Basically beautified Padding The widget , If you use SafeArea Wrap another widget , It will add the necessary padding required , To prevent the widget from being used by the system status bar of various manufacturers 、 Notch 、 hole 、 Fillets and others " originality " The function is blocked .
Example
Next, let's make a comparative demonstration on whether to set a security zone , Compare the use SafeArea Post and unused SafeArea The effect of . The specific code is as follows :
1、 Before the change , Code example without security zone settings :
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color.fromRGBO(241, 241, 241, 1),
body: Column(children: [
_buildhead(),
Expand
边栏推荐
- Three-level distribution is becoming more and more popular. How should businesses choose the appropriate three-level distribution system?
- Oracle combines multiple rows of data into one row of data
- 使用el-upload封装得组件怎么清空已上传附件
- mysql安装配置以及创建数据库和表
- Unity skframework framework (XXIII), minimap small map tool
- [listening for an attribute in the array]
- Tdengine already supports the industrial Intel edge insight package
- Evolution of Baidu intelligent applet patrol scheduling scheme
- MySQL installation configuration and creation of databases and tables
- Tdengine connector goes online Google Data Studio app store
猜你喜欢
From "chemist" to developer, from Oracle to tdengine, two important choices in my life
How Windows bat script automatically executes sqlcipher command
OpenGL - Coordinate Systems
TDengine 连接器上线 Google Data Studio 应用商店
On July 2, I invite you to TD Hero online press conference
Small program startup performance optimization practice
基于宽表的数据建模应用
TDengine ×英特尔边缘洞见软件包 加速传统行业的数字化转型
Analysis on the wallet system architecture of Baidu trading platform
LeetCode 31. 下一个排列
随机推荐
搞数据库是不是越老越吃香?
Tdengine already supports the industrial Intel edge insight package
How do enterprises choose the appropriate three-level distribution system?
H. 265 introduction to coding principles
Roll up, break 35 - year - old Anxiety, animation Demonstration CPU recording Function call Process
Baidu app's continuous integration practice based on pipeline as code
90%的人都不懂的泛型,泛型的缺陷和应用场景
Why do offline stores need cashier software?
如何正确的评测视频画质
干货整理!ERP在制造业的发展趋势如何,看这一篇就够了
H.265编码原理入门
[two objects merged into one object]
Observation cloud and tdengine have reached in-depth cooperation to optimize the cloud experience of enterprises
【饿了么动态表格】
Oracle combines multiple rows of data into one row of data
一文读懂TDengine的窗口查询功能
[team PK competition] the task of this week has been opened | question answering challenge to consolidate the knowledge of commodity details
SQL learning - case when then else
7 月 2 日邀你来TD Hero 线上发布会
La voie de l'évolution du système intelligent d'inspection et d'ordonnancement des petites procédures de Baidu