“mengabaikan keyboard flutter” Kode Jawaban

pemicu flutter memamerkan keyboard

FocusScope.of(context).unfocus()
Brave Booby

mengabaikan keyboard flutter

// The correct way of closing the keyboard is

FocusScope.of(context).unfocus();
Flutter Guy

Tutup keyboard pada tombol klik flutter

class _HomeState extends State<Home> {
 var currentFocus;
    
 unfocus() {
    currentFocus = FocusScope.of(context);

    if (!currentFocus.hasPrimaryFocus) {
      currentFocus.unfocus();
    }
  }
  
Widget build(BuildContext context) {
    return GestureDetector(
      onTap: unfocus,
      child: Scaffold(...)
      )
     }
DevPedrada

Keyboard dekat

FocusScope.of(context).unfocus();
Helpful Hare

cara mengabaikan keyboard di Swift

override func viewDidLoad() {
    super.viewDidLoad()

    //Looks for single or multiple taps. 
    let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: "dismissKeyboard")

    //Uncomment the line below if you want the tap not not interfere and cancel other interactions.
    //tap.cancelsTouchesInView = false 

    view.addGestureRecognizer(tap)
}

//Calls this function when the tap is recognized.
@objc func dismissKeyboard() {
    //Causes the view (or one of its embedded text fields) to resign the first responder status.
    view.endEditing(true)
}
Encouraging Eland

Android mengabaikan keyboard

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
Serial Koder

Jawaban yang mirip dengan “mengabaikan keyboard flutter”

Pertanyaan yang mirip dengan “mengabaikan keyboard flutter”

Lebih banyak jawaban terkait untuk “mengabaikan keyboard flutter” di Dart

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya