chore: upgrade minimum support flutter version, >= 3.3.0 (#1551)

* feat: upgrade flutter version to 3.3.0 for appflowy_editor and appflowy_editor_plugin

* feat: upgrade flutter version to 3.3.0 for appflowy

* feat: upgrade flutter version to 3.3.0 for CI

* chore: update flutter version in ci workflows

* chore: fix warnings

* chore: fix unuse import

* chore: support  cargo make dart_unit_test on windows platform

* fix: copy to sandbox errors

Co-authored-by: nathan <nathan@appflowy.io>
This commit is contained in:
Lucas.Xu 2023-01-01 23:26:27 +08:00 committed by GitHub
parent 9cd83d02a9
commit c05c1e191c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 206 additions and 96 deletions

View File

@ -30,7 +30,7 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: "3.0.5"
flutter-version: "3.3.9"
cache: true
- name: Run FlowyEditor tests

View File

@ -38,7 +38,7 @@ jobs:
with:
channel: "stable"
cache: true
flutter-version: "3.0.5"
flutter-version: "3.3.9"
- name: Cache Cargo
id: cache-cargo

View File

@ -32,7 +32,7 @@ jobs:
uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
with:
flutter-version: "3.0.5"
flutter-version: "3.3.9"
channel: "stable"
- uses: actions-rs/toolchain@v1
with:

View File

@ -30,7 +30,7 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: "3.0.5"
flutter-version: "3.3.9"
cache: true
- name: Cache Cargo

View File

@ -35,7 +35,7 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: "3.0.5"
flutter-version: "3.3.9"
cache: true
- name: Cache Cargo

View File

@ -51,7 +51,7 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.0.5'
flutter-version: '3.3.9'
- name: Pre build
working-directory: frontend
@ -136,7 +136,7 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.0.5'
flutter-version: '3.3.9'
- name: Pre build
working-directory: frontend
@ -211,7 +211,7 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.0.5'
flutter-version: '3.3.9'
- name: Pre build
working-directory: frontend
@ -284,7 +284,7 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.0.5'
flutter-version: '3.3.9'
- name: Pre build
working-directory: frontend

View File

@ -49,7 +49,7 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.0.5'
flutter-version: '3.3.9'
- name: Install code-coverage tools
working-directory: frontend

View File

@ -32,7 +32,7 @@ jobs:
override: true
- uses: subosito/flutter-action@v1
with:
flutter-version: '3.0.5'
flutter-version: '3.3.9'
channel: "stable"
- name: Rust Deps

View File

@ -20,7 +20,6 @@ import 'package:flowy_sdk/protobuf/flowy-grid/field_entities.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-grid/row_entities.pb.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../grid/application/row/row_cache.dart';
import '../application/board_bloc.dart';
import 'card/card.dart';
import 'card/card_cell_builder.dart';

View File

@ -41,8 +41,8 @@ class DateCalBloc extends Bloc<DateCalEvent, DateCalState> {
},
didReceiveCellUpdate: (DateCellDataPB? cellData) {
final calData = calDataFromCellData(cellData);
final time =
calData.foldRight("", (dateData, previous) => dateData.time);
final time = calData.foldRight(
"", (dateData, previous) => dateData.time ?? '');
emit(state.copyWith(calData: calData, time: time));
},
setIncludeTime: (includeTime) async {
@ -224,7 +224,8 @@ class DateCalState with _$DateCalState {
DateCellDataPB? cellData,
) {
Option<CalendarData> calData = calDataFromCellData(cellData);
final time = calData.foldRight("", (dateData, previous) => dateData.time);
final time =
calData.foldRight("", (dateData, previous) => dateData.time ?? '');
return DateCalState(
dateTypeOptionPB: dateTypeOptionPB,
format: CalendarFormat.month,

View File

@ -13,7 +13,6 @@ import '../../../../main.dart';
import '../../../../startup/launch_configuration.dart';
import '../../../../startup/startup.dart';
import '../../../../startup/tasks/prelude.dart';
import '../../../application/settings/settings_location_cubit.dart';
class SettingsFileLocationCustomzier extends StatefulWidget {
const SettingsFileLocationCustomzier({

View File

@ -80,7 +80,7 @@ class _CurrentIcon extends StatelessWidget {
@override
Widget build(BuildContext context) {
_setIcon(String iconUrl) {
void setIcon(String iconUrl) {
context
.read<SettingsUserViewBloc>()
.add(SettingsUserEvent.updateUserIcon(iconUrl));
@ -90,23 +90,28 @@ class _CurrentIcon extends StatelessWidget {
return Material(
color: Colors.transparent,
child: GestureDetector(
onTap: () {
showDialog(
context: context,
builder: (BuildContext context) {
return SimpleDialog(
title: FlowyText.medium(
'Select an Icon',
fontSize: FontSizes.s16,
),
children: <Widget>[
SizedBox(
height: 300, width: 300, child: IconGallery(_setIcon))
]);
},
);
},
child: Column(children: <Widget>[
onTap: () {
showDialog(
context: context,
builder: (BuildContext context) {
return SimpleDialog(
title: FlowyText.medium(
'Select an Icon',
fontSize: FontSizes.s16,
),
children: <Widget>[
SizedBox(
height: 300,
width: 300,
child: IconGallery(setIcon),
)
],
);
},
);
},
child: Column(
children: <Widget>[
const Align(
alignment: Alignment.topLeft,
child: Text(
@ -114,14 +119,17 @@ class _CurrentIcon extends StatelessWidget {
style: TextStyle(color: Colors.grey),
)),
Align(
alignment: Alignment.centerLeft,
child: Container(
margin: const EdgeInsets.all(5.0),
decoration:
BoxDecoration(border: Border.all(color: Colors.grey)),
child: svgWidget('emoji/$iconUrl', size: const Size(60, 60)),
)),
])),
alignment: Alignment.centerLeft,
child: Container(
margin: const EdgeInsets.all(5.0),
decoration:
BoxDecoration(border: Border.all(color: Colors.grey)),
child: svgWidget('emoji/$iconUrl', size: const Size(60, 60)),
),
),
],
),
),
);
}
}

View File

@ -1,5 +1,4 @@
import 'dart:collection';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';

View File

@ -68,7 +68,7 @@ class _AppFlowyInputState extends State<AppFlowyInput>
final Map<ShortcutActivator, Intent> _shortcuts = kIsWeb
? {
LogicalKeySet(LogicalKeyboardKey.space):
DoNothingAndStopPropagationIntent(),
const DoNothingAndStopPropagationIntent(),
}
: {};

View File

@ -92,6 +92,7 @@ class _AppFlowyScrollState extends State<AppFlowyScroll>
Widget build(BuildContext context) {
return Listener(
onPointerSignal: _onPointerSignal,
onPointerPanZoomUpdate: _onPointerPanZoomUpdate,
child: CustomScrollView(
key: _scrollViewKey,
physics: const NeverScrollableScrollPhysics(),
@ -134,4 +135,11 @@ class _AppFlowyScrollState extends State<AppFlowyScroll>
scrollTo(dy);
}
}
void _onPointerPanZoomUpdate(PointerPanZoomUpdateEvent event) {
if (_scrollEnabled) {
final dy = (_scrollController.position.pixels - event.panDelta.dy);
scrollTo(dy);
}
}
}

View File

@ -49,7 +49,14 @@ class SelectionGestureDetectorState extends State<SelectionGestureDetector> {
gestures: {
PanGestureRecognizer:
GestureRecognizerFactoryWithHandlers<PanGestureRecognizer>(
() => PanGestureRecognizer(),
() => PanGestureRecognizer(supportedDevices: {
// https://docs.flutter.dev/release/breaking-changes/trackpad-gestures#for-gesture-interactions-not-suitable-for-trackpad-usage
// Exclude PointerDeviceKind.trackpad.
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
PointerDeviceKind.stylus,
PointerDeviceKind.invertedStylus,
}),
(recognizer) {
recognizer
..onStart = widget.onPanStart

View File

@ -10,8 +10,8 @@ platforms:
web:
environment:
sdk: ">=2.17.0 <3.0.0"
flutter: ">=1.17.0"
sdk: ">=2.18.0 <3.0.0"
flutter: ">=3.3.0"
dependencies:
flutter:

View File

@ -8,7 +8,7 @@ void main() async {
TestWidgetsFlutterBinding.ensureInitialized();
});
Node _createEmptyEditorRoot() {
Node createEmptyEditorRoot() {
return Node(
type: 'editor',
children: LinkedList(),
@ -17,7 +17,7 @@ void main() async {
}
test("HistoryItem #1", () {
final document = Document(root: _createEmptyEditorRoot());
final document = Document(root: createEmptyEditorRoot());
final editorState = EditorState(document: document);
final historyItem = HistoryItem();
@ -35,7 +35,7 @@ void main() async {
});
test("HistoryItem #2", () {
final document = Document(root: _createEmptyEditorRoot());
final document = Document(root: createEmptyEditorRoot());
final editorState = EditorState(document: document);
final historyItem = HistoryItem();

View File

@ -162,7 +162,7 @@ class __CodeBlockNodeWidgeState extends State<_CodeBlockNodeWidge>
var currentSpans = spans;
List<List<TextSpan>> stack = [];
_traverse(highlight.Node node) {
void traverse(highlight.Node node) {
if (node.value != null) {
currentSpans.add(node.className == null
? TextSpan(text: node.value)
@ -177,7 +177,7 @@ class __CodeBlockNodeWidgeState extends State<_CodeBlockNodeWidge>
currentSpans = tmp;
for (var n in node.children!) {
_traverse(n);
traverse(n);
if (n == node.children!.last) {
currentSpans = stack.isEmpty ? spans : stack.removeLast();
}
@ -186,7 +186,7 @@ class __CodeBlockNodeWidgeState extends State<_CodeBlockNodeWidge>
}
for (var node in nodes) {
_traverse(node);
traverse(node);
}
return spans;

View File

@ -6,8 +6,8 @@ homepage: https://github.com/AppFlowy-IO/AppFlowy
publish_to: none
environment:
sdk: ">=2.17.6 <3.0.0"
flutter: ">=1.17.0"
sdk: ">=2.18.0 <3.0.0"
flutter: ">=3.3.0"
dependencies:
flutter:

View File

@ -1,16 +1,16 @@
import 'package:flowy_infra_ui_platform_interface/flowy_infra_ui_platform_interface.dart';
import 'package:flutter/services.dart';
import '../flowy_infra_ui_platform_interface.dart';
// ignore_for_file: constant_identifier_names
const INFRA_UI_METHOD_CHANNEL_NAME = 'flowy_infra_ui_method';
const INFRA_UI_KEYBOARD_EVENT_CHANNEL_NAME = 'flowy_infra_ui_event/keyboard';
const INFRA_UI_METHOD_GET_PLATFORM_VERSION = 'getPlatformVersion';
class MethodChannelFlowyInfraUI extends FlowyInfraUIPlatform {
final MethodChannel _methodChannel = const MethodChannel(INFRA_UI_METHOD_CHANNEL_NAME);
final EventChannel _keyboardChannel = const EventChannel(INFRA_UI_KEYBOARD_EVENT_CHANNEL_NAME);
final MethodChannel _methodChannel =
const MethodChannel(INFRA_UI_METHOD_CHANNEL_NAME);
final EventChannel _keyboardChannel =
const EventChannel(INFRA_UI_KEYBOARD_EVENT_CHANNEL_NAME);
late final Stream<bool> _onKeyboardVisibilityChange =
_keyboardChannel.receiveBroadcastStream().map((event) => event as bool);
@ -20,7 +20,8 @@ class MethodChannelFlowyInfraUI extends FlowyInfraUIPlatform {
@override
Future<String> getPlatformVersion() async {
String? version = await _methodChannel.invokeMethod<String>(INFRA_UI_METHOD_GET_PLATFORM_VERSION);
String? version = await _methodChannel
.invokeMethod<String>(INFRA_UI_METHOD_GET_PLATFORM_VERSION);
return version ?? 'unknow';
}
}

View File

@ -9,7 +9,7 @@ packages:
source: hosted
version: "46.0.0"
analyzer:
dependency: "direct overridden"
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
@ -56,7 +56,7 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.11"
version: "3.3.0"
args:
dependency: transitive
description:
@ -70,7 +70,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
version: "2.9.0"
bloc:
dependency: "direct main"
description:
@ -154,7 +154,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
charcode:
dependency: "direct main"
description:
@ -182,7 +182,7 @@ packages:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
code_builder:
dependency: transitive
description:
@ -252,14 +252,14 @@ packages:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.5.0"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "3.0.2"
csslib:
dependency: transitive
description:
@ -378,7 +378,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
ffi:
dependency: transitive
description:
@ -714,21 +714,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
mime:
dependency: transitive
description:
@ -819,7 +819,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
path_drawing:
dependency: transitive
description:
@ -1153,7 +1153,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.9.0"
stack_trace:
dependency: transitive
description:
@ -1181,7 +1181,7 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
styled_widget:
dependency: "direct main"
description:
@ -1195,7 +1195,7 @@ packages:
name: sync_http
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
version: "0.3.1"
table_calendar:
dependency: "direct main"
description:
@ -1209,28 +1209,28 @@ packages:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
test:
dependency: transitive
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.21.1"
version: "1.21.4"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
version: "0.4.12"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.13"
version: "0.4.16"
textfield_tags:
dependency: "direct main"
description:
@ -1272,7 +1272,7 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
universal_platform:
dependency: transitive
description:
@ -1356,7 +1356,7 @@ packages:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "8.2.2"
version: "9.0.0"
watcher:
dependency: transitive
description:
@ -1423,5 +1423,5 @@ packages:
source: hosted
version: "3.1.1"
sdks:
dart: ">=2.17.6 <3.0.0"
flutter: ">=3.0.0"
dart: ">=2.18.0 <3.0.0"
flutter: ">=3.3.0"

View File

@ -18,7 +18,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=2.18.0 <3.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
@ -105,9 +105,6 @@ dev_dependencies:
freezed: ^2.1.0+1
bloc_test: ^9.0.2
dependency_overrides:
analyzer: ">=4.4.0 <5.0.0"
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your

View File

@ -27,7 +27,7 @@ parking_lot = "0.12.1"
lib-dispatch = { path = "../lib-dispatch" }
flowy-sdk = { path = "../flowy-sdk" }
dart-notify = { path = "../dart-notify", feature = ["dart"] }
dart-notify = { path = "../dart-notify" }
flowy-derive = { path = "../flowy-derive" }
[features]

View File

@ -6,7 +6,14 @@
[tasks.env_check]
dependencies = ["echo_env", "install_protobuf"]
condition = { env_set = [ "BUILD_FLAG", "RUST_COMPILE_TARGET", "CRATE_TYPE", "TARGET_OS"], channels = ["stable"] }
condition = { env_set = [
"BUILD_FLAG",
"RUST_COMPILE_TARGET",
"CRATE_TYPE",
"TARGET_OS",
], channels = [
"stable",
] }
[tasks.appflowy-sdk-dev]
mac_alias = "appflowy-sdk-dev-macos"
@ -16,22 +23,41 @@ linux_alias = "appflowy-sdk-dev-linux"
[tasks.appflowy-sdk-dev-android]
category = "Build"
dependencies = ["env_check"]
run_task = { name = ["setup-crate-type","sdk-build-android", "restore-crate-type"] }
run_task = { name = [
"setup-crate-type",
"sdk-build-android",
"restore-crate-type",
] }
[tasks.appflowy-sdk-dev-macos]
category = "Build"
dependencies = ["env_check"]
run_task = { name = ["setup-crate-type","sdk-build", "post-desktop", "restore-crate-type"] }
run_task = { name = [
"setup-crate-type",
"sdk-build",
"post-desktop",
"restore-crate-type",
] }
[tasks.appflowy-sdk-dev-windows]
category = "Build"
dependencies = ["env_check"]
run_task = { name = ["setup-crate-type","sdk-build", "post-desktop", "restore-crate-type"] }
run_task = { name = [
"setup-crate-type",
"sdk-build",
"post-desktop",
"restore-crate-type",
] }
[tasks.appflowy-sdk-dev-linux]
category = "Build"
dependencies = ["env_check"]
run_task = { name = ["setup-crate-type","sdk-build", "post-desktop", "restore-crate-type"] }
run_task = { name = [
"setup-crate-type",
"sdk-build",
"post-desktop",
"restore-crate-type",
] }
#
@ -90,7 +116,12 @@ script_runner = "@duckscript"
description = "Build flowy sdk in release mode"
category = "Build"
dependencies = ["env_check"]
run_task = { name = ["setup-crate-type","sdk-release-build", "post-desktop", "restore-crate-type"] }
run_task = { name = [
"setup-crate-type",
"sdk-release-build",
"post-desktop",
"restore-crate-type",
] }
#
[tasks.sdk-release-build]
@ -167,9 +198,19 @@ script_runner = "@duckscript"
[tasks.build-test-lib]
category = "Build"
dependencies = ["env_check"]
run_task = { name = ["setup-test-crate-type","build-test-backend", "copy-to-sandbox-folder", "restore-test-crate-type"] }
run_task = { name = [
"setup-test-crate-type",
"build-test-backend",
"copy-to-sandbox-folder",
"restore-test-crate-type",
] }
[tasks.build-test-backend]
mac_alias = "build-test-backend-default"
windows_alias = "build-test-backend-widnows"
linux_alias = "build-test-backend-default"
[tasks.build-test-backend-default]
private = true
script = [
"""
@ -182,7 +223,39 @@ script = [
]
script_runner = "@shell"
[tasks.build-test-backend-widnows]
private = true
script = [
"""
cd rust-lib/
rustup show
echo cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FEATURES}"
cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FEATURES}"
cd ../
""",
]
script_runner = "@shell"
[tasks.copy-to-sandbox-folder]
mac_alias = "copy-to-sandbox-folder-default"
windows_alias = "copy-to-sandbox-folder-windows"
linux_alias = "copy-to-sandbox-folder-default"
[tasks.copy-to-sandbox-folder-windows]
private = true
script = [
"""
# Copy the flowy_sdk lib to system temp directory for flutter unit test.
lib = set ${LIB_NAME}.${TEST_LIB_EXT}
dest = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/.sandbox/${lib}
rm ${dest}
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${TEST_COMPILE_TARGET}/${TEST_BUILD_FLAG}/${lib} \
${dest}
""",
]
script_runner = "@duckscript"
[tasks.copy-to-sandbox-folder-default]
private = true
script = [
"""

View File

@ -1,5 +1,23 @@
[tasks.dart_unit_test]
[tasks.dart_unit_test.macos]
description = "Run flutter unit tests"
script = '''
cargo make --profile test-macos dart_unit_test_inner
'''
[tasks.dart_unit_test.linux]
description = "Run flutter unit tests"
script = '''
cargo make --profile test-linux dart_unit_test_inner
'''
[tasks.dart_unit_test.windows]
description = "Run flutter unit tests"
script = '''
cargo make --profile test-windows dart_unit_test_inner
'''
[tasks.dart_unit_test_inner]
dependencies = ["build-test-lib"]
description = "Run flutter unit tests"
script = '''