MContainer class

Inheritance

Constructors

MContainer({Key? key, double? size, double? width, double? height, BoxConstraints? constraints, AlignmentGeometry? alignment, BoxBorder? border, BorderRadius? borderRadius, Widget? child, Clip clipBehavior = Clip.none, Color? color, Decoration? decoration, BoxFit? fit, Decoration? foregroundDecoration, Gradient? gradient, String? image, AlignmentGeometry? imageAlignment, ImageProvider<Object>? imageProvider, EdgeInsetsGeometry? margin, EdgeInsetsGeometry? padding, double? radius, ImageRepeat repeat = ImageRepeat.noRepeat, double scale = 1.0, List<BoxShadow>? shadows, BorderSide? side, Matrix4? transform, AlignmentGeometry? transformAlignment, Rect? centerSlice, double? maxHeight, double? maxWidth, double? minHeight, double? minWidth, MBoxShape? shape, AssetBundle? bundle, String? package, Map<String, String>? httpHeaders})
创建一个 Container 组件, 可以设置宽高,边框,圆角等属性 width 宽度 height 高度 size 尺寸 child 子组件 alignment 对齐方式 border 边框 borderRadius 圆角 clipBehavior 裁剪 color 背景色 decoration 装饰 fit 图片填充模式 foregroundDecoration 前景装饰 gradient 渐变 image 图片 imageAlignment 图片对齐方式 imageProvider 图片提供者 margin 外边距 padding 内边距 radius 圆角 repeat 图片重复模式 scale 图片缩放 shadows 阴影 side 边框 transform 旋转 transformAlignment 旋转对齐方式 centerSlice 图片切片 maxHeight 最大高度 maxWidth 最大宽度 minHeight 最小高度 minWidth 最小宽度 shape 形状 constraints 约束

Properties

alignment AlignmentGeometry?
对齐方式
final
border BoxBorder?
边框, 适用于 MBoxShape.rectangle
final
borderRadius BorderRadius?
圆角, 适用于 MBoxShape.rectangle
final
bundle AssetBundle?
获取 image 的包, 只在设置 image 时生效。详情请查看 AssetImage 类本身的文档。
final
centerSlice Rect?
九片图像的中心切片, 设置切片拉伸区域, Rect 是根据图片的原始大小来定位中心切片区域。 中心切片内的图像区域将被水平和垂直拉伸,以使图像适合其目标。 中心切片上方和下方的图像区域将仅被水平拉伸,中心切片左侧和右侧的图像区域将仅被垂直拉伸。
final
child Widget?
子组件
final
clipBehavior Clip
裁剪
final
color Color?
颜色可以和 decoration 一起使用, 如果有 decoration, 则会覆盖 color
final
constraints BoxConstraints?
约束
final
decoration Decoration?
装饰, 一旦设置了 decoration, 则会覆盖所有 decoration 相关的属性
final
fit BoxFit?
image 填充模式
final
foregroundDecoration Decoration?
前景装饰
final
gradient Gradient?
背景渐变
final
hashCode int
The hash code for this object.
no setterinherited
httpHeaders Map<String, String>?
用于 HttpClient.get 从网络获取图片的 HTTP 标头。在网络上运行 Flutter 时,不使用标头。
final
image String?
image 来源
final
imageAlignment AlignmentGeometry?
image 的对齐方式
final
imageProvider ImageProvider<Object>?
图片提供者
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
margin EdgeInsetsGeometry?
外边距
final
maxHeight double?
设置宽高最大值, 不设置为无穷大, 当设置 widthheightsizeconstraints 时无效
final
maxWidth double?
设置宽高最小值, 不设置为无穷大, 当设置 widthheightsizeconstraints 时无效
final
minHeight double?
设置宽高最小值, 不设置为 0
final
minWidth double?
设置宽高最小值, 不设置为 0
final
package String?
包含 image 的软件包名称, 只在设置 image 时生效。详情请查看 AssetImage 类本身的文档。
final
padding EdgeInsetsGeometry?
内边距
final
radius double?
borderRadius 圆角值
final
repeat ImageRepeat
image 重复模式
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scale double
imageImageInfo 对象中的缩放比例。
final
shadows List<BoxShadow>?
阴影
final
shape MBoxShape?
形状
final
side BorderSide?
边框轮廓的颜色和粗细。
final
transform Matrix4?
变换
final
transformAlignment AlignmentGeometry?
变换对齐方式
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited