当前位置:网站首页>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
边栏推荐
- Understanding of smt32h7 series DMA and DMAMUX
- Lepton 无损压缩原理及性能分析
- The most comprehensive promotion strategy: online and offline promotion methods of E-commerce mall
- Unity SKFramework框架(二十三)、MiniMap 小地图工具
- 分布式数据库下子查询和 Join 等复杂 SQL 如何实现?
- 干货整理!ERP在制造业的发展趋势如何,看这一篇就够了
- 百度交易中台之钱包系统架构浅析
- Nips2021 | new SOTA for node classification beyond graphcl, gnn+ comparative learning
- High performance spark_ Transformation performance
- 为什么不建议你用 MongoDB 这类产品替代时序数据库?
猜你喜欢
百度评论中台的设计与探索
The most comprehensive promotion strategy: online and offline promotion methods of E-commerce mall
Unity SKFramework框架(二十四)、Avatar Controller 第三人称控制
7 月 2 日邀你来TD Hero 线上发布会
Viewpager pageradapter notifydatasetchanged invalid problem
Nips2021 | new SOTA for node classification beyond graphcl, gnn+ comparative learning
Go 语言使用 MySQL 的常见故障分析和应对方法
What about wechat mall? 5 tips to clear your mind
揭秘百度智能测试在测试自动执行领域实践
LeetCode 503. Next bigger Element II
随机推荐
Node の MongoDB Driver
Oracle combines multiple rows of data into one row of data
Community group buying exploded overnight. How should this new model of e-commerce operate?
oracle 多行数据合并成一行数据
Android SQLite database encryption
On July 2, I invite you to TD Hero online press conference
Observation cloud and tdengine have reached in-depth cooperation to optimize the cloud experience of enterprises
Android privacy sandbox developer preview 3: privacy, security and personalized experience
Dry goods sorting! How about the development trend of ERP in the manufacturing industry? It's enough to read this article
植物大战僵尸Scratch
初识结构体
Tdengine connector goes online Google Data Studio app store
干货整理!ERP在制造业的发展趋势如何,看这一篇就够了
[sourcetree configure SSH and use]
正式上架!TDengine 插件入驻 Grafana 官网
使用el-upload封装得组件怎么清空已上传附件
90%的人都不懂的泛型,泛型的缺陷和应用场景
Node の MongoDB Driver
OpenGL - Model Loading
TDengine 离线升级流程