Answers for "flutter textformfield disable focus"

3

flutter disable text form field

TextFormField(
      enabled: false, //Not clickable and not editable
      readOnly: true, //Clickable and not editable
)
Posted by: Guest on December-15-2020
0

remove focus textfield flutter

// main.dart
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        FocusScopeNode currentFocus = FocusScope.of(context);

        if (!currentFocus.hasPrimaryFocus) {
          currentFocus.unfocus();
        }
      },
      child: MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: MyHomePage(),
      ),
    );
  }
}
Posted by: Guest on June-27-2020

Code answers related to "flutter textformfield disable focus"

Browse Popular Code Answers by Language