BoxSpec class

A specification class that defines layout and styling attributes for a box.

Use BoxSpec to configure various properties such as alignment, padding, margin, width, height, decoration, and more for a box.

To retrieve an instance of BoxSpec, use the BoxSpec.of method with a BuildContext, or the BoxSpec.from method with MixData.

Inheritance

Constructors

BoxSpec({AlignmentGeometry? alignment, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, BoxConstraints? constraints, Decoration? decoration, Decoration? foregroundDecoration, Matrix4? transform, AlignmentGeometry? transformAlignment, Clip? clipBehavior, double? width, double? height, AnimatedData? animated})
Creates a BoxSpec with the given properties.
const
BoxSpec.exhaustive({required AlignmentGeometry? alignment, required EdgeInsetsGeometry? padding, required EdgeInsetsGeometry? margin, required BoxConstraints? constraints, required Decoration? decoration, required Decoration? foregroundDecoration, required Matrix4? transform, required AlignmentGeometry? transformAlignment, required Clip? clipBehavior, required double? width, required double? height, required AnimatedData? animated})
Creates a BoxSpec with all properties required
const

Properties

alignment AlignmentGeometry?
Aligns the child within the box.
final
animated AnimatedData?
finalinherited
clipBehavior Clip?
Defines the clip behavior for the box when BoxConstraints has a negative minimum extent.
final
constraints BoxConstraints?
Applies additional constraints to the child.
final
decoration Decoration?
Paints a decoration behind the child.
final
foregroundDecoration Decoration?
Paints a decoration in front of the child.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
Specifies the height of the box.
final
isAnimated bool
no setterinherited
margin EdgeInsetsGeometry?
Adds empty space around the box.
final
padding EdgeInsetsGeometry?
Adds empty space inside the box.
final
props List<Object?>
Returns a list of properties that constitute this BoxSpec.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool
no setterinherited
transform Matrix4?
Applies a transformation matrix before painting the box.
final
transformAlignment AlignmentGeometry?
Aligns the origin of the coordinate system for the transform.
final
type Type
no setterinherited
width double?
Specifies the width of the box.
final

Methods

copyWith({AlignmentGeometry? alignment, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, BoxConstraints? constraints, Decoration? decoration, Decoration? foregroundDecoration, double? width, double? height, Matrix4? transform, AlignmentGeometry? transformAlignment, Clip? clipBehavior, AnimatedData? animated}) BoxSpec
Returns a new BoxSpec with the specified properties replaced.
override
getDiff(EqualityMixin other) Map<String, String>
inherited
lerp(covariant BoxSpec? other, double t) BoxSpec
Linearly interpolates between two BoxSpec instances.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

from(MixData mix) BoxSpec
Retrieves the BoxSpec from the given MixData.
of(BuildContext context) BoxSpec
Retrieves the BoxSpec from the nearest Mix ancestor.