Inputbox border

How to set  Text Input in Flutter?

    

A material design text field.

A text field lets the user enter text, either with hardware keyboard or with an onscreen keyboard.
The text field calls the onChanged callback whenever the user changes the text in the field. If the user indicates that they are done typing in the field (e.g., by pressing a button on the soft keyboard), the text field calls the onSubmitted callback.
To control the text that is displayed in the text field, use the controller. For example, to set the initial value of the text field, use a controller that already contains some text. The controller can also control the selection and composing region (and to observe changes to the text, selection, and composing region).
By default, a text field has a decoration that draws a divider below the text field. You can use the decoration property to control the decoration, for example by adding a label or an icon. If you set the decoration property to null, the decoration will be removed entirely, including the extra padding introduced by the decoration to save space for the labels.
If decoration is non-null (which is the default), the text field requires one of its ancestors to be a Material widget. When the TextField is tapped an ink splash that paints on the material is triggered, see ThemeData.splashFactory


TextField({Key keyTextEditingController controllerFocusNode focusNodeInputDecoration decorationconst InputDecoration()
TextInputType keyboardTypeTextInputAction textInputActionTextCapitalization textCapitalizationTextCapitalization.none,
 TextStyle styleTextAlign textAlignTextAlign.startTextDirection textDirectionbool autofocusfalsebool obscureTextfalse,
 bool autocorrecttrueint maxLines1int maxLengthbool maxLengthEnforcedtrueValueChanged<String> onChangedVoidCallback onEditingCompleteValueChanged<String> onSubmittedList<TextInputFormatter> inputFormattersbool enableddouble cursorWidth2.0Radius cursorRadiusColor cursorColor
Brightness keyboardAppearanceEdgeInsets scrollPaddingconst EdgeInsets.all(20.0)
DragStartBehavior dragStartBehaviorDragStartBehavior.down,
 bool enableInteractiveSelectionGestureTapCallback onTapInputCounterWidgetBuilder buildCounter })
Example:

TextFormField(
   decoration:InputDecoration(
       labelText:" Input ",
       border:OutlineInputBorder(
         ......
               borderRadius:BorderRadius.circular(5.0)
       ),
   ),
style:TextStyle(color:Colors.black,fontSize:16.0),
keyboardType:setKeyboardType(number),
autovalidate:--------,
obscureText:false,
onSaved:-------,
)

 1.Decoration:
{InputDecoration decoration: const InputDecoration()}
Creates a [FormField] that contains a [TextField].
When a [controller] is specified, [initialValue] must be null (the default). If [controller] is null, then a [TextEditingController] will be constructed automatically and its text will be initialized to [initalValue] or the empty string.
For documentation about the various parameters, see the [TextField] class and [new TextField], the constructor.
2.style:
{TextStyle style}
Creates a [FormField] that contains a [TextField].
When a [controller] is specified, [initialValue] must be null (the default). If [controller] is null, then a [TextEditingController] will be constructed automatically and its text will be initialized to [initalValue] or the empty string.
For documentation about the various parameters, see the [TextField] class and [new TextField], the constructor.
3.border:
{InputBorder border}
The shape of the border to draw around the decoration's container.
This border's [InputBorder.borderSide], i.e. the border's color and width, will be overridden to reflect the input decorator's state. Only the border's shape is used. If custom [BorderSide] values are desired for a given state, all four borders – [errorBorder], [focusedBorder], [enabledBorder], [disabledBorder] – must be set.
The decoration's container is the area which is filled if [isFilled] is true and bordered per the [border]. It's the area adjacent to [InputDecoration.icon] and above the widgets that contain [InputDecoration.helperText], [InputDecoration.errorText], and [InputDecoration.counterText].
The border's bounds, i.e. the value of border.getOuterPath(), define the area to be filled.
This property is only used when the appropriate one of [errorBorder], [focusedBorder], [focusedErrorBorder], [disabledBorder], or [enabledBorder] is not specified. This border's [InputBorder.borderSide] property is configured by the InputDecorator, depending on the values of [InputDecoration.errorText], [InputDecoration.enabled], [InputDecorator.isFocused and the current [Theme].
Typically one of [UnderlineInputBorder] or [OutlineInputBorder]. If null, InputDecorator's default is const UnderlineInputBorder().
See also:
  • [InputBorder.none], which doesn't draw a border.
  • [UnderlineInputBorder], which draws a horizontal line at the bottom of the input decorator's container.
  • [OutlineInputBorder], an [InputDecorator] border which draws a rounded rectangle around the input decorator's container.
4.OnSaved:
{(String) → void onSaved}
Creates a [FormField] that contains a [TextField].
When a [controller] is specified, [initialValue] must be null (the default). If [controller] is null, then a [TextEditingController] will be constructed automatically and its text will be initialized to [initalValue] or the empty string.
For documentation about the various parameters, see the [TextField] class and [new TextField], the constructor.
s
d    5.key:
{Key key}
Creates a [FormField] that contains a [TextField].
When a [controller] is specified, [initialValue] must be null (the default). If [controller] is null, then a [TextEditingController] will be constructed automatically and its text will be initialized to [initalValue] or the empty string.
For documentation about the various parameters, see the [TextField] class and [new TextField], the constructor.

Comments

Popular Posts