fix(ui_kit): fix tab action focus on textinputs

This commit is contained in:
Malo Léon 2023-02-21 18:44:11 +01:00 committed by Hugo Pointcheval
parent 757a9382dc
commit b2eb8261a2
Signed by: hugo
GPG Key ID: 3AAC487E131E00BC

View File

@ -250,9 +250,11 @@ class TextInputScreen extends CubitScreen<TextInputCubit, TextInputState> {
Widget onBuild(BuildContext context, TextInputState state) {
final style = _resolve(context, state);
return Focus(
descendantsAreFocusable: true,
onFocusChange: (hasFocus) {
if (hasFocus) {
bloc(context).onFocus();
(focusNode ?? _focusNode).requestFocus();
} else {
bloc(context).onUnfocus();
}
@ -279,6 +281,7 @@ class TextInputScreen extends CubitScreen<TextInputCubit, TextInputState> {
expand: expand ?? true,
expanded: _wrapperExpanded(state),
child: TextField(
focusNode: focusNode ?? _focusNode,
onTap: onTap,
onChanged: (value) {
onChanged?.call(value);
@ -290,7 +293,6 @@ class TextInputScreen extends CubitScreen<TextInputCubit, TextInputState> {
},
onTapOutside: onTapOutside,
controller: controller ?? _controller,
focusNode: focusNode ?? _focusNode,
textAlignVertical: textAlignVertical ?? TextAlignVertical.top,
style: style.inputStyle ?? this.style,
decoration: InputDecoration(