Box class
提供尺寸、间距、背景、边框、圆角和裁剪能力的容器组件。
- Inheritance
Constructors
-
Box({Key? key, double? width, double? height, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, Color? color, bool isCircle = false, BorderRadiusGeometry? outerRadius, BorderRadiusGeometry? innerRadius, BoxBorder? border, List<
BoxShadow> ? boxShadows, Gradient? gradient, BoxConstraints? constraints, Clip clipBehavior = Clip.hardEdge, bool isClipsToBounds = true, Widget? child}) -
创建一个通用容器。
const
Properties
- border → BoxBorder?
-
容器边框。
final
-
boxShadows
→ List<
BoxShadow> ? -
容器阴影列表。
final
- child → Widget?
-
容器中显示的子组件。
final
- clipBehavior → Clip
-
容器自身的裁剪方式。
final
- color → Color?
-
容器背景颜色。
final
- constraints → BoxConstraints?
-
容器的额外尺寸约束。
final
- gradient → Gradient?
-
容器背景渐变。
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
容器高度。
final
- innerRadius → BorderRadiusGeometry?
-
子组件的裁剪圆角,主要用于图片等内容。
final
- isCircle → bool
-
是否使用圆形外观。
final
- isClipsToBounds → bool
-
是否裁剪超出边界的子组件。
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- margin → EdgeInsetsGeometry?
-
容器外边距。
final
- outerRadius → BorderRadiusGeometry?
-
外层装饰圆角。
final
- padding → EdgeInsetsGeometry?
-
容器内边距。
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- width → double?
-
容器宽度。
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.
inherited
-
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, int wrapWidth = 65}) → 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