Skip to content

Commit

Permalink
chore: fix analyze
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 committed Jul 6, 2023
1 parent 6471626 commit 570fd53
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 40 deletions.
34 changes: 0 additions & 34 deletions lib/src/editor/block_component/rich_text/appflowy_rich_text.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import 'dart:async';
import 'dart:ui';

import 'package:appflowy_editor/src/core/document/attributes.dart';
import 'package:appflowy_editor/src/core/document/node.dart';
import 'package:appflowy_editor/src/core/document/text_delta.dart';
import 'package:appflowy_editor/src/core/location/position.dart';
import 'package:appflowy_editor/src/core/location/selection.dart';
import 'package:appflowy_editor/src/editor/toolbar/toolbar.dart';
import 'package:appflowy_editor/src/editor_state.dart';
import 'package:appflowy_editor/src/extensions/url_launcher_extension.dart';
import 'package:appflowy_editor/src/editor/block_component/rich_text/appflowy_rich_text_keys.dart';
import 'package:appflowy_editor/src/render/selection/selectable.dart';
import 'package:appflowy_editor/src/extensions/text_style_extension.dart';
import 'package:appflowy_editor/src/editor/util/color_util.dart';
import 'package:appflowy_editor/src/core/document/path.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

Expand Down Expand Up @@ -312,36 +308,6 @@ class _AppFlowyRichTextState extends State<AppFlowyRichText>
);
}

GestureRecognizer _buildTapHrefGestureRecognizer(
String href,
Selection selection,
) {
Timer? timer;
var tapCount = 0;
final tapGestureRecognizer = TapGestureRecognizer()
..onTap = () async {
// implement a simple double tap logic
tapCount += 1;
timer?.cancel();

if (tapCount == 2 || !widget.editorState.editable) {
tapCount = 0;
safeLaunchUrl(href);
return;
}

timer = Timer(const Duration(milliseconds: 200), () {
tapCount = 0;
widget.editorState.service.selectionService
.updateSelection(selection);
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
showLinkMenu(context, widget.editorState, selection, true);
});
});
};
return tapGestureRecognizer;
}

TextSelection? textSelectionFromEditorSelection(Selection? selection) {
if (selection == null) {
return null;
Expand Down
5 changes: 1 addition & 4 deletions lib/src/service/context_menu/context_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class ContextMenu extends StatelessWidget {
final children = <Widget>[];
for (var i = 0; i < items.length; i++) {
for (var j = 0; j < items[i].length; j++) {
var onHover = false;
children.add(
StatefulBuilder(
builder: (BuildContext context, setState) {
Expand All @@ -43,9 +42,7 @@ class ContextMenu extends StatelessWidget {
items[i][j].onPressed(editorState);
onPressed();
},
onHover: (value) => setState(() {
onHover = value;
}),
onHover: (value) => setState(() {}),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
Expand Down
4 changes: 2 additions & 2 deletions test/render/image/image_node_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ void main() async {
final leftImageRect = tester.getRect(imageFinder.at(0));
expect(
leftImageRect.left,
editor.editorState.editorStyle.padding!.left,
editor.editorState.editorStyle.padding.left,
);
final rightImageRect = tester.getRect(imageFinder.at(2));
expect(
rightImageRect.right,
editorRect.right - editor.editorState.editorStyle.padding!.right,
editorRect.right - editor.editorState.editorStyle.padding.right,
);
final centerImageRect = tester.getRect(imageFinder.at(1));
expect(
Expand Down

0 comments on commit 570fd53

Please sign in to comment.