官方文档ConstrainedBox class

ConstrainedBox class

A widget that imposes additional constraints on its child.

ConstrainedBox 可以为它的子控件强制加上一个约束条件。

For example, if you wanted child to have a minimum height of 50.0 logical pixels, you could use const BoxConstraints(minHeight: 50.0) as the constraints.

比如你希望子控件拥有最小50像素的高度,你就可以使用const BoxConstraints(minHeight: 50.0)

Sample

This snippet makes the child widget (a Card with some Text) fill the parent, by applying BoxConstraints.expand constraints:

ConstrainedBox(constraints: const BoxConstraints.expand(),child: const Card(child: Text('Hello World!')),
)

The same behavior can be obtained using the new SizedBox.expand widget.

See also:

  • BoxConstraints, the class that describes constraints.

  • UnconstrainedBox, a container that tries to let its child draw without constraints.

  • SizedBox, which lets you specify tight constraints by explicitly specifying the height or width.

  • FractionallySizedBox, which sizes its child based on a fraction of its own size and positions the child according to an Alignment value.

  • AspectRatio, a widget that attempts to fit within the parent’s constraints while also sizing its child to match a given aspect ratio.

  • The catalog of layout widgets.

  • Inheritance

    Object-> Diagnosticable-> DiagnosticableTree-> Widget-> RenderObjectWidget-> SingleChildRenderObjectWidget-> ConstrainedBox

ConstrainedBox class相关推荐

  1. Flutter 布局控件完结篇

    本文对Flutter的29种布局控件进行了总结分类,讲解一些布局上的优化策略,以及面对具体的布局时,如何去选择控件. 1. 系列文章 Flutter 布局详解 Flutter 布局(一)- Conta ...

  2. Flutter开发之PageView指示器(31)

    移动开发中圆点指示器给用户很好的用户体验,iOS 有自己的控件UIPageControl 方便快捷实现.既然想用Flutter代替,就想着如何实现UIPageControl 类似的功能.这篇文章就在前 ...

  3. flutter设置文本最大宽度

    ConstrainedBox(constraints:BoxConstraints(maxWidth: 80,),child:Text("sssasdfasdfasdfasfdasffasf ...

  4. python编程入门与案例详解pdf-Flutter技术入门与实战 PDF 清晰版

    给大家带来的一篇关于Flutter相关的电子书资源,介绍了关于Flutter入门.Flutter实战.Flutter技术方面的内容,本书是由机械工业出版社出版,格式为PDF,资源大小162.5 MB, ...

  5. ContrainedBox:设置尺寸

    用于设置并约束子widget尺寸 ConstrainedBox:(constraints:BoxConstraints(minWidth:double.inifinity,//宽度尽可能大 maxWi ...

  6. element中有多个合计_深入理解 Flutter 中的 Widget, Element, RenderObject

    这篇文章基于 Flutter stable v1.7 总结下 Flutter 当前的 UI 系统以及相关的概念, 在最后会通过自己组合一个 Gradient Button 按钮的方式来熟悉 Flutt ...

  7. flutter 自定义 AppBar

    为什么80%的码农都做不了架构师?>>>    自带AppBar 有限制 到app_bar.dart 中将  AppBar 和 _AppBarState 类复制到自定义的wAppBa ...

  8. Unity的Flutter——UIWidgets简介及入门

    介绍 UIWidgets(https://github.com/UnityTech/UIWidgets)是Unity编辑器的一个插件包,可帮助开发人员通过Unity引擎来创建.调试和部署高效的跨平台应 ...

  9. flutter图片预览_Flutter 视频缩略图

    在做即时通讯前整理了一个视频缩略图的工具类,可供码农直接放入项目中使用,涉及到的插件: video_player: ^0.10.11+2 话不多说代码如下: import 'package:flutt ...

最新文章

  1. 查linux还是unix,C、C++判断操作系统是Linux、windows还是Unix
  2. java如何按照标签替换_Maven(五):resources、profiles标签的实践
  3. 关于页面莫名空白的解决方式
  4. Android 沉浸式状态栏 实现方式二 ( 更简单 )
  5. linux中特殊字符的含义,Linux中的特殊符号以及特殊语法
  6. 场景模型驱动自动化测试在盒马的探索及实践
  7. 使用excel2003中的solver解决最优化问题
  8. CentOS7中密码登录失败锁定设置
  9. docker容器管理及网络管理
  10. 拓端tecdat|Python银行机器学习:回归、随机森林、KNN近邻、决策树、高斯朴素贝叶斯、支持向量机svm分析营销活动数据
  11. 新疆财大计算机科学,新疆财经大学计算机科学与工程学院学生参加了多项专业赛事...
  12. PDMS Pipeline Tool 教程(一):安装说明
  13. 计算机等级考试四级信息安全工程师
  14. MS coco数据集介绍及下载
  15. 软件比较 - Sniffer、Omnipeek、科来网络分析系统过滤器比较之位过滤 在捕获数据包时,有时候需要对一个字节中的某一个位进行精确匹配,这时,我们就需要用到位过滤。位过滤相对于地址、端口、协
  16. 服务器主板测试工程师的项目经历,硬件测试简历项目经验怎么写
  17. Android sn 号修改
  18. 使用python批量压缩图片文件
  19. Clone 2. 肿瘤克隆进化之不同进化模式
  20. 俄勒冈之旅_俄勒冈州立大学开源实验室主持160个项目

热门文章

  1. 书论43 黄庭坚《论书》
  2. 计算机页面边框怎么设置,[计算机]在Word2003文档中设置页面边框.doc
  3. 【JVM与性能调优】JVM常用指令之Javap详解
  4. 华为模拟器防火墙打开web_华为防火墙的管理方式(Console、Telnet、Web、SSH)
  5. 开源工作流自动化神器 n8n
  6. 2022年知识产权司法保护状况发布,中创算力:尊重知识产权,共建知识产权强国!
  7. jQuery弹框 remodal 插件
  8. 让你的网页引入思源字体
  9. 苹果Facetime支持32人视频通话,一年前,即构科技已经做到了
  10. ElementUI - <el-image> src 属性使用本地图片加载失败解决方案