Skip to content

Commit

Permalink
Revert "fix: remove flutter overlay (#358)" (#427)
Browse files Browse the repository at this point in the history
* Revert "fix: remove flutter overlay (#358)"

This reverts commit 81fbb40.

* fix: hide toolbar when the selection area is invisible
  • Loading branch information
LucasXu0 authored Aug 29, 2023
1 parent 836e4cb commit e59b361
Show file tree
Hide file tree
Showing 13 changed files with 972 additions and 35 deletions.
2 changes: 1 addition & 1 deletion example/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
33CC10EC2044A3C60003C045 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
3 changes: 2 additions & 1 deletion lib/src/editor/editor_component/service/editor.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:appflowy_editor/src/flutter/overlay.dart';
import 'package:appflowy_editor/src/service/context_menu/built_in_context_menu_item.dart';
import 'package:flutter/material.dart';
import 'package:flutter/material.dart' hide Overlay, OverlayEntry;
import 'package:provider/provider.dart';

// workaround for the issue:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/material.dart';
import 'package:flutter/material.dart' hide Overlay, OverlayEntry, OverlayState;

class EditorService {
// selection service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:appflowy_editor/src/flutter/overlay.dart';
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:flutter/material.dart';
import 'package:flutter/material.dart' hide Overlay, OverlayEntry;
import 'package:provider/provider.dart';

class DesktopSelectionServiceWidget extends StatefulWidget {
Expand Down Expand Up @@ -361,7 +362,7 @@ class _DesktopSelectionServiceWidgetState
);
_selectionAreas.add(overlay);

Overlay.of(context).insertAll(_selectionAreas);
Overlay.of(context)?.insertAll(_selectionAreas);
}

void _updateSelectionAreas(Selection selection) {
Expand Down Expand Up @@ -478,7 +479,7 @@ class _DesktopSelectionServiceWidgetState
}

final overlay = Overlay.of(context);
overlay.insertAll(
overlay?.insertAll(
_selectionAreas,
);
}
Expand Down Expand Up @@ -513,7 +514,7 @@ class _DesktopSelectionServiceWidgetState

_cursorAreas.add(cursorArea);
selectionRects.add(selectable.transformRectToGlobal(cursorRect));
Overlay.of(context).insertAll(_cursorAreas);
Overlay.of(context)?.insertAll(_cursorAreas);

_forceShowCursor();
}
Expand Down Expand Up @@ -563,7 +564,7 @@ class _DesktopSelectionServiceWidgetState
);

_contextMenuAreas.add(contextMenu);
Overlay.of(context).insert(contextMenu);
Overlay.of(context)?.insert(contextMenu);
}

Node? _getNodeInOffset(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import 'package:flutter/material.dart';

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: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:provider/provider.dart';
Expand Down Expand Up @@ -367,7 +368,7 @@ class _MobileSelectionServiceWidgetState
);
_selectionAreas.add(overlay);

Overlay.of(context).insertAll(_selectionAreas);
Overlay.of(context)?.insertAll(_selectionAreas);
}

void _updateSelectionAreas(Selection selection) {
Expand Down Expand Up @@ -444,7 +445,8 @@ class _MobileSelectionServiceWidgetState
}
}

Overlay.of(context).insertAll(
final overlay = Overlay.of(context);
overlay?.insertAll(
_selectionAreas,
);
}
Expand Down Expand Up @@ -479,7 +481,7 @@ class _MobileSelectionServiceWidgetState

_cursorAreas.add(cursorArea);
selectionRects.add(selectable.transformRectToGlobal(cursorRect));
Overlay.of(context).insertAll(_cursorAreas);
Overlay.of(context)?.insertAll(_cursorAreas);

_forceShowCursor();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/material.dart' hide Overlay, OverlayEntry;

import 'package:appflowy_editor/src/core/document/node.dart';
import 'package:appflowy_editor/src/core/location/position.dart';
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/editor/editor_component/service/selection/desktop_selection_service.dart';
import 'package:appflowy_editor/src/editor/editor_component/service/selection/mobile_selection_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter/material.dart' hide Overlay, OverlayEntry;

class SelectionServiceWidget extends StatefulWidget {
const SelectionServiceWidget({
Expand Down
16 changes: 0 additions & 16 deletions lib/src/editor/editor_component/service/toolbar_service.dart

This file was deleted.

Loading

0 comments on commit e59b361

Please sign in to comment.