Skip to content

Commit 2258e34

Browse files
authored
Merge pull request #1109 from AppFlowy-IO/fix/drag_grid_header_cell
fix: tap event conflict when dragging grid header cell
2 parents 03e3c2e + 437228d commit 2258e34

File tree

10 files changed

+29
-23
lines changed

10 files changed

+29
-23
lines changed

.githooks/commit-msg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test "" = "$(grep '^Signed-off-by: ' "$1" |
4545
if [ $? -ne 0 ]
4646
then
4747
printError "Please fix your commit message to match AppFlowy coding standards"
48-
printError "https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/software-contributions/submitting-code/style-guides"
48+
printError "https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/software-contributions/submitting-code/code-submission-guidelines#commit-message-guidelines"
4949
exit 1
5050
fi
5151

frontend/app_flowy/lib/plugins/board/presentation/toolbar/board_toolbar.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ class _SettingButtonState extends State<_SettingButton> {
6565
return AppFlowyPopover(
6666
controller: popoverController,
6767
constraints: BoxConstraints.loose(const Size(260, 400)),
68-
triggerActions: PopoverTriggerFlags.click,
6968
child: FlowyIconButton(
7069
hoverColor: theme.hover,
7170
width: 22,

frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/url_cell/url_cell.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ class _EditURLAccessoryState extends State<_EditURLAccessory>
220220
constraints: BoxConstraints.loose(const Size(300, 160)),
221221
controller: _popoverController,
222222
direction: PopoverDirection.bottomWithLeftAligned,
223-
triggerActions: PopoverTriggerFlags.click,
224223
offset: const Offset(0, 20),
225224
child: svgWidget("editor/edit", color: theme.iconColor),
226225
popupBuilder: (BuildContext popoverContext) {

frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/field_cell.dart

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,47 @@ import 'field_type_extension.dart';
1515

1616
import 'field_cell_action_sheet.dart';
1717

18-
class GridFieldCell extends StatelessWidget {
18+
class GridFieldCell extends StatefulWidget {
1919
final GridFieldCellContext cellContext;
2020
const GridFieldCell({
2121
Key? key,
2222
required this.cellContext,
2323
}) : super(key: key);
2424

25+
@override
26+
State<GridFieldCell> createState() => _GridFieldCellState();
27+
}
28+
29+
class _GridFieldCellState extends State<GridFieldCell> {
30+
late PopoverController popoverController;
31+
32+
@override
33+
void initState() {
34+
popoverController = PopoverController();
35+
super.initState();
36+
}
37+
2538
@override
2639
Widget build(BuildContext context) {
2740
return BlocProvider(
2841
create: (context) {
29-
return FieldCellBloc(cellContext: cellContext);
42+
return FieldCellBloc(cellContext: widget.cellContext);
3043
},
3144
child: BlocBuilder<FieldCellBloc, FieldCellState>(
3245
builder: (context, state) {
3346
final button = AppFlowyPopover(
47+
triggerActions: PopoverTriggerFlags.none,
3448
constraints: BoxConstraints.loose(const Size(240, 840)),
3549
direction: PopoverDirection.bottomWithLeftAligned,
36-
triggerActions: PopoverTriggerFlags.click,
37-
offset: const Offset(0, 10),
50+
controller: popoverController,
3851
popupBuilder: (BuildContext context) {
3952
return GridFieldCellActionSheet(
40-
cellContext: cellContext,
53+
cellContext: widget.cellContext,
4154
);
4255
},
4356
child: FieldCellButton(
44-
field: cellContext.field,
45-
onTap: () {},
57+
field: widget.cellContext.field,
58+
onTap: () => popoverController.show(),
4659
),
4760
);
4861

frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/grid_header.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,8 @@ class _GridHeaderState extends State<_GridHeader> {
102102
.where((field) => field.visibility)
103103
.map((field) =>
104104
GridFieldCellContext(gridId: widget.gridId, field: field.field))
105-
.map((ctx) => GridFieldCell(
106-
key: _getKeyById(ctx.field.id),
107-
cellContext: ctx,
108-
))
105+
.map((ctx) =>
106+
GridFieldCell(key: _getKeyById(ctx.field.id), cellContext: ctx))
109107
.toList();
110108

111109
return Container(
@@ -115,6 +113,7 @@ class _GridHeaderState extends State<_GridHeader> {
115113
crossAxisAlignment: CrossAxisAlignment.stretch,
116114
scrollController: ScrollController(),
117115
header: const _CellLeading(),
116+
needsLongPressDraggable: false,
118117
footer: _CellTrailing(gridId: widget.gridId),
119118
onReorder: (int oldIndex, int newIndex) {
120119
_onReorder(cells, oldIndex, context, newIndex);
@@ -177,7 +176,6 @@ class CreateFieldButton extends StatelessWidget {
177176
final theme = context.watch<AppTheme>();
178177

179178
return AppFlowyPopover(
180-
triggerActions: PopoverTriggerFlags.click,
181179
direction: PopoverDirection.bottomWithRightAligned,
182180
asBarrier: true,
183181
constraints: BoxConstraints.loose(const Size(240, 600)),

frontend/app_flowy/lib/plugins/grid/presentation/widgets/row/row_detail.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ class _CreateFieldButtonState extends State<_CreateFieldButton> {
192192
return AppFlowyPopover(
193193
constraints: BoxConstraints.loose(const Size(240, 200)),
194194
controller: popoverController,
195-
triggerActions: PopoverTriggerFlags.click,
196195
direction: PopoverDirection.topWithLeftAligned,
197196
onClose: widget.onClosed,
198197
child: Container(

frontend/app_flowy/lib/plugins/grid/presentation/widgets/toolbar/grid_property.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ class _GridPropertyCell extends StatelessWidget {
118118
Widget _editFieldButton(AppTheme theme, BuildContext context) {
119119
return AppFlowyPopover(
120120
mutex: popoverMutex,
121-
triggerActions: PopoverTriggerFlags.click,
122121
offset: const Offset(20, 0),
123122
constraints: BoxConstraints.loose(const Size(240, 400)),
124123
child: FlowyButton(

frontend/app_flowy/lib/plugins/grid/presentation/widgets/toolbar/grid_toolbar.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'package:appflowy_popover/appflowy_popover.dart';
21
import 'package:app_flowy/plugins/grid/application/setting/setting_bloc.dart';
32
import 'package:flowy_infra/image.dart';
43
import 'package:flowy_infra/theme.dart';
@@ -55,7 +54,6 @@ class _SettingButton extends StatelessWidget {
5554
final theme = context.watch<AppTheme>();
5655
return AppFlowyPopover(
5756
constraints: BoxConstraints.loose(const Size(260, 400)),
58-
triggerActions: PopoverTriggerFlags.click,
5957
offset: const Offset(0, 10),
6058
child: FlowyIconButton(
6159
width: 22,

frontend/app_flowy/packages/appflowy_popover/lib/src/popover.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ class PopoverController {
1717
}
1818

1919
class PopoverTriggerFlags {
20-
static int click = 0x01;
21-
static int hover = 0x02;
20+
static const int none = 0x00;
21+
static const int click = 0x01;
22+
static const int hover = 0x02;
2223
}
2324

2425
enum PopoverDirection {

frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/appflowy_stype_popover.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class AppFlowyPopover extends StatelessWidget {
2020
required this.popupBuilder,
2121
this.direction = PopoverDirection.rightWithTopAligned,
2222
this.onClose,
23-
this.constraints,
23+
this.constraints = const BoxConstraints(maxWidth: 240, maxHeight: 600),
2424
this.mutex,
25-
this.triggerActions = 0,
25+
this.triggerActions = PopoverTriggerFlags.click,
2626
this.offset,
2727
this.controller,
2828
this.asBarrier = false,

0 commit comments

Comments
 (0)