当前位置:网站首页>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
边栏推荐
- Data visualization platform based on template configuration
- Android SQLite database encryption
- 搞数据库是不是越老越吃香?
- Baidu app's continuous integration practice based on pipeline as code
- 从“化学家”到开发者,从甲骨文到 TDengine,我人生的两次重要抉择
- Principle and performance analysis of lepton lossless compression
- High performance spark_ Transformation performance
- idea用debug调试出现com.intellij.rt.debugger.agent.CaptureAgent,导致无法进行调试
- OpenGL - Model Loading
- 揭秘百度智能测试在测试自动执行领域实践
猜你喜欢
Node の MongoDB Driver
Unity skframework framework (24), avatar controller third person control
Idea debugs com intellij. rt.debugger. agent. Captureagent, which makes debugging impossible
Deep understanding of C language pointer
E-commerce apps are becoming more and more popular. What are the advantages of being an app?
Charm of code language
tongweb设置gzip
基于宽表的数据建模应用
Common fault analysis and Countermeasures of using MySQL in go language
百度智能小程序巡检调度方案演进之路
随机推荐
【技术直播】如何用 VSCode 从 0 到 1 改写 TDengine 代码
Gradientdrawable get a single color
Tdengine already supports the industrial Intel edge insight package
揭秘百度智能测试在测试自动执行领域实践
Evolution of Baidu intelligent applet patrol scheduling scheme
Unity skframework framework (24), avatar controller third person control
Thermometer based on STM32 single chip microcomputer (with face detection)
[two objects merged into one object]
A keepalived high availability accident made me learn it again
MySQL installation configuration and creation of databases and tables
Node-RED系列(二九):使用slider与chart节点来实现双折线时间序列图
搞数据库是不是越老越吃香?
Lepton 无损压缩原理及性能分析
uni-app---uni.navigateTo跳转传参使用
【数组的中的某个属性的监听】
[reading notes] Figure comparative learning gnn+cl
【组队 PK 赛】本周任务已开启 | 答题挑战,夯实商品详情知识
[Yugong series] go teaching course 003-ide installation and basic use in July 2022
How do enterprises choose the appropriate three-level distribution system?
OpenGL - Coordinate Systems