mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: tap event conflict when dragging grid header cell
This commit is contained in:
parent
bdf4e60b48
commit
0ff08ff8d2
@ -45,7 +45,7 @@ test "" = "$(grep '^Signed-off-by: ' "$1" |
|
|||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
printError "Please fix your commit message to match AppFlowy coding standards"
|
printError "Please fix your commit message to match AppFlowy coding standards"
|
||||||
printError "https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/software-contributions/submitting-code/style-guides"
|
printError "https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/software-contributions/submitting-code/code-submission-guidelines#commit-message-guidelines"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -65,7 +65,6 @@ class _SettingButtonState extends State<_SettingButton> {
|
|||||||
return AppFlowyPopover(
|
return AppFlowyPopover(
|
||||||
controller: popoverController,
|
controller: popoverController,
|
||||||
constraints: BoxConstraints.loose(const Size(260, 400)),
|
constraints: BoxConstraints.loose(const Size(260, 400)),
|
||||||
triggerActions: PopoverTriggerFlags.click,
|
|
||||||
child: FlowyIconButton(
|
child: FlowyIconButton(
|
||||||
hoverColor: theme.hover,
|
hoverColor: theme.hover,
|
||||||
width: 22,
|
width: 22,
|
||||||
|
@ -220,7 +220,6 @@ class _EditURLAccessoryState extends State<_EditURLAccessory>
|
|||||||
constraints: BoxConstraints.loose(const Size(300, 160)),
|
constraints: BoxConstraints.loose(const Size(300, 160)),
|
||||||
controller: _popoverController,
|
controller: _popoverController,
|
||||||
direction: PopoverDirection.bottomWithLeftAligned,
|
direction: PopoverDirection.bottomWithLeftAligned,
|
||||||
triggerActions: PopoverTriggerFlags.click,
|
|
||||||
offset: const Offset(0, 20),
|
offset: const Offset(0, 20),
|
||||||
child: svgWidget("editor/edit", color: theme.iconColor),
|
child: svgWidget("editor/edit", color: theme.iconColor),
|
||||||
popupBuilder: (BuildContext popoverContext) {
|
popupBuilder: (BuildContext popoverContext) {
|
||||||
|
@ -15,34 +15,47 @@ import 'field_type_extension.dart';
|
|||||||
|
|
||||||
import 'field_cell_action_sheet.dart';
|
import 'field_cell_action_sheet.dart';
|
||||||
|
|
||||||
class GridFieldCell extends StatelessWidget {
|
class GridFieldCell extends StatefulWidget {
|
||||||
final GridFieldCellContext cellContext;
|
final GridFieldCellContext cellContext;
|
||||||
const GridFieldCell({
|
const GridFieldCell({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.cellContext,
|
required this.cellContext,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<GridFieldCell> createState() => _GridFieldCellState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _GridFieldCellState extends State<GridFieldCell> {
|
||||||
|
late PopoverController popoverController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
popoverController = PopoverController();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) {
|
create: (context) {
|
||||||
return FieldCellBloc(cellContext: cellContext);
|
return FieldCellBloc(cellContext: widget.cellContext);
|
||||||
},
|
},
|
||||||
child: BlocBuilder<FieldCellBloc, FieldCellState>(
|
child: BlocBuilder<FieldCellBloc, FieldCellState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final button = AppFlowyPopover(
|
final button = AppFlowyPopover(
|
||||||
|
triggerActions: PopoverTriggerFlags.none,
|
||||||
constraints: BoxConstraints.loose(const Size(240, 840)),
|
constraints: BoxConstraints.loose(const Size(240, 840)),
|
||||||
direction: PopoverDirection.bottomWithLeftAligned,
|
direction: PopoverDirection.bottomWithLeftAligned,
|
||||||
triggerActions: PopoverTriggerFlags.click,
|
controller: popoverController,
|
||||||
offset: const Offset(0, 10),
|
|
||||||
popupBuilder: (BuildContext context) {
|
popupBuilder: (BuildContext context) {
|
||||||
return GridFieldCellActionSheet(
|
return GridFieldCellActionSheet(
|
||||||
cellContext: cellContext,
|
cellContext: widget.cellContext,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: FieldCellButton(
|
child: FieldCellButton(
|
||||||
field: cellContext.field,
|
field: widget.cellContext.field,
|
||||||
onTap: () {},
|
onTap: () => popoverController.show(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -102,10 +102,8 @@ class _GridHeaderState extends State<_GridHeader> {
|
|||||||
.where((field) => field.visibility)
|
.where((field) => field.visibility)
|
||||||
.map((field) =>
|
.map((field) =>
|
||||||
GridFieldCellContext(gridId: widget.gridId, field: field.field))
|
GridFieldCellContext(gridId: widget.gridId, field: field.field))
|
||||||
.map((ctx) => GridFieldCell(
|
.map((ctx) =>
|
||||||
key: _getKeyById(ctx.field.id),
|
GridFieldCell(key: _getKeyById(ctx.field.id), cellContext: ctx))
|
||||||
cellContext: ctx,
|
|
||||||
))
|
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
@ -115,6 +113,7 @@ class _GridHeaderState extends State<_GridHeader> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
scrollController: ScrollController(),
|
scrollController: ScrollController(),
|
||||||
header: const _CellLeading(),
|
header: const _CellLeading(),
|
||||||
|
needsLongPressDraggable: false,
|
||||||
footer: _CellTrailing(gridId: widget.gridId),
|
footer: _CellTrailing(gridId: widget.gridId),
|
||||||
onReorder: (int oldIndex, int newIndex) {
|
onReorder: (int oldIndex, int newIndex) {
|
||||||
_onReorder(cells, oldIndex, context, newIndex);
|
_onReorder(cells, oldIndex, context, newIndex);
|
||||||
@ -177,7 +176,6 @@ class CreateFieldButton extends StatelessWidget {
|
|||||||
final theme = context.watch<AppTheme>();
|
final theme = context.watch<AppTheme>();
|
||||||
|
|
||||||
return AppFlowyPopover(
|
return AppFlowyPopover(
|
||||||
triggerActions: PopoverTriggerFlags.click,
|
|
||||||
direction: PopoverDirection.bottomWithRightAligned,
|
direction: PopoverDirection.bottomWithRightAligned,
|
||||||
asBarrier: true,
|
asBarrier: true,
|
||||||
constraints: BoxConstraints.loose(const Size(240, 600)),
|
constraints: BoxConstraints.loose(const Size(240, 600)),
|
||||||
|
@ -192,7 +192,6 @@ class _CreateFieldButtonState extends State<_CreateFieldButton> {
|
|||||||
return AppFlowyPopover(
|
return AppFlowyPopover(
|
||||||
constraints: BoxConstraints.loose(const Size(240, 200)),
|
constraints: BoxConstraints.loose(const Size(240, 200)),
|
||||||
controller: popoverController,
|
controller: popoverController,
|
||||||
triggerActions: PopoverTriggerFlags.click,
|
|
||||||
direction: PopoverDirection.topWithLeftAligned,
|
direction: PopoverDirection.topWithLeftAligned,
|
||||||
onClose: widget.onClosed,
|
onClose: widget.onClosed,
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -118,7 +118,6 @@ class _GridPropertyCell extends StatelessWidget {
|
|||||||
Widget _editFieldButton(AppTheme theme, BuildContext context) {
|
Widget _editFieldButton(AppTheme theme, BuildContext context) {
|
||||||
return AppFlowyPopover(
|
return AppFlowyPopover(
|
||||||
mutex: popoverMutex,
|
mutex: popoverMutex,
|
||||||
triggerActions: PopoverTriggerFlags.click,
|
|
||||||
offset: const Offset(20, 0),
|
offset: const Offset(20, 0),
|
||||||
constraints: BoxConstraints.loose(const Size(240, 400)),
|
constraints: BoxConstraints.loose(const Size(240, 400)),
|
||||||
child: FlowyButton(
|
child: FlowyButton(
|
||||||
|
@ -55,7 +55,6 @@ class _SettingButton extends StatelessWidget {
|
|||||||
final theme = context.watch<AppTheme>();
|
final theme = context.watch<AppTheme>();
|
||||||
return AppFlowyPopover(
|
return AppFlowyPopover(
|
||||||
constraints: BoxConstraints.loose(const Size(260, 400)),
|
constraints: BoxConstraints.loose(const Size(260, 400)),
|
||||||
triggerActions: PopoverTriggerFlags.click,
|
|
||||||
offset: const Offset(0, 10),
|
offset: const Offset(0, 10),
|
||||||
child: FlowyIconButton(
|
child: FlowyIconButton(
|
||||||
width: 22,
|
width: 22,
|
||||||
|
@ -17,8 +17,9 @@ class PopoverController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PopoverTriggerFlags {
|
class PopoverTriggerFlags {
|
||||||
static int click = 0x01;
|
static const int none = 0x00;
|
||||||
static int hover = 0x02;
|
static const int click = 0x01;
|
||||||
|
static const int hover = 0x02;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum PopoverDirection {
|
enum PopoverDirection {
|
||||||
|
@ -20,9 +20,9 @@ class AppFlowyPopover extends StatelessWidget {
|
|||||||
required this.popupBuilder,
|
required this.popupBuilder,
|
||||||
this.direction = PopoverDirection.rightWithTopAligned,
|
this.direction = PopoverDirection.rightWithTopAligned,
|
||||||
this.onClose,
|
this.onClose,
|
||||||
this.constraints,
|
this.constraints = const BoxConstraints(maxWidth: 240, maxHeight: 600),
|
||||||
this.mutex,
|
this.mutex,
|
||||||
this.triggerActions = 0,
|
this.triggerActions = PopoverTriggerFlags.click,
|
||||||
this.offset,
|
this.offset,
|
||||||
this.controller,
|
this.controller,
|
||||||
this.asBarrier = false,
|
this.asBarrier = false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user