pub trait InputBorder: ShapeBorder {
// Required methods
fn border_side(&self) -> BorderSide;
fn copy_with(&self, border_side: Option<BorderSide>) -> InputBorderRef;
fn is_outline(&self) -> bool;
fn paint(
&self,
canvas: &mut Canvas,
rect: Rect,
gap_start: Option<f64>,
gap_extent: f64,
gap_percentage: f64,
text_direction: Option<TextDirection>,
);
// Provided method
fn as_widget_state_property(
&self,
) -> Option<&dyn WidgetStateProperty<InputBorderRef>> { ... }
}Expand description
Defines the appearance of an InputDecorator’s border.
An input decorator’s border is specified by InputDecoration.border.
The border is drawn relative to the input decorator’s “container” which is the optionally filled area above the decorator’s helper, error, and counter.
Input border’s are decorated with a line whose weight and color are defined
by border_side. The input decorator’s renderer animates the input
border’s appearance in response to state changes, like gaining or losing the focus,
by creating new copies of its input border with copy_with.
See also:
UnderlineInputBorder, the defaultInputDecoratorborder which draws a horizontal line at the bottom of the input decorator’s container.OutlineInputBorder, anInputDecoratorborder which draws a rounded rectangle around the input decorator’s container.InputDecoration, which is used to configure anInputDecorator.
Required Methods§
Sourcefn border_side(&self) -> BorderSide
fn border_side(&self) -> BorderSide
Defines the border line’s color and weight.
The InputDecorator creates copies of its input border, using copy_with,
based on the current theme and InputDecorator.isFocused.
Sourcefn copy_with(&self, border_side: Option<BorderSide>) -> InputBorderRef
fn copy_with(&self, border_side: Option<BorderSide>) -> InputBorderRef
Creates a copy of this input border with the specified border_side.
Sourcefn is_outline(&self) -> bool
fn is_outline(&self) -> bool
True if this border will enclose the InputDecorator’s container.
This property affects the alignment of container’s contents. For example
when an input decorator is configured with an OutlineInputBorder its
label is centered with its container.
Sourcefn paint(
&self,
canvas: &mut Canvas,
rect: Rect,
gap_start: Option<f64>,
gap_extent: f64,
gap_percentage: f64,
text_direction: Option<TextDirection>,
)
fn paint( &self, canvas: &mut Canvas, rect: Rect, gap_start: Option<f64>, gap_extent: f64, gap_percentage: f64, text_direction: Option<TextDirection>, )
Paint this input border on canvas.
The rect parameter bounds the InputDecorator’s container.
The additional gap parameters reflect the state of the InputDecorator’s
floating label. When an input decorator gains the focus, its label
animates upwards, to make room for the input child. The gap_start and
gap_extent parameters define a floating label width interval, and
gap_percentage defines the animation’s progress (0.0 to 1.0).
Dart’s defaults are gap_extent: 0.0 and gap_percentage: 0.0, which the border’s
ShapeBorder::paint passes.
Provided Methods§
Sourcefn as_widget_state_property(
&self,
) -> Option<&dyn WidgetStateProperty<InputBorderRef>>
fn as_widget_state_property( &self, ) -> Option<&dyn WidgetStateProperty<InputBorderRef>>
Dart’s border is WidgetStateProperty<InputBorder>: this border as the property it
also is, for the borders that implement WidgetStateProperty (WidgetStateInputBorder
and the deprecated MaterialState input borders).
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".