mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: flutter analyze
This commit is contained in:
parent
eb13a252ac
commit
51f100ca4b
@ -1,5 +1,3 @@
|
|||||||
import 'dart:math';
|
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
typedef Path = List<int>;
|
typedef Path = List<int>;
|
||||||
|
@ -290,10 +290,10 @@ class HTMLToNodesConverter {
|
|||||||
|
|
||||||
List<Node> _handleUnorderedList(html.Element element) {
|
List<Node> _handleUnorderedList(html.Element element) {
|
||||||
final result = <Node>[];
|
final result = <Node>[];
|
||||||
element.children.forEach((child) {
|
for (var child in element.children) {
|
||||||
result.addAll(
|
result.addAll(
|
||||||
_handleListElement(child, {"subtype": StyleKey.bulletedList}));
|
_handleListElement(child, {"subtype": StyleKey.bulletedList}));
|
||||||
});
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ import 'package:appflowy_editor/src/document/text_delta.dart';
|
|||||||
import 'package:appflowy_editor/src/editor_state.dart';
|
import 'package:appflowy_editor/src/editor_state.dart';
|
||||||
import 'package:appflowy_editor/src/render/rich_text/rich_text_style.dart';
|
import 'package:appflowy_editor/src/render/rich_text/rich_text_style.dart';
|
||||||
import 'package:appflowy_editor/src/render/selection/selectable.dart';
|
import 'package:appflowy_editor/src/render/selection/selectable.dart';
|
||||||
import 'package:appflowy_editor/src/service/render_plugin_service.dart';
|
|
||||||
|
|
||||||
typedef FlowyTextSpanDecorator = TextSpan Function(TextSpan textSpan);
|
typedef FlowyTextSpanDecorator = TextSpan Function(TextSpan textSpan);
|
||||||
|
|
||||||
@ -166,26 +165,26 @@ class _FlowyRichTextState extends State<FlowyRichText> with Selectable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// unused now.
|
// unused now.
|
||||||
Widget _buildRichTextWithChildren(BuildContext context) {
|
// Widget _buildRichTextWithChildren(BuildContext context) {
|
||||||
return Column(
|
// return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
// children: [
|
||||||
_buildSingleRichText(context),
|
// _buildSingleRichText(context),
|
||||||
...widget.textNode.children
|
// ...widget.textNode.children
|
||||||
.map(
|
// .map(
|
||||||
(child) => widget.editorState.service.renderPluginService
|
// (child) => widget.editorState.service.renderPluginService
|
||||||
.buildPluginWidget(
|
// .buildPluginWidget(
|
||||||
NodeWidgetContext(
|
// NodeWidgetContext(
|
||||||
context: context,
|
// context: context,
|
||||||
node: child,
|
// node: child,
|
||||||
editorState: widget.editorState,
|
// editorState: widget.editorState,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
)
|
// )
|
||||||
.toList()
|
// .toList()
|
||||||
],
|
// ],
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Offset localToGlobal(Offset offset) {
|
Offset localToGlobal(Offset offset) {
|
||||||
|
@ -53,7 +53,7 @@ class ToolbarWidget extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ToolbarWidgetState extends State<ToolbarWidget> with ToolbarMixin {
|
class _ToolbarWidgetState extends State<ToolbarWidget> with ToolbarMixin {
|
||||||
final GlobalKey _listToolbarKey = GlobalKey();
|
// final GlobalKey _listToolbarKey = GlobalKey();
|
||||||
|
|
||||||
final toolbarHeight = 32.0;
|
final toolbarHeight = 32.0;
|
||||||
final topPadding = 5.0;
|
final topPadding = 5.0;
|
||||||
@ -117,14 +117,14 @@ class _ToolbarWidgetState extends State<ToolbarWidget> with ToolbarMixin {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _listToolbar(BuildContext context) {
|
// Widget _listToolbar(BuildContext context) {
|
||||||
return _centerToolbarIcon(
|
// return _centerToolbarIcon(
|
||||||
'quote',
|
// 'quote',
|
||||||
key: _listToolbarKey,
|
// key: _listToolbarKey,
|
||||||
width: listToolbarWidth,
|
// width: listToolbarWidth,
|
||||||
onTap: () => _onTapListToolbar(context),
|
// onTap: () => _onTapListToolbar(context),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
Widget _centerToolbarIcon(String name,
|
Widget _centerToolbarIcon(String name,
|
||||||
{Key? key, String? tooltipMessage, double? width, VoidCallback? onTap}) {
|
{Key? key, String? tooltipMessage, double? width, VoidCallback? onTap}) {
|
||||||
@ -150,62 +150,62 @@ class _ToolbarWidgetState extends State<ToolbarWidget> with ToolbarMixin {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onTapListToolbar(BuildContext context) {
|
// void _onTapListToolbar(BuildContext context) {
|
||||||
// TODO: implement more detailed UI.
|
// // TODO: implement more detailed UI.
|
||||||
final items = defaultListToolbarEventNames;
|
// final items = defaultListToolbarEventNames;
|
||||||
final renderBox =
|
// final renderBox =
|
||||||
_listToolbarKey.currentContext?.findRenderObject() as RenderBox;
|
// _listToolbarKey.currentContext?.findRenderObject() as RenderBox;
|
||||||
final offset = renderBox
|
// final offset = renderBox
|
||||||
.localToGlobal(Offset.zero)
|
// .localToGlobal(Offset.zero)
|
||||||
.translate(0, toolbarHeight - cornerRadius);
|
// .translate(0, toolbarHeight - cornerRadius);
|
||||||
final rect = offset & Size(listToolbarWidth, listToolbarHeight);
|
// final rect = offset & Size(listToolbarWidth, listToolbarHeight);
|
||||||
|
|
||||||
_listToolbarOverlay?.remove();
|
// _listToolbarOverlay?.remove();
|
||||||
_listToolbarOverlay = OverlayEntry(builder: (context) {
|
// _listToolbarOverlay = OverlayEntry(builder: (context) {
|
||||||
return Positioned.fromRect(
|
// return Positioned.fromRect(
|
||||||
rect: rect,
|
// rect: rect,
|
||||||
child: Material(
|
// child: Material(
|
||||||
borderRadius: BorderRadius.only(
|
// borderRadius: BorderRadius.only(
|
||||||
bottomLeft: Radius.circular(cornerRadius),
|
// bottomLeft: Radius.circular(cornerRadius),
|
||||||
bottomRight: Radius.circular(cornerRadius),
|
// bottomRight: Radius.circular(cornerRadius),
|
||||||
),
|
// ),
|
||||||
color: const Color(0xFF333333),
|
// color: const Color(0xFF333333),
|
||||||
child: SingleChildScrollView(
|
// child: SingleChildScrollView(
|
||||||
child: ListView.builder(
|
// child: ListView.builder(
|
||||||
itemExtent: toolbarHeight,
|
// itemExtent: toolbarHeight,
|
||||||
padding: const EdgeInsets.only(bottom: 10.0),
|
// padding: const EdgeInsets.only(bottom: 10.0),
|
||||||
shrinkWrap: true,
|
// shrinkWrap: true,
|
||||||
itemCount: items.length,
|
// itemCount: items.length,
|
||||||
itemBuilder: ((context, index) {
|
// itemBuilder: ((context, index) {
|
||||||
return ListTile(
|
// return ListTile(
|
||||||
contentPadding: const EdgeInsets.only(
|
// contentPadding: const EdgeInsets.only(
|
||||||
left: 3.0,
|
// left: 3.0,
|
||||||
right: 3.0,
|
// right: 3.0,
|
||||||
),
|
// ),
|
||||||
minVerticalPadding: 0.0,
|
// minVerticalPadding: 0.0,
|
||||||
title: FittedBox(
|
// title: FittedBox(
|
||||||
fit: BoxFit.scaleDown,
|
// fit: BoxFit.scaleDown,
|
||||||
child: Text(
|
// child: Text(
|
||||||
items[index],
|
// items[index],
|
||||||
textAlign: TextAlign.center,
|
// textAlign: TextAlign.center,
|
||||||
style: const TextStyle(
|
// style: const TextStyle(
|
||||||
color: Colors.white,
|
// color: Colors.white,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
onTap: () {
|
// onTap: () {
|
||||||
_onTap(items[index]);
|
// _onTap(items[index]);
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
}),
|
// }),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
});
|
// });
|
||||||
// TODO: disable scrolling.
|
// // TODO: disable scrolling.
|
||||||
Overlay.of(context)?.insert(_listToolbarOverlay!);
|
// Overlay.of(context)?.insert(_listToolbarOverlay!);
|
||||||
}
|
// }
|
||||||
|
|
||||||
void _onTap(String eventName) {
|
void _onTap(String eventName) {
|
||||||
if (defaultToolbarEventHandlers.containsKey(eventName)) {
|
if (defaultToolbarEventHandlers.containsKey(eventName)) {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:appflowy_editor/src/document/node.dart';
|
import 'package:appflowy_editor/src/document/node.dart';
|
||||||
@ -104,7 +103,7 @@ class _FlowySelectionState extends State<FlowySelection>
|
|||||||
final List<OverlayEntry> _selectionAreas = [];
|
final List<OverlayEntry> _selectionAreas = [];
|
||||||
final List<OverlayEntry> _cursorAreas = [];
|
final List<OverlayEntry> _cursorAreas = [];
|
||||||
|
|
||||||
OverlayEntry? _debugOverlay;
|
// OverlayEntry? _debugOverlay;
|
||||||
|
|
||||||
/// Pan
|
/// Pan
|
||||||
Offset? _panStartOffset;
|
Offset? _panStartOffset;
|
||||||
@ -517,38 +516,38 @@ class _FlowySelectionState extends State<FlowySelection>
|
|||||||
|
|
||||||
void _showDebugLayerIfNeeded({Offset? offset}) {
|
void _showDebugLayerIfNeeded({Offset? offset}) {
|
||||||
// remove false to show debug overlay.
|
// remove false to show debug overlay.
|
||||||
if (kDebugMode && false) {
|
// if (kDebugMode && false) {
|
||||||
_debugOverlay?.remove();
|
// _debugOverlay?.remove();
|
||||||
if (offset != null) {
|
// if (offset != null) {
|
||||||
_debugOverlay = OverlayEntry(
|
// _debugOverlay = OverlayEntry(
|
||||||
builder: (context) => Positioned.fromRect(
|
// builder: (context) => Positioned.fromRect(
|
||||||
rect: Rect.fromPoints(offset, offset.translate(20, 20)),
|
// rect: Rect.fromPoints(offset, offset.translate(20, 20)),
|
||||||
child: Container(
|
// child: Container(
|
||||||
color: Colors.red.withOpacity(0.2),
|
// color: Colors.red.withOpacity(0.2),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
Overlay.of(context)?.insert(_debugOverlay!);
|
// Overlay.of(context)?.insert(_debugOverlay!);
|
||||||
} else if (_panStartOffset != null) {
|
// } else if (_panStartOffset != null) {
|
||||||
_debugOverlay = OverlayEntry(
|
// _debugOverlay = OverlayEntry(
|
||||||
builder: (context) => Positioned.fromRect(
|
// builder: (context) => Positioned.fromRect(
|
||||||
rect: Rect.fromPoints(
|
// rect: Rect.fromPoints(
|
||||||
_panStartOffset?.translate(
|
// _panStartOffset?.translate(
|
||||||
0,
|
// 0,
|
||||||
-(editorState.service.scrollService!.dy -
|
// -(editorState.service.scrollService!.dy -
|
||||||
_panStartScrollDy!),
|
// _panStartScrollDy!),
|
||||||
) ??
|
// ) ??
|
||||||
Offset.zero,
|
// Offset.zero,
|
||||||
offset ?? Offset.zero),
|
// offset ?? Offset.zero),
|
||||||
child: Container(
|
// child: Container(
|
||||||
color: Colors.red.withOpacity(0.2),
|
// color: Colors.red.withOpacity(0.2),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
Overlay.of(context)?.insert(_debugOverlay!);
|
// Overlay.of(context)?.insert(_debugOverlay!);
|
||||||
} else {
|
// } else {
|
||||||
_debugOverlay = null;
|
// _debugOverlay = null;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user