Skip to content

Commit

Permalink
make sure that category editing starts after the first tap
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Zhdanov committed Dec 27, 2024
1 parent c2a7292 commit 50cc97d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/category/widget/category_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ class CategoryState extends ConsumerState<CategoryWidget> {
if (!_editing) {
setState(() {
_editing = true;
FocusScope.of(context).requestFocus(_focusNode);
// we need to request focus later because at the moment
// _editing = false, hence, the TextField was never shown
// in the elements tree yet. So, we need to wait for the
// next redrawing, when TextField will be shown, and request
// focus only after that
WidgetsBinding.instance.addPostFrameCallback((_) {
FocusScope.of(context).requestFocus(_focusNode);
});
});
}
}
Expand Down

0 comments on commit 50cc97d

Please sign in to comment.