pub struct InputDecorator {
pub key: Option<KeyRef>,
pub decoration: InputDecoration,
pub base_style: Option<TextStyle>,
pub text_align: Option<TextAlign>,
pub text_align_vertical: Option<TextAlignVertical>,
pub is_focused: bool,
pub is_hovering: bool,
pub expands: bool,
pub is_empty: bool,
pub child: Option<WidgetRef>,
}Expand description
Defines the appearance of a Material Design text field.
InputDecorator displays the visual elements of a Material Design text
field around its input child. The visual elements themselves are defined
by an InputDecoration object and their layout and appearance depend
on the base_style, text_align, is_focused, and is_empty parameters.
TextField uses this widget to decorate its EditableText child.
InputDecorator can be used to create widgets that look and behave like a
TextField but support other kinds of input.
Requires one of its ancestors to be a Material widget. The child widget,
as well as the decorative widgets specified in decoration, must have
non-negative baselines.
See also:
TextField, which uses anInputDecoratorto display a border, labels, and icons, around itsEditableTextchild.DecorationandDecoratedBox, for drawing arbitrary decorations around other widgets.
Fields§
§key: Option<KeyRef>§decoration: InputDecorationThe text and styles to use when decorating the child.
Null InputDecoration properties are initialized with the corresponding
values from the ambient InputDecorationThemeData.
base_style: Option<TextStyle>The style on which to base the label, hint, counter, and error styles
if the decoration does not provide explicit styles.
If null, base_style defaults to the title_medium style from the
current Theme, see ThemeData::text_theme.
The TextStyle::text_baseline of the base_style is used to
determine the baseline used for text alignment.
text_align: Option<TextAlign>How the text in the decoration should be aligned horizontally.
text_align_vertical: Option<TextAlignVertical>How the text should be aligned vertically.
Determines the alignment of the baseline within the available space of
the input (typically a TextField). For example, TextAlignVertical::TOP will
place the baseline such that the text, and any attached decoration like
prefix and suffix, is as close to the top of the input as possible without
overflowing. The heights of the prefix and suffix are similarly included
for other alignment values. If the height is greater than the height
available, then the prefix and suffix will be allowed to overflow first
before the text scrolls.
is_focused: boolWhether the input field has focus.
Determines the position of the label text and the color and weight of the border.
Defaults to false.
See also:
InputDecoration::hover_color, which is also blended into the focus color and fill color when theis_hoveringis true to produce the final color.
is_hovering: boolWhether the input field is being hovered over by a mouse pointer.
Determines the container fill color, which is a blend of
InputDecoration::hover_color with InputDecoration::fill_color when
true, and InputDecoration::fill_color when not.
Defaults to false.
expands: boolIf true, the height of the input field will be as large as possible.
If wrapped in a widget that constrains its child’s height, like Expanded
or SizedBox, the input field will only be affected if expands is
set to true.
See TextField::min_lines and TextField::max_lines for related ways to
affect the height of an input. When expands is true, both must be
null in order to avoid ambiguity in determining the height.
Defaults to false.
is_empty: boolWhether the input field is empty.
Determines the position of the label text and whether to display the hint text.
Defaults to false.
child: Option<WidgetRef>The widget below this widget in the tree.
Typically an EditableText, DropdownButton, or InkWell.
Implementations§
Source§impl InputDecorator
impl InputDecorator
Sourcepub fn new(decoration: InputDecoration) -> InputDecorator
pub fn new(decoration: InputDecoration) -> InputDecorator
Creates a widget that displays a border, labels, and icons,
for a TextField.
Sourcepub fn key(self, key: KeyRef) -> InputDecorator
pub fn key(self, key: KeyRef) -> InputDecorator
Dart InputDecorator(key:).
Sourcepub fn base_style(self, base_style: TextStyle) -> InputDecorator
pub fn base_style(self, base_style: TextStyle) -> InputDecorator
Dart InputDecorator(baseStyle:).
Sourcepub fn text_align(self, text_align: TextAlign) -> InputDecorator
pub fn text_align(self, text_align: TextAlign) -> InputDecorator
Dart InputDecorator(textAlign:).
Sourcepub fn text_align_vertical(
self,
text_align_vertical: TextAlignVertical,
) -> InputDecorator
pub fn text_align_vertical( self, text_align_vertical: TextAlignVertical, ) -> InputDecorator
Dart InputDecorator(textAlignVertical:).
Sourcepub fn is_focused(self, is_focused: bool) -> InputDecorator
pub fn is_focused(self, is_focused: bool) -> InputDecorator
Dart InputDecorator(isFocused:).
Sourcepub fn is_hovering(self, is_hovering: bool) -> InputDecorator
pub fn is_hovering(self, is_hovering: bool) -> InputDecorator
Dart InputDecorator(isHovering:).
Sourcepub fn expands(self, expands: bool) -> InputDecorator
pub fn expands(self, expands: bool) -> InputDecorator
Dart InputDecorator(expands:).
Sourcepub fn is_empty(self, is_empty: bool) -> InputDecorator
pub fn is_empty(self, is_empty: bool) -> InputDecorator
Dart InputDecorator(isEmpty:).
Sourcepub fn child<K>(self, child: impl IntoWidget<K>) -> InputDecorator
pub fn child<K>(self, child: impl IntoWidget<K>) -> InputDecorator
Dart InputDecorator(child:).
Sourcepub fn container_of(app: &App, context: BuildContext) -> Option<AnyRenderBox>
pub fn container_of(app: &App, context: BuildContext) -> Option<AnyRenderBox>
The RenderBox that defines this decorator’s “container”. That’s the
area which is filled if InputDecoration::filled is true. It’s the area
adjacent to InputDecoration::icon and above the widgets that contain
InputDecoration::helper_text, InputDecoration::error_text, and
InputDecoration::counter_text.
TextField renders ink splashes within the container.
Trait Implementations§
Source§impl Clone for InputDecorator
impl Clone for InputDecorator
Source§impl Debug for InputDecorator
impl Debug for InputDecorator
Source§impl StatefulWidget for InputDecorator
impl StatefulWidget for InputDecorator
Source§type State = InputDecoratorState
type State = InputDecoratorState
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties: the properties a dump shows for this widget, in Dart’s
order. Dart’s Widget base only sets the dense tree style, which the framework does.Source§fn create_state(&self) -> InputDecoratorState
fn create_state(&self) -> InputDecoratorState
Source§fn as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
Widget::type_name. A stateful form another widget kind becomes (an animated or
status transition widget) names the widget it wraps.Auto Trait Implementations§
impl !RefUnwindSafe for InputDecorator
impl !Send for InputDecorator
impl !Sync for InputDecorator
impl !UnwindSafe for InputDecorator
impl Forget for InputDecorator
impl Freeze for InputDecoratorwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
&'static dyn ColorExtension: Freeze,
*const RcInner<dyn ColorExtension> is !null: Freeze,
PhantomData<RcInner<dyn ColorExtension>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<String>: Freeze,
*const RcInner<Paint> is !null: Freeze,
PhantomData<RcInner<Paint>>: Freeze,
PhantomData<Shadow>: Freeze,
PhantomData<FontFeature>: Freeze,
PhantomData<FontVariation>: Freeze,
*const RcInner<dyn TextStyleExtension> is !null: Freeze,
PhantomData<RcInner<dyn TextStyleExtension>>: Freeze,
*const RcInner<dyn InputBorder> is !null: Freeze,
PhantomData<RcInner<dyn InputBorder>>: Freeze,
impl Move for InputDecorator
impl Unpin for InputDecorator
impl UnsafeUnpin for InputDecoratorwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
&'static dyn ColorExtension: UnsafeUnpin,
*const RcInner<dyn ColorExtension> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn ColorExtension>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
*const RcInner<Paint> is !null: UnsafeUnpin,
PhantomData<RcInner<Paint>>: UnsafeUnpin,
PhantomData<Shadow>: UnsafeUnpin,
PhantomData<FontFeature>: UnsafeUnpin,
PhantomData<FontVariation>: UnsafeUnpin,
*const RcInner<dyn TextStyleExtension> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn TextStyleExtension>>: UnsafeUnpin,
*const RcInner<dyn InputBorder> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn InputBorder>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.