From 0b83684c660698308e9a88a6f3e5b8efc114fa57 Mon Sep 17 00:00:00 2001 From: appflowy Date: Wed, 1 Jun 2022 16:40:24 +0800 Subject: [PATCH] chore: optimaze tap area of row detail cells --- .../grid/src/widgets/row/number_cell.dart | 44 ------------------- .../grid/src/widgets/row/row_detail.dart | 16 ++++--- 2 files changed, 10 insertions(+), 50 deletions(-) delete mode 100644 frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/number_cell.dart diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/number_cell.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/number_cell.dart deleted file mode 100644 index 0f3f7c5f32..0000000000 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/number_cell.dart +++ /dev/null @@ -1,44 +0,0 @@ -import 'package:app_flowy/startup/startup.dart'; -import 'package:app_flowy/workspace/application/grid/prelude.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; - -class NumberCell extends StatefulWidget { - final GridCell cellData; - - const NumberCell({ - required this.cellData, - Key? key, - }) : super(key: key); - - @override - State createState() => _NumberCellState(); -} - -class _NumberCellState extends State { - late NumberCellBloc _cellBloc; - - @override - void initState() { - _cellBloc = getIt(param1: widget.cellData); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return BlocProvider.value( - value: _cellBloc, - child: BlocBuilder( - builder: (context, state) { - return Container(); - }, - ), - ); - } - - @override - Future dispose() async { - _cellBloc.close(); - super.dispose(); - } -} diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart index 029f3f61ea..fbff4665d9 100644 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart @@ -152,6 +152,15 @@ class _RowDetailCell extends StatelessWidget { final style = _customCellStyle(theme, gridCell.field.fieldType); final cell = buildGridCellWidget(gridCell, cellCache, style: style); + final gesture = GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: () => cell.requestBeginFocus.notify(), + child: AccessoryHover( + child: cell, + contentPadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 12), + ), + ); + return ConstrainedBox( constraints: const BoxConstraints(minHeight: 40), child: IntrinsicHeight( @@ -164,12 +173,7 @@ class _RowDetailCell extends StatelessWidget { child: FieldCellButton(field: gridCell.field, onTap: () => _showFieldEditor(context)), ), const HSpace(10), - Expanded( - child: AccessoryHover( - child: cell, - contentPadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 12), - ), - ), + Expanded(child: gesture), ], ), ),