singerdmx / flutter-quill

Rich text editor for Flutter
https://pub.dev/packages/flutter_quill
MIT License
2.6k stars 839 forks source link

Compatibility Issue with HarmonyOS has error #2389

Open shanshen6 opened 1 day ago

shanshen6 commented 1 day ago

Is there an existing issue for this?

Use case

https://gitee.com/harmonycommando_flutter/flutter

flutter build hap

Error output

```console start hap build... ../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/delegate.dart:269:13: Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match 'TargetPlatform.ohos'. - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart' ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart'). Try adding a default case or cases that match 'TargetPlatform.ohos'. switch (defaultTargetPlatform) { ^ ../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/delegate.dart:479:13: Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match 'TargetPlatform.ohos'. - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart' ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart'). Try adding a default case or cases that match 'TargetPlatform.ohos'. switch (defaultTargetPlatform) { ^ ../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/delegate.dart:625:13: Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match 'TargetPlatform.ohos'. - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart' ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart'). Try adding a default case or cases that match 'TargetPlatform.ohos'. switch (defaultTargetPlatform) { ^ ../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/delegate.dart:679:15: Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match 'TargetPlatform.ohos'. - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart' ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart'). Try adding a default case or cases that match 'TargetPlatform.ohos'. switch (defaultTargetPlatform) { ^ ../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/delegate.dart:693:15: Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match 'TargetPlatform.ohos'. - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart' ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart'). Try adding a default case or cases that match 'TargetPlatform.ohos'. switch (defaultTargetPlatform) { ^ ../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/delegate.dart:803:17: Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match 'TargetPlatform.ohos'. - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart' ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart'). Try adding a default case or cases that match 'TargetPlatform.ohos'. switch (defaultTargetPlatform) { ^ ../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/delegate.dart:843:15: Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match 'TargetPlatform.ohos'. - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart' ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart'). Try adding a default case or cases that match 'TargetPlatform.ohos'. switch (defaultTargetPlatform) { ^ ../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/text/text_selection.da rt:911:13: Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match 'TargetPlatform.ohos'. - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart' ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart'). Try adding a default case or cases that match 'TargetPlatform.ohos'. switch (defaultTargetPlatform) { ^ ../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/text/text_selection.da rt:1068:15: Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match 'TargetPlatform.ohos'. - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart' ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart'). Try adding a default case or cases that match 'TargetPlatform.ohos'. switch (defaultTargetPlatform) { ^ Target kernel_snapshot failed: Exception #0 KernelSnapshot.build (package:flutter_tools/src/build_system/targets/common.dart:279:7) #1 _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:875:9) #2 Future.wait. (dart:async/future.dart:524:21) #3 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:813:32) #4 Future.wait. (dart:async/future.dart:524:21) #5 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:813:32) #6 FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:642:16) #7 flutterAssemble (package:flutter_tools/src/ohos/hvigor.dart:306:32) #8 OhosHvigorBuilder.flutterBuildPre (package:flutter_tools/src/ohos/hvigor.dart:543:27) #9 OhosHvigorBuilder.buildApplicationPipeLine (package:flutter_tools/src/ohos/hvigor.dart:681:5) #10 OhosHvigorBuilder.buildHap (package:flutter_tools/src/ohos/hvigor.dart:479:5) #11 BuildHapCommand.runCommand (package:flutter_tools/src/commands/build_hap.dart:80:5) #12 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1394:27) #13 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19) #14 CommandRunner.runCommand (package:args/command_runner.dart:212:13) #15 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:372:9) #16 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19) #17 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:308:5) #18 run.. (package:flutter_tools/runner.dart:130:9) #19 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19) #20 main (package:flutter_tools/executable.dart:93:3) Error: Failed to compile application for the Ohos. Running Hvigor task assembleHap... ```

Proposal

Dear Flutter Quill Team,

We are currently using Flutter Quill as a cross-platform editor in our project. However, we have encountered several issues when trying to adapt it for HarmonyOS. Specifically, when running the flutter build hap command, we are faced with numerous errors that prevent us from successfully building the application for HarmonyOS.

Steps to Reproduce:

Set up a Flutter project with Flutter Quill as a dependency. Attempt to build the project for HarmonyOS using the flutter build hap command. Observe the errors that occur during the build process.

Expected Behavior:

The project should build successfully for HarmonyOS without any errors.

Actual Behavior:

The build process fails with multiple errors, indicating compatibility issues with HarmonyOS.

Error Logs:

(Include any relevant error logs or screenshots here)

Environment:

Flutter version: (include your Flutter version here) Dart version: (include your Dart version here) Flutter Quill version: (include the version of Flutter Quill you are using) HarmonyOS version: (include the version of HarmonyOS you are targeting)

Additional Context:

We believe that resolving these compatibility issues would greatly benefit the Flutter community, as it would enable more developers to use Flutter Quill in their HarmonyOS projects. We would appreciate any assistance or guidance you can provide to help us overcome these challenges.

Thank you for your attention to this matter. We look forward to your response.

Best regards,

shanshen6 commented 23 hours ago
image

Dear Flutter Quill Team,

We are currently using Flutter Quill as a cross-platform editor in our project. However, we have encountered several issues when trying to adapt it for HarmonyOS. Specifically, the delegate.dart file does not seem to be fully compatible with HarmonyOS. When running the flutter build hap command, we encounter numerous errors related to the lack of support for TargetPlatform.ohos.

Details:

File: delegate.dart Issue: The file does not handle TargetPlatform.ohos in various switch statements, leading to build errors when targeting HarmonyOS. Example: In the onTapDown method, the TargetPlatform.ohos case is missing. In the onDragSelectionUpdate method, the TargetPlatform.ohos case is not properly handled. Steps to Reproduce:

Set up a Flutter project with Flutter Quill as a dependency. Attempt to build the project for HarmonyOS using the flutter build hap command. Observe the errors that occur during the build process. Expected Behavior:

The project should build successfully for HarmonyOS without any errors.

Actual Behavior:

The build process fails with multiple errors, indicating compatibility issues with HarmonyOS.

Error Logs:

(Include any relevant error logs or screenshots here)

Environment:

Flutter version: (include your Flutter version here) Dart version: (include your Dart version here) Flutter Quill version: (include the version of Flutter Quill you are using) HarmonyOS version: (include the version of HarmonyOS you are targeting)

Additional Context:

We believe that resolving these compatibility issues would greatly benefit the Flutter community, as it would enable more developers to use Flutter Quill in their HarmonyOS projects. We would appreciate any assistance or guidance you can provide to help us overcome these challenges.

Thank you for your attention to this matter. We look forward to your response.

Best regards,

mny459 commented 59 minutes ago

Same issue.