ShapedInputBorder class
Draws a custom shape around an InputDecorator's container.
This border allows any ShapeBorder to be used as an input decorator border. This provides maximum flexibility for custom border shapes while maintaining the gap functionality for floating labels.
When the input decorator's label is floating, for example because its input child has the focus, the label appears in a gap in the border outline.
The input decorator's "container" is the optionally filled area above the decorator's helper, error, and counter.
This sample shows how to use ShapedInputBorder with different
ShapeBorder implementations.
link
To create a local project with this code sample, run:
flutter create --sample=material.ShapedInputBorder.1 mysample
See also:
- OutlineInputBorder, a traditional rounded rectangle border.
- UnderlineInputBorder, the default InputDecorator border which draws a horizontal line at the bottom of the input decorator's container.
- RoundedSuperellipseBorder, which can be used with this border for iOS-style shapes.
- InputDecoration, which is used to configure an InputDecorator.
- Inheritance
-
- Object
- ShapeBorder
- InputBorder
- ShapedInputBorder
Constructors
- ShapedInputBorder({BorderSide borderSide = const BorderSide(), required ShapeBorder shape, double gapPadding = 4.0})
-
Creates a shaped outline border for an InputDecorator.
const
Properties
- borderSide → BorderSide
-
Defines the border line's color and weight.
finalinherited
- dimensions → EdgeInsetsGeometry
-
The widths of the sides of this border represented as an EdgeInsets.
no setteroverride
- gapPadding → double
-
Horizontal padding on either side of the border's
InputDecoration.labelText width gap.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isOutline → bool
-
True if this border will enclose the InputDecorator's container.
no setteroverride
- preferPaintInterior → bool
-
Reports whether paintInterior is implemented.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shape → ShapeBorder
-
The shape of the border.
final
Methods
-
add(
ShapeBorder other, {bool reversed = false}) → ShapeBorder? -
Attempts to create a new object that represents the amalgamation of
thisborder and theotherborder.inherited -
copyWith(
{BorderSide? borderSide, ShapeBorder? shape, double? gapPadding}) → ShapedInputBorder -
Creates a copy of this input border with the specified
borderSide.override -
getInnerPath(
Rect rect, {TextDirection? textDirection}) → Path -
Create a Path that describes the inner edge of the border.
override
-
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.override -
lerpTo(
ShapeBorder? b, double t) → ShapeBorder? -
Linearly interpolates from
thisto another ShapeBorder (possibly of another class).override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
paint(
Canvas canvas, Rect rect, {double? gapStart, double gapExtent = 0.0, double gapPercentage = 0.0, TextDirection? textDirection}) → void -
Draw the custom shape around
rect.override -
paintInterior(
Canvas canvas, Rect rect, Paint paint, {TextDirection? textDirection}) → void -
Paint a canvas with the appropriate shape.
override
-
scale(
double t) → ShapedInputBorder -
Creates a copy of this border, scaled by the factor
t.override -
toString(
) → String -
A string representation of this object.
inherited
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