Skip to content

Commit

Permalink
refactor: separate mobile and desktop selection gesture detector
Browse files Browse the repository at this point in the history
  • Loading branch information
hyj1204 committed Aug 3, 2023
1 parent 6706292 commit 6074779
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:flutter/material.dart' hide Overlay, OverlayEntry;

import 'package:appflowy_editor/src/render/selection/cursor_widget.dart';
import 'package:appflowy_editor/src/render/selection/selection_widget.dart';
import 'package:appflowy_editor/src/service/selection/selection_gesture.dart';
import 'package:appflowy_editor/src/service/selection/desktop_selection_gesture_detector.dart';
import 'package:provider/provider.dart';

class DesktopSelectionServiceWidget extends StatefulWidget {
Expand Down Expand Up @@ -88,7 +88,7 @@ class _DesktopSelectionServiceWidgetState

@override
Widget build(BuildContext context) {
return SelectionGestureDetector(
return DesktopSelectionGestureDetector(
onPanStart: _onPanStart,
onPanUpdate: _onPanUpdate,
onPanEnd: _onPanEnd,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:appflowy_editor/src/flutter/overlay.dart';
import 'package:appflowy_editor/src/render/selection/mobile_selection_widget.dart';
import 'package:appflowy_editor/src/service/selection/mobile_selection_gesture.dart';
import 'package:appflowy_editor/src/service/selection/mobile_selection_gesture_detector.dart';
import 'package:flutter/material.dart' hide Overlay, OverlayEntry;

import 'package:appflowy_editor/src/render/selection/cursor_widget.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import 'package:flutter/material.dart';
/// Because the flutter's [DoubleTapGestureRecognizer] will block the [TapGestureRecognizer]
/// for a while. So we need to implement our own GestureDetector.
@immutable
class SelectionGestureDetector extends StatefulWidget {
const SelectionGestureDetector({
class DesktopSelectionGestureDetector extends StatefulWidget {
const DesktopSelectionGestureDetector({
Key? key,
this.child,
this.onTapDown,
Expand All @@ -20,8 +20,8 @@ class SelectionGestureDetector extends StatefulWidget {
}) : super(key: key);

@override
State<SelectionGestureDetector> createState() =>
SelectionGestureDetectorState();
State<DesktopSelectionGestureDetector> createState() =>
DesktopSelectionGestureDetectorState();

final Widget? child;

Expand All @@ -34,7 +34,8 @@ class SelectionGestureDetector extends StatefulWidget {
final GestureDragEndCallback? onPanEnd;
}

class SelectionGestureDetectorState extends State<SelectionGestureDetector> {
class DesktopSelectionGestureDetectorState
extends State<DesktopSelectionGestureDetector> {
bool _isDoubleTap = false;
Timer? _doubleTapTimer;
int _tripleTabCount = 0;
Expand Down

0 comments on commit 6074779

Please sign in to comment.