Answers for "flutter textfield unfocus"

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
2

flutter unfocus textfield

FocusScope.of(context).unfocus();
Posted by: Guest on October-12-2020
0

flutter unfocus textfield

FocusScopeNode currentFocus = FocusScope.of(context);

if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
Posted by: Guest on March-21-2021
0

unfocus textfield flutter

FocusScope.of(context).unfocus();
_textEditingController.clear();
Posted by: Guest on June-23-2020

Code answers related to "flutter textfield unfocus"

Browse Popular Code Answers by Language