fix: flutter analyze and dart lint
This commit is contained in:
parent
6851f045c1
commit
b29d053924
40 changed files with 94 additions and 256 deletions
|
|
@ -10,5 +10,11 @@ linter:
|
||||||
- use_decorated_box
|
- use_decorated_box
|
||||||
|
|
||||||
analyzer:
|
analyzer:
|
||||||
|
errors:
|
||||||
|
deprecated_member_use_from_same_package: ignore
|
||||||
exclude:
|
exclude:
|
||||||
- lib/src/l10n/**
|
- lib/src/l10n/**
|
||||||
|
# Remove the below directory until migration is complete.
|
||||||
|
- example/**
|
||||||
|
- test/**
|
||||||
|
- lib/src/service/**
|
||||||
|
|
|
||||||
|
|
@ -370,10 +370,12 @@ Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return Theme.of(context).copyWith(extensions: [
|
return Theme.of(context).copyWith(
|
||||||
editorStyle,
|
extensions: [
|
||||||
...darkPluginStyleExtension,
|
editorStyle,
|
||||||
quote,
|
...darkPluginStyleExtension,
|
||||||
],);
|
quote,
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,11 @@ ThemeData customizeEditorTheme(BuildContext context) {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return Theme.of(context).copyWith(extensions: [
|
return Theme.of(context).copyWith(
|
||||||
editorStyle,
|
extensions: [
|
||||||
...darkPluginStyleExtension,
|
editorStyle,
|
||||||
quote,
|
...darkPluginStyleExtension,
|
||||||
],);
|
quote,
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
/// For example,
|
/// For example,
|
||||||
/// bulleted list: '- '
|
/// bulleted list: '- '
|
||||||
/// numbered list: '1. '
|
/// numbered list: '1. '
|
||||||
/// quote: '> '
|
/// quote: '" '
|
||||||
/// ...
|
/// ...
|
||||||
Future<bool> formatMarkdownSymbol(
|
Future<bool> formatMarkdownSymbol(
|
||||||
EditorState editorState,
|
EditorState editorState,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
import 'package:appflowy_editor/src/editor/block_component/base_component/widget/nested_list_widget.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
import 'package:appflowy_editor/src/editor/block_component/base_component/insert_newline_in_type_command.dart';
|
|
||||||
import 'package:appflowy_editor/src/editor/block_component/base_component/markdown_format_helper.dart';
|
|
||||||
|
|
||||||
/// Convert '* ' to bulleted list
|
/// Convert '* ' to bulleted list
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
import 'package:appflowy_editor/src/editor/block_component/base_component/markdown_format_helper.dart';
|
|
||||||
|
|
||||||
/// Convert '# ' to bulleted list
|
/// Convert '# ' to bulleted list
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
import 'package:appflowy_editor/src/editor/block_component/image_block_component/image_block_component.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
void showImageMenu(
|
void showImageMenu(
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
import 'package:appflowy_editor/src/editor/block_component/base_component/widget/nested_list_widget.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
import 'package:appflowy_editor/src/editor/block_component/base_component/markdown_format_helper.dart';
|
|
||||||
|
|
||||||
final _numberRegex = RegExp(r'^(\d+)\.');
|
final _numberRegex = RegExp(r'^(\d+)\.');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
import 'package:appflowy_editor/src/editor/block_component/base_component/markdown_format_helper.dart';
|
|
||||||
|
|
||||||
const _doubleQuote = '"';
|
const _doubleQuote = '"';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
import 'package:appflowy_editor/src/editor/block_component/base_component/widget/nested_list_widget.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
import 'package:appflowy_editor/src/editor/block_component/base_component/markdown_format_helper.dart';
|
|
||||||
|
|
||||||
/// Convert '[] ' to unchecked todo list
|
/// Convert '[] ' to unchecked todo list
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ abstract class TextInputService {
|
||||||
onNonTextUpdate;
|
onNonTextUpdate;
|
||||||
Future<void> Function(TextInputAction action) onPerformAction;
|
Future<void> Function(TextInputAction action) onPerformAction;
|
||||||
|
|
||||||
TextRange? composingTextRange;
|
TextRange? get composingTextRange;
|
||||||
bool get attached;
|
bool get attached;
|
||||||
|
|
||||||
void updateCaretPosition(Size size, Matrix4 transform, Rect rect);
|
void updateCaretPosition(Size size, Matrix4 transform, Rect rect);
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ abstract class BlockComponentBuilder {
|
||||||
|
|
||||||
Widget build(BlockComponentContext blockComponentContext);
|
Widget build(BlockComponentContext blockComponentContext);
|
||||||
|
|
||||||
bool showActions(Node node) => true;
|
bool showActions(Node node) => false;
|
||||||
|
|
||||||
BlockActionBuilder actionBuilder = (_, __) => const SizedBox.shrink();
|
BlockActionBuilder actionBuilder = (_, __) => const SizedBox.shrink();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,6 @@ class DesktopScrollService extends StatefulWidget {
|
||||||
|
|
||||||
class _DesktopScrollServiceState extends State<DesktopScrollService>
|
class _DesktopScrollServiceState extends State<DesktopScrollService>
|
||||||
implements AppFlowyScrollService {
|
implements AppFlowyScrollService {
|
||||||
bool _scrollEnabled = true;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
double get dy => widget.scrollController.position.pixels;
|
double get dy => widget.scrollController.position.pixels;
|
||||||
|
|
||||||
|
|
@ -76,13 +74,11 @@ class _DesktopScrollServiceState extends State<DesktopScrollService>
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void disable() {
|
void disable() {
|
||||||
_scrollEnabled = false;
|
|
||||||
Log.scroll.debug('disable scroll service');
|
Log.scroll.debug('disable scroll service');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void enable() {
|
void enable() {
|
||||||
_scrollEnabled = true;
|
|
||||||
Log.scroll.debug('enable scroll service');
|
Log.scroll.debug('enable scroll service');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,6 @@ class _MobileSelectionServiceWidgetState
|
||||||
@override
|
@override
|
||||||
List<Node> currentSelectedNodes = [];
|
List<Node> currentSelectedNodes = [];
|
||||||
|
|
||||||
/// Pan
|
|
||||||
Offset? _panStartOffset;
|
|
||||||
double? _panStartScrollDy;
|
|
||||||
|
|
||||||
late EditorState editorState = Provider.of<EditorState>(
|
late EditorState editorState = Provider.of<EditorState>(
|
||||||
context,
|
context,
|
||||||
listen: false,
|
listen: false,
|
||||||
|
|
@ -230,9 +226,6 @@ class _MobileSelectionServiceWidgetState
|
||||||
|
|
||||||
editorState.service.scrollService?.stopAutoScroll();
|
editorState.service.scrollService?.stopAutoScroll();
|
||||||
|
|
||||||
// clear old state.
|
|
||||||
_panStartOffset = null;
|
|
||||||
|
|
||||||
final position = getPositionInOffset(details.globalPosition);
|
final position = getPositionInOffset(details.globalPosition);
|
||||||
if (position == null) {
|
if (position == null) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -289,44 +282,6 @@ class _MobileSelectionServiceWidgetState
|
||||||
_showContextMenu(details);
|
_showContextMenu(details);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onPanStart(DragStartDetails details) {
|
|
||||||
clearSelection();
|
|
||||||
|
|
||||||
_panStartOffset = details.globalPosition.translate(-3.0, 0);
|
|
||||||
_panStartScrollDy = editorState.service.scrollService?.dy;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onPanUpdate(DragUpdateDetails details) {
|
|
||||||
if (_panStartOffset == null || _panStartScrollDy == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final panEndOffset = details.globalPosition;
|
|
||||||
final dy = editorState.service.scrollService?.dy;
|
|
||||||
final panStartOffset = dy == null
|
|
||||||
? _panStartOffset!
|
|
||||||
: _panStartOffset!.translate(0, _panStartScrollDy! - dy);
|
|
||||||
|
|
||||||
final first = getNodeInOffset(panStartOffset)?.selectable;
|
|
||||||
final last = getNodeInOffset(panEndOffset)?.selectable;
|
|
||||||
|
|
||||||
// compute the selection in range.
|
|
||||||
if (first != null && last != null) {
|
|
||||||
Log.selection.debug('first = $first, last = $last');
|
|
||||||
final start =
|
|
||||||
first.getSelectionInRange(panStartOffset, panEndOffset).start;
|
|
||||||
final end = last.getSelectionInRange(panStartOffset, panEndOffset).end;
|
|
||||||
final selection = Selection(start: start, end: end);
|
|
||||||
updateSelection(selection);
|
|
||||||
}
|
|
||||||
|
|
||||||
_showDebugLayerIfNeeded(offset: panEndOffset);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onPanEnd(DragEndDetails details) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
void _updateSelectionAreas(Selection selection) {
|
void _updateSelectionAreas(Selection selection) {
|
||||||
final nodes = getNodesInSelection(selection);
|
final nodes = getNodesInSelection(selection);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,4 @@
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
import 'package:appflowy_editor/src/editor/editor_component/service/shortcuts/character_shortcut_events/format_by_wrapping_with_double_character/format_bold.dart';
|
|
||||||
import 'package:appflowy_editor/src/editor/editor_component/service/shortcuts/character_shortcut_events/format_by_wrapping_with_double_character/format_strikethrough.dart';
|
|
||||||
import 'package:appflowy_editor/src/editor/editor_component/service/shortcuts/character_shortcut_events/format_by_wrapping_with_single_character/format_code.dart';
|
|
||||||
import 'package:appflowy_editor/src/editor/editor_component/service/shortcuts/character_shortcut_events/format_by_wrapping_with_single_character/format_italic.dart';
|
|
||||||
import 'package:appflowy_editor/src/editor/editor_component/service/shortcuts/character_shortcut_events/format_by_wrapping_with_single_character/format_strikethrough.dart';
|
|
||||||
|
|
||||||
// Include all the shortcut(formatting) events triggered by wrapping text with double characters.
|
// Include all the shortcut(formatting) events triggered by wrapping text with double characters.
|
||||||
// 1. double asterisk to bold -> **abc**
|
// 1. double asterisk to bold -> **abc**
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ Future<bool> _showSlashMenu(
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the slash menu
|
// show the slash menu
|
||||||
{
|
() {
|
||||||
// this code is copied from the the old editor.
|
// this code is copied from the the old editor.
|
||||||
// TODO: refactor this code
|
// TODO: refactor this code
|
||||||
final context = editorState.getNodeAtPath(selection.start.path)?.context;
|
final context = editorState.getNodeAtPath(selection.start.path)?.context;
|
||||||
|
|
@ -76,7 +76,7 @@ Future<bool> _showSlashMenu(
|
||||||
);
|
);
|
||||||
_selectionMenuService?.show();
|
_selectionMenuService?.show();
|
||||||
}
|
}
|
||||||
}
|
}();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue