Size class

Available extensions

Constructors

Size(double width, double height)
const
Size.fromJson(Map<String, dynamic> json)
Create Size from JSON
factory
Size.square(double dimension)
const

Properties

aspectRatio double
The aspect ratio of this size (width / height).
no setter
hashCode int
The hash code for this object.
no setteroverride
height double
final
isFinite bool
Whether this size has finite width and height.
no setter
isInfinite bool
Whether this size has infinite width or height.
no setter
isNonNegative bool
Whether this size has non-negative width and height.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width double
final

Methods

combine(Size other) Size
Returns the size that is the combination of this size and the given other size.
max(Size other) Size
Returns the size that is the component-wise maximum of this size and the given other size.
min(Size other) Size
Returns the size that is the component-wise minimum of this size and the given other size.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scale(double factor) Size
Returns a new size with the width and height scaled by the given factor.
scaleSize(double widthFactor, double heightFactor) Size
Returns a new size with the width and height scaled by the given factors.
subtract(Size other) Size
Returns the size that is the difference between this size and the given other size.
toCss() String
Convert to CSS string for HTML output
toJson() Map<String, dynamic>
Convert to JSON for serialization
toString() String
A string representation of this object.
override
withHeight(double newHeight) Size
Returns a new size with the given height and the same width.
withWidth(double newWidth) Size
Returns a new size with the given width and the same height.

Operators

operator *(double factor) Size

Available on Size, provided by the SizeOperators extension

operator +(Size other) Size

Available on Size, provided by the SizeOperators extension

operator -(Size other) Size

Available on Size, provided by the SizeOperators extension

operator /(double factor) Size

Available on Size, provided by the SizeOperators extension

operator <(Size other) bool

Available on Size, provided by the SizeOperators extension

operator <=(Size other) bool

Available on Size, provided by the SizeOperators extension

operator ==(Object other) bool
The equality operator.
override
operator >(Size other) bool

Available on Size, provided by the SizeOperators extension

operator >=(Size other) bool

Available on Size, provided by the SizeOperators extension

Static Methods

lerp(Size? a, Size? b, double t) Size?
Linearly interpolate between two sizes.

Constants

infinite → const Size
zero → const Size