mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: url cell mobile (#4029)
This commit is contained in:
parent
7c54b6d599
commit
1e6762b424
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user