Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support Flutter stable channel #581

Merged
merged 8 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@ on:
push:
branches:
- "main"
- "stable"

pull_request:
branches:
- "main"
- "stable"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
FLUTTER_VERSION: "3.10.1"

# 3 jobs are configured.
# The first one runs tests on desktop OSs.
# The second runs tests on iOS simulator.
Expand All @@ -34,11 +33,11 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true

- name: Run tests
run: |
flutter --version
flutter pub get
flutter analyze .
dart format --set-exit-if-changed .
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,6 @@ app.*.symbols
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/dev/ci/**/Gemfile.lock
!/dev/ci/**/Gemfile.lock

.fvm/
2 changes: 1 addition & 1 deletion example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
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
2 changes: 1 addition & 1 deletion example/lib/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extension on ExportFileType {
}

class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
const HomePage({super.key});

@override
State<HomePage> createState() => _HomePageState();
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/editor_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class _EditorListState extends State<EditorList> {
for (var i = 0; i < 100; i++) {
final document = Document.blank()
..insert([
0
0,
], [
headingNode(level: 3, delta: Delta()..insert('Heading $i')),
paragraphNode(
Expand Down
8 changes: 6 additions & 2 deletions example/lib/pages/mobile_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,17 @@ class _MobileEditorState extends State<MobileEditor> {
child: MobileFloatingToolbar(
editorState: editorState,
editorScrollController: editorScrollController,
toolbarBuilder: (context, anchor) {
toolbarBuilder: (context, anchor, closeToolbar) {
return AdaptiveTextSelectionToolbar.editable(
clipboardStatus: ClipboardStatus.pasteable,
onCopy: () => copyCommand.execute(editorState),
onCopy: () {
copyCommand.execute(editorState);
closeToolbar();
},
onCut: () => cutCommand.execute(editorState),
onPaste: () => pasteCommand.execute(editorState),
onSelectAll: () => selectAllCommand.execute(editorState),
onLiveTextInput: null,
anchors: TextSelectionToolbarAnchors(
primaryAnchor: anchor,
),
Expand Down
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
8 changes: 4 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ dependencies:
provider: ^6.0.3
url_launcher: ^6.1.5
path_provider: ^2.0.15
google_fonts: ^4.0.4
google_fonts: ^6.1.0
flutter_localizations:
sdk: flutter
file_picker: ^5.0.1
file_picker: ^6.1.1
universal_html: ^2.0.8
highlight: ^0.7.0
http: ^0.13.5
http: ^1.1.0
show_fps: ^1.0.6

dev_dependencies:
Expand All @@ -53,7 +53,7 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.1
flutter_lints: ^3.0.1

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down
3 changes: 1 addition & 2 deletions lib/src/core/document/deprecated/node.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? {},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 6 additions & 8 deletions lib/src/editor/editor_component/entry/page_block_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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!,
],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions lib/src/editor/selection_menu/selection_menu_item_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading
Loading