EdgeInsets class Core
Defines offsets for each side of a rectangle, typically used for padding or margins.
An EdgeInsets stores separate values for the top, right, bottom, and left edges. This is useful for controlling spacing inside or outside UI components.
Common factory constructors are provided for convenience:
- EdgeInsets.all sets the same padding on all sides.
- EdgeInsets.symmetric sets the same padding vertically and/or horizontally.
- EdgeInsets.only sets padding for specific sides.
Example:
// Uniform padding
final padding1 = EdgeInsets.all(8);
// Vertical: 10, Horizontal: 20
final padding2 = EdgeInsets.symmetric(vertical: 10, horizontal: 20);
// Only top and left padding
final padding3 = EdgeInsets.only(top: 5, left: 3);
Constructors
- EdgeInsets.all(int value)
-
Creates insets with the same value for all four sides.
const
- EdgeInsets.only({int top = 0, int right = 0, int bottom = 0, int left = 0})
-
Creates insets with explicitly specified values for each side.
const
- EdgeInsets.symmetric({int vertical = 0, int horizontal = 0})
-
Creates insets with symmetric vertical and/or horizontal values.
const
Properties
- bottom → int
-
The padding on the bottom side.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- horizontal → int
-
The total horizontal insets, equal to left + right.
no setter
- left → int
-
The padding on the left side.
final
- right → int
-
The padding on the right side.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- top → int
-
The padding on the top side.
final
- vertical → int
-
The total vertical insets, equal to top + bottom.
no setter
Methods
-
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