WxLinearBorder class
An WxOutlinedBorder
like BoxBorder that allows one to define a rectangular (box) border
in terms of zero to four WxLinearBorderSides, each of which is rendered as a single line.
The color and width of each line are defined by side
. When WxLinearBorder is used
with a class whose border sides and shape are defined by a ButtonStyle, then a non-null
ButtonStyle.side will override the one specified here. For example the WxLinearBorder
in the TextButton example below adds a red underline to the button. This is because
TextButton's side
parameter overrides the side
property of its ButtonStyle.shape.
TextButton(
style: TextButton.styleFrom(
side: const WxBorderSide(color: Colors.red),
shape: const WxLinearBorder(
side: WxBorderSide(color: Colors.blue),
bottom: WxLinearBorderSide(),
),
),
onPressed: () { },
child: const Text('Red WxLinearBorder'),
)
This class resolves itself against the current TextDirection (see Directionality). Start and end values resolve to left and right for TextDirection.ltr and to right and left for TextDirection.rtl.
Convenience constructors are included for the common case where just one edge is specified: WxLinearBorder.start, WxLinearBorder.end, WxLinearBorder.top, WxLinearBorder.bottom.
- Inheritance
-
- Object
- ShapeBorder
- WxLinearBorder
Constructors
- WxLinearBorder({WxBorderSide? side, WxLinearBorderSide? start, WxLinearBorderSide? end, WxLinearBorderSide? top, WxLinearBorderSide? bottom})
-
Creates a rectangular box border that's rendered as zero to four lines.
const
- WxLinearBorder.bottom({WxBorderSide? side, double alignment = 0.0, double size = 1.0})
- Creates a rectangular box border with an edge on the bottom.
- WxLinearBorder.end({WxBorderSide? side, double alignment = 0.0, double size = 1.0})
- Creates a rectangular box border with an edge on the right for TextDirection.ltr or on the left for TextDirection.rtl.
- WxLinearBorder.start({WxBorderSide? side, double alignment = 0.0, double size = 1.0})
- Creates a rectangular box border with an edge on the left for TextDirection.ltr or on the right for TextDirection.rtl.
- WxLinearBorder.top({WxBorderSide? side, double alignment = 0.0, double size = 1.0})
- Creates a rectangular box border with an edge on the top.
Properties
- bottom → WxLinearBorderSide?
-
Defines the bottom edge.
final
- color → Color?
-
The color of the outline, if specified. Can be overridden by
gradient
.finalinherited - dimensions → EdgeInsetsGeometry
-
The widths of the sides of this border represented as an EdgeInsets.
no setter
- effectiveBottom → WxLinearBorderSide
-
no setter
- effectiveEnd → WxLinearBorderSide
-
no setter
- effectiveSide → WxLinearBorderSide
-
Returns the effective WxBorderSide considering any provided overrides.
no setter
- effectiveStart → WxLinearBorderSide
-
no setter
- effectiveTop → WxLinearBorderSide
-
no setter
- end → WxLinearBorderSide?
-
Defines the right edge for TextDirection.ltr or the left
for TextDirection.rtl.
final
- gradient → Gradient?
-
A gradient to use for painting the outline, if provided.
finalinherited
- hashCode → int
-
The hash code for this object.
no setteroverride
- offset → double?
-
An offset to apply to the outline, in logical pixels.
finalinherited
- preferPaintInterior → bool
-
Reports whether paintInterior is implemented.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- side → WxBorderSide?
-
The border outline's color and weight.
finalinherited
- start → WxLinearBorderSide?
-
Defines the left edge for TextDirection.ltr or the right
for TextDirection.rtl.
final
- style → WxBorderStyle?
-
The style of the outline (e.g., solid, dashed). Can be overridden by subclasses.
finalinherited
- top → WxLinearBorderSide?
-
Defines the top edge.
final
- width → double?
-
The desired width of the outline, in logical pixels.
finalinherited
Methods
-
add(
ShapeBorder other, {bool reversed = false}) → ShapeBorder? -
Attempts to create a new object that represents the amalgamation of
this
border and theother
border.inherited -
copyWith(
{WxBorderSide? side, WxBorderStyle? style, Color? color, Gradient? gradient, double? width, double? offset, WxLinearBorderSide? start, WxLinearBorderSide? end, WxLinearBorderSide? top, WxLinearBorderSide? bottom}) → WxLinearBorder - Returns a copy of this WxLinearBorder with the given fields replaced with the new values.
-
getInnerPath(
Rect rect, {TextDirection? textDirection}) → Path -
Create a Path that describes the inner edge of the border.
override
-
getNonSolidPath(
Path source, {TextDirection? textDirection}) → Path -
Calculates the path for a non-solid outline style (e.g., dashed).
inherited
-
getOuterPath(
Rect rect, {TextDirection? textDirection}) → Path -
Create a Path that describes the outer edge of the border.
override
-
lerpFrom(
ShapeBorder? a, double t) → ShapeBorder? -
Linearly interpolates from another ShapeBorder (possibly of another
class) to
this
. -
lerpTo(
ShapeBorder? b, double t) → ShapeBorder? -
Linearly interpolates from
this
to another ShapeBorder (possibly of another class). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
paint(
Canvas canvas, Rect rect, {TextDirection? textDirection}) → void -
Paints the border within the given Rect on the given Canvas.
override
-
paintInterior(
Canvas canvas, Rect rect, Paint paint, {TextDirection? textDirection}) → void -
Paint a canvas with the appropriate shape.
inherited
-
scale(
double t) → WxLinearBorder -
Creates a copy of this border, scaled by the factor
t
. -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator +(
ShapeBorder other) → ShapeBorder -
Creates a new border consisting of the two borders on either side of the
operator.
inherited
-
operator ==(
Object other) → bool -
The equality operator.
override
Constants
- none → const WxLinearBorder
- No border.