Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

nodeFocus flutter



FocusNode focusNode;

void initState() {
  focusNode = new FocusNode();

  // listen to focus changes
  focusNode.addListener(() => print('focusNode updated: hasFocus: ${focusNode.hasFocus}')); 
}

void setFocus() {
  FocusScope.of(context).requestFocus(focusNode);
}

Widget build() {
  return
  ...
  new TextField(focusNode: focusNode, ...);
}

Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #nodeFocus #flutter
ADD COMMENT
Topic
Name
3+7 =