From 64ee3140a301bcf9b995b614293bcafb8c0dd6cc Mon Sep 17 00:00:00 2001 From: "Nathan.fooo" <86001920+appflowy@users.noreply.github.com> Date: Mon, 5 Dec 2022 17:17:33 +0800 Subject: [PATCH] fix: click enter to submit the text content (#1537) Co-authored-by: nathan --- .../presentation/widgets/cell/text_cell.dart | 19 +++---------------- .../select_option/select_option.dart | 9 --------- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/text_cell.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/text_cell.dart index baae29c93d..8ed5502599 100644 --- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/text_cell.dart +++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/text_cell.dart @@ -37,7 +37,6 @@ class GridTextCell extends GridCellWidget { class _GridTextCellState extends GridFocusNodeCellState { late TextCellBloc _cellBloc; late TextEditingController _controller; - Timer? _delayOperation; @override void initState() { @@ -66,7 +65,9 @@ class _GridTextCellState extends GridFocusNodeCellState { child: TextField( controller: _controller, focusNode: focusNode, - onChanged: (value) => focusChanged(), + onSubmitted: (text) => _cellBloc.add( + TextCellEvent.updateText(text), + ), onEditingComplete: () => focusNode.unfocus(), maxLines: null, style: Theme.of(context).textTheme.bodyMedium, @@ -87,24 +88,10 @@ class _GridTextCellState extends GridFocusNodeCellState { @override Future dispose() async { - _delayOperation = null; _cellBloc.close(); super.dispose(); } - @override - Future focusChanged() async { - if (mounted) { - _delayOperation?.cancel(); - _delayOperation = Timer(const Duration(milliseconds: 30), () { - if (_cellBloc.isClosed == false && - _controller.text != _cellBloc.state.content) { - _cellBloc.add(TextCellEvent.updateText(_controller.text)); - } - }); - } - } - @override String? onCopy() => _cellBloc.state.content; diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/filter/choicechip/select_option/select_option.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/filter/choicechip/select_option/select_option.dart index b8a1849a41..8f835a032d 100644 --- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/filter/choicechip/select_option/select_option.dart +++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/filter/choicechip/select_option/select_option.dart @@ -167,12 +167,3 @@ class _SelectOptionFilterEditorState extends State { ); } } - -class _FilterPannel extends StatelessWidget { - const _FilterPannel({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Container(); - } -}