fix: url cell mobile (#4029)

This commit is contained in:
Mathias Mogensen 2023-11-28 05:45:02 +02:00 committed by GitHub
parent 7c54b6d599
commit 1e6762b424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,6 +26,7 @@ class MobileURLCell extends GridCellWidget {
class _GridURLCellState extends GridCellState<MobileURLCell> {
late final URLCellBloc _cellBloc;
final FocusNode _focusNode = FocusNode();
@override
void initState() {
@ -39,6 +40,7 @@ class _GridURLCellState extends GridCellState<MobileURLCell> {
@override
Future<void> dispose() async {
_cellBloc.close();
_focusNode.dispose();
super.dispose();
}
@ -51,6 +53,7 @@ class _GridURLCellState extends GridCellState<MobileURLCell> {
builder: (context, content) {
if (content.isEmpty) {
return TextField(
focusNode: _focusNode,
keyboardType: TextInputType.url,
decoration: InputDecoration(
enabledBorder: InputBorder.none,
@ -62,11 +65,8 @@ class _GridURLCellState extends GridCellState<MobileURLCell> {
// close keyboard when tapping outside of the text field
onTapOutside: (event) =>
FocusManager.instance.primaryFocus?.unfocus(),
onSubmitted: (value) {
_cellBloc.add(
URLCellEvent.updateURL(value),
);
},
onSubmitted: (value) =>
_cellBloc.add(URLCellEvent.updateURL(value)),
);
}
@ -92,9 +92,7 @@ class _GridURLCellState extends GridCellState<MobileURLCell> {
autofocus: true,
keyboardType: TextInputType.url,
onEditingComplete: () {
_cellBloc.add(
URLCellEvent.updateURL(controller.text),
);
_cellBloc.add(URLCellEvent.updateURL(controller.text));
context.pop();
},
);
@ -115,5 +113,7 @@ class _GridURLCellState extends GridCellState<MobileURLCell> {
}
@override
void requestBeginFocus() {}
void requestBeginFocus() {
_focusNode.requestFocus();
}
}