flutter textfield disable keyboard code example

Example 1: hide keyboard flutter

FocusScope.of(context).unfocus()

Example 2: flutter disable text form field

TextFormField(
      enabled: false, //Not clickable and not editable
      readOnly: true, //Clickable and not editable
)

Example 3: how to disable paste option in textfield in flutter

TextFormField(
          enableInteractiveSelection: false,
          obscureText: true,
          style: styleText,
          textInputAction: TextInputAction.done,
          controller: _passwordController,
          focusNode: _passwordFocus,
          onFieldSubmitted: (term){
            _passwordFocus.unfocus();
          },
          keyboardType: TextInputType.text,
          validator: validatePassword,
          decoration: InputDecoration(
              focusedBorder: border,
              border: border,
              enabledBorder: border,
              hintStyle: styleText,
              hintText: 'Password'),
          onSaved: (String val) {
            _password = val;
          },
        ),

Tags:

Dart Example