feat: support Flutter stable channel (#581)
* feat: adjust toggle list block * chore: upgrade Flutter to master channel * chore: upgrade pbxproj * fix: toolbar copy button not closing on mobile editor * fix: formatting issues and add missing commas * chore: add stable branch to GitHub Actions workflow * chore: add missing trailing commas * chore: adjust indentation padding in block component configuration and unit tests
This commit is contained in:
parent
a47fc6fc71
commit
c7d99913aa
47 changed files with 215 additions and 285 deletions
|
|
@ -229,12 +229,11 @@ final class NodeV0 extends ChangeNotifier with LinkedListEntry<NodeV0> {
|
|||
final class TextNodeV0 extends NodeV0 {
|
||||
TextNodeV0({
|
||||
required Delta delta,
|
||||
LinkedList<NodeV0>? children,
|
||||
super.children,
|
||||
Attributes? attributes,
|
||||
}) : _delta = delta,
|
||||
super(
|
||||
type: 'text',
|
||||
children: children,
|
||||
attributes: attributes ?? {},
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -71,9 +71,9 @@ EdgeInsets _padding(Node node) {
|
|||
EdgeInsets _indentPadding(Node node, TextDirection textDirection) {
|
||||
switch (textDirection) {
|
||||
case TextDirection.ltr:
|
||||
return const EdgeInsets.only(left: 30.0);
|
||||
return const EdgeInsets.only(left: 24.0);
|
||||
case TextDirection.rtl:
|
||||
return const EdgeInsets.only(right: 30.0);
|
||||
return const EdgeInsets.only(right: 24.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
|||
class NestedListWidget extends StatelessWidget {
|
||||
const NestedListWidget({
|
||||
super.key,
|
||||
this.indentPadding = const EdgeInsets.only(left: 30),
|
||||
this.indentPadding = const EdgeInsets.only(left: 28),
|
||||
required this.child,
|
||||
required this.children,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -61,13 +61,13 @@ void showImageMenu(
|
|||
|
||||
class UploadImageMenu extends StatefulWidget {
|
||||
const UploadImageMenu({
|
||||
Key? key,
|
||||
super.key,
|
||||
this.backgroundColor = Colors.white,
|
||||
this.headerColor = Colors.black,
|
||||
this.width = 300,
|
||||
required this.onSubmitted,
|
||||
required this.onUpload,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final Color backgroundColor;
|
||||
final Color headerColor;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import 'dart:math' as math;
|
|||
|
||||
class TableActionHandler extends StatefulWidget {
|
||||
const TableActionHandler({
|
||||
Key? key,
|
||||
super.key,
|
||||
this.visible = false,
|
||||
this.height,
|
||||
required this.node,
|
||||
|
|
@ -15,7 +15,7 @@ class TableActionHandler extends StatefulWidget {
|
|||
required this.transform,
|
||||
required this.dir,
|
||||
this.menuBuilder,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final bool visible;
|
||||
final Node node;
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
|
|||
|
||||
class TableActionButton extends StatefulWidget {
|
||||
const TableActionButton({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.width,
|
||||
required this.height,
|
||||
required this.padding,
|
||||
required this.onPressed,
|
||||
required this.icon,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final double width, height;
|
||||
final EdgeInsetsGeometry padding;
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@ import 'package:provider/provider.dart';
|
|||
|
||||
class TableCol extends StatefulWidget {
|
||||
const TableCol({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.tableNode,
|
||||
required this.editorState,
|
||||
required this.colIdx,
|
||||
required this.borderColor,
|
||||
required this.borderHoverColor,
|
||||
this.menuBuilder,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final int colIdx;
|
||||
final EditorState editorState;
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ import 'package:provider/provider.dart';
|
|||
|
||||
class TableColBorder extends StatefulWidget {
|
||||
const TableColBorder({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.tableNode,
|
||||
required this.editorState,
|
||||
required this.colIdx,
|
||||
required this.resizable,
|
||||
required this.borderColor,
|
||||
required this.borderHoverColor,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final bool resizable;
|
||||
final int colIdx;
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ import 'package:appflowy_editor/src/editor/block_component/table_block_component
|
|||
|
||||
class TableView extends StatefulWidget {
|
||||
const TableView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.editorState,
|
||||
required this.tableNode,
|
||||
required this.addIcon,
|
||||
required this.borderColor,
|
||||
required this.borderHoverColor,
|
||||
this.menuBuilder,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final EditorState editorState;
|
||||
final TableNode tableNode;
|
||||
|
|
|
|||
|
|
@ -63,14 +63,12 @@ class PageBlockComponent extends BlockComponentStatelessWidget {
|
|||
return Column(
|
||||
children: [
|
||||
if (header != null) header!,
|
||||
...items
|
||||
.map(
|
||||
(e) => Padding(
|
||||
padding: editorState.editorStyle.padding,
|
||||
child: editorState.renderer.build(context, e),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
...items.map(
|
||||
(e) => Padding(
|
||||
padding: editorState.editorStyle.padding,
|
||||
child: editorState.renderer.build(context, e),
|
||||
),
|
||||
),
|
||||
if (footer != null) footer!,
|
||||
],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@ class NonDeltaTextInputService extends TextInputService with TextInputClient {
|
|||
|
||||
final String debounceKey = 'updateEditingValue';
|
||||
|
||||
int skipUpdateEditingValue = 0;
|
||||
|
||||
@override
|
||||
Future<void> apply(List<TextEditingDelta> deltas) async {
|
||||
final formattedDeltas = deltas.map((e) => e.format()).toList();
|
||||
|
|
@ -76,12 +74,6 @@ class NonDeltaTextInputService extends TextInputService with TextInputClient {
|
|||
|
||||
Debounce.cancel(debounceKey);
|
||||
|
||||
// the set editing state will update the text editing value in macOS.
|
||||
// we just skip the unnecessary update.
|
||||
if (PlatformExtension.isMacOS) {
|
||||
skipUpdateEditingValue += 1;
|
||||
}
|
||||
|
||||
_textInputConnection!
|
||||
..setEditingState(formattedValue)
|
||||
..show();
|
||||
|
|
@ -95,10 +87,6 @@ class NonDeltaTextInputService extends TextInputService with TextInputClient {
|
|||
|
||||
@override
|
||||
void updateEditingValue(TextEditingValue value) {
|
||||
if (PlatformExtension.isMacOS && skipUpdateEditingValue > 0) {
|
||||
skipUpdateEditingValue -= 1;
|
||||
return;
|
||||
}
|
||||
if (currentTextEditingValue == value) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ import 'package:provider/provider.dart';
|
|||
|
||||
class DesktopScrollService extends StatefulWidget {
|
||||
const DesktopScrollService({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.child,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final Widget child;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ import 'package:provider/provider.dart';
|
|||
|
||||
class MobileScrollService extends StatefulWidget {
|
||||
const MobileScrollService({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.child,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final Widget child;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ import 'package:provider/provider.dart';
|
|||
|
||||
class ScrollServiceWidget extends StatefulWidget {
|
||||
const ScrollServiceWidget({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.editorScrollController,
|
||||
required this.child,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final EditorScrollController editorScrollController;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ import 'package:flutter/material.dart';
|
|||
|
||||
class SelectionMenuItemWidget extends StatefulWidget {
|
||||
const SelectionMenuItemWidget({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.editorState,
|
||||
required this.menuService,
|
||||
required this.item,
|
||||
required this.isSelected,
|
||||
required this.selectionMenuStyle,
|
||||
this.width = 140.0,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final EditorState editorState;
|
||||
final SelectionMenuService menuService;
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ class SelectionMenuStyle {
|
|||
|
||||
class SelectionMenuWidget extends StatefulWidget {
|
||||
const SelectionMenuWidget({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.items,
|
||||
required this.maxItemInRow,
|
||||
required this.editorState,
|
||||
|
|
@ -197,7 +197,7 @@ class SelectionMenuWidget extends StatefulWidget {
|
|||
required this.selectionMenuStyle,
|
||||
required this.itemCountFilter,
|
||||
required this.deleteSlashByDefault,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final List<SelectionMenuItem> items;
|
||||
final int itemCountFilter;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import 'package:flutter/services.dart';
|
|||
|
||||
class LinkMenu extends StatefulWidget {
|
||||
const LinkMenu({
|
||||
Key? key,
|
||||
super.key,
|
||||
this.linkText,
|
||||
this.editorState,
|
||||
required this.onSubmitted,
|
||||
|
|
@ -13,7 +13,7 @@ class LinkMenu extends StatefulWidget {
|
|||
required this.onCopyLink,
|
||||
required this.onRemoveLink,
|
||||
required this.onDismiss,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final String? linkText;
|
||||
final EditorState? editorState;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,11 @@ class MobileFloatingToolbar extends StatefulWidget {
|
|||
final EditorState editorState;
|
||||
final EditorScrollController editorScrollController;
|
||||
final Widget child;
|
||||
final Widget Function(BuildContext context, Offset anchor) toolbarBuilder;
|
||||
final Widget Function(
|
||||
BuildContext context,
|
||||
Offset anchor,
|
||||
Function closeToolbar,
|
||||
) toolbarBuilder;
|
||||
|
||||
@override
|
||||
State<MobileFloatingToolbar> createState() => _MobileFloatingToolbarState();
|
||||
|
|
@ -154,7 +158,11 @@ class _MobileFloatingToolbarState extends State<MobileFloatingToolbar>
|
|||
BuildContext context,
|
||||
Offset offset,
|
||||
) {
|
||||
return widget.toolbarBuilder(context, offset);
|
||||
return widget.toolbarBuilder(
|
||||
context,
|
||||
offset,
|
||||
_clear,
|
||||
);
|
||||
}
|
||||
|
||||
Rect _findSuitableRect(Iterable<Rect> rects) {
|
||||
|
|
|
|||
|
|
@ -219,13 +219,12 @@ class _QuitEditingBtn extends StatelessWidget {
|
|||
|
||||
class _ToolbarItemListView extends StatelessWidget {
|
||||
const _ToolbarItemListView({
|
||||
Key? key,
|
||||
required this.itemWithMenuOnPressed,
|
||||
required this.toolbarItems,
|
||||
required this.editorState,
|
||||
required this.selection,
|
||||
required this.toolbarWidgetService,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final Function(int index) itemWithMenuOnPressed;
|
||||
final List<MobileToolbarItem> toolbarItems;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class MobileToolbarStyle extends InheritedWidget {
|
|||
final double buttonSelectedBorderWidth;
|
||||
|
||||
const MobileToolbarStyle({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.backgroundColor,
|
||||
required this.foregroundColor,
|
||||
required this.clearDiagonalLineColor,
|
||||
|
|
@ -43,8 +43,8 @@ class MobileToolbarStyle extends InheritedWidget {
|
|||
required this.buttonSpacing,
|
||||
required this.buttonBorderWidth,
|
||||
required this.buttonSelectedBorderWidth,
|
||||
required Widget child,
|
||||
}) : super(key: key, child: child);
|
||||
required super.child,
|
||||
});
|
||||
|
||||
static MobileToolbarStyle of(BuildContext context) {
|
||||
return context.dependOnInheritedWidgetOfExactType<MobileToolbarStyle>()!;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue