diff --git a/CHANGELOG.md b/CHANGELOG.md index 863c13fff..722801cca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **BREAKING**: The magnifier feature due to buggy behavior [#2413](https://github.com/singerdmx/flutter-quill/pull/2413). See [#2406](https://github.com/singerdmx/flutter-quill/issues/2406) for a list of reasons. +## [11.0.0-dev.16] - 2024-12-13 + +### Changed + +- Address warnings of `unreachable_switch_default` (introduced in Dart 3.6). + ## [11.0.0-dev.15] - 2024-12-13 ### Added @@ -157,7 +163,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Apple-specific font dependency for subscript and superscript functionality from the example. - **BREAKING**: The [`super_clipboard`](https://pub.dev/packages/super_clipboard) plugin, To restore legacy behavior for `super_clipboard`, use [`flutter_quill_extensions`](https://pub.dev/packages/flutter_quill_extensions) package and `FlutterQuillExtensions.useSuperClipboardPlugin()`. -[unreleased]: https://github.com/singerdmx/flutter-quill/compare/v11.0.0-dev.15...HEAD +[unreleased]: https://github.com/singerdmx/flutter-quill/compare/v11.0.0-dev.16...HEAD +[11.0.0-dev.16]: https://github.com/singerdmx/flutter-quill/compare/v11.0.0-dev.15...v11.0.0-dev.16 [11.0.0-dev.15]: https://github.com/singerdmx/flutter-quill/compare/v11.0.0-dev.14...v11.0.0-dev.15 [11.0.0-dev.14]: https://github.com/singerdmx/flutter-quill/compare/v11.0.0-dev.13...v11.0.0-dev.14 [11.0.0-dev.13]: https://github.com/singerdmx/flutter-quill/compare/v11.0.0-dev.12...v11.0.0-dev.13 diff --git a/analysis_options.yaml b/analysis_options.yaml index ee1ee99a9..b6065426f 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,9 +1,5 @@ include: package:flutter_lints/flutter.yaml -analyzer: -# TODO: Included for backward compatibility, remove when the minimum Dart SDK is 3.6.0 - errors: - unreachable_switch_default: ignore linter: rules: always_declare_return_types: true diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index ac474400d..703875deb 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -12,11 +12,11 @@ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 6AB2329557D1981D6B17B057 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04DE71649CFF61B6EA443C6C /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; 95A4F67B5B7C7331534DAE52 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CC42284313298068A87F511 /* Pods_RunnerTests.framework */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -190,9 +190,6 @@ productType = "com.apple.product-type.bundle.unit-test"; }; 97C146ED1CF9000F007C117D /* Runner */ = { - packageProductDependencies = ( - 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, - ); isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( @@ -203,13 +200,15 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - DEF0130752E58C6B1DAAA7EE /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); dependencies = ( ); name = Runner; + packageProductDependencies = ( + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, + ); productName = Runner; productReference = 97C146EE1CF9000F007C117D /* Runner.app */; productType = "com.apple.product-type.application"; @@ -218,9 +217,6 @@ /* Begin PBXProject section */ 97C146E61CF9000F007C117D /* Project object */ = { - packageReferences = ( - 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */, - ); isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; @@ -246,6 +242,9 @@ Base, ); mainGroup = 97C146E51CF9000F007C117D; + packageReferences = ( + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */, + ); productRefGroup = 97C146EF1CF9000F007C117D /* Products */; projectDirPath = ""; projectRoot = ""; @@ -353,23 +352,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - DEF0130752E58C6B1DAAA7EE /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -734,12 +716,14 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + /* Begin XCLocalSwiftPackageReference section */ - 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = { + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = { isa = XCLocalSwiftPackageReference; relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; }; /* End XCLocalSwiftPackageReference section */ + /* Begin XCSwiftPackageProductDependency section */ 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { isa = XCSwiftPackageProductDependency; diff --git a/example/pubspec.lock b/example/pubspec.lock index 38ffef72a..4c13c0714 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -217,7 +217,7 @@ packages: path: ".." relative: true source: path - version: "11.0.0-dev.15" + version: "11.0.0-dev.16" flutter_quill_delta_from_html: dependency: transitive description: @@ -232,7 +232,7 @@ packages: path: "../flutter_quill_extensions" relative: true source: path - version: "11.0.0-dev.4" + version: "11.0.0-dev.7" flutter_quill_test: dependency: "direct dev" description: diff --git a/flutter_quill_extensions/CHANGELOG.md b/flutter_quill_extensions/CHANGELOG.md index 10f788ab2..8cfce1354 100644 --- a/flutter_quill_extensions/CHANGELOG.md +++ b/flutter_quill_extensions/CHANGELOG.md @@ -10,6 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [11.0.0-dev.7] - 2024-12-13 + +### Changed + +- Address warnings of `unreachable_switch_default` (introduced in Dart 3.6). +- Use `Slider.adaptive` for the image resize slider on Apple platforms for consistency with `CupertinoActionSheet`. + ## [11.0.0-dev.6] - 2024-12-13 ### Changed diff --git a/flutter_quill_extensions/analysis_options.yaml b/flutter_quill_extensions/analysis_options.yaml index b294310e7..42a46376c 100644 --- a/flutter_quill_extensions/analysis_options.yaml +++ b/flutter_quill_extensions/analysis_options.yaml @@ -1,9 +1,5 @@ include: package:flutter_lints/flutter.yaml -analyzer: -# TODO: Included for backward compatibility, remove when the minimum Dart SDK is 3.6.0 - errors: - unreachable_switch_default: ignore linter: rules: always_declare_return_types: true diff --git a/flutter_quill_extensions/lib/src/editor/image/widgets/image_resizer.dart b/flutter_quill_extensions/lib/src/editor/image/widgets/image_resizer.dart index a8d2609b0..5f481f520 100644 --- a/flutter_quill_extensions/lib/src/editor/image/widgets/image_resizer.dart +++ b/flutter_quill_extensions/lib/src/editor/image/widgets/image_resizer.dart @@ -1,9 +1,7 @@ import 'package:flutter/cupertino.dart' show CupertinoActionSheet, CupertinoActionSheetAction; -import 'package:flutter/foundation.dart' show defaultTargetPlatform; -import 'package:flutter/material.dart' show Slider, Card; +import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart' show SchedulerBinding; -import 'package:flutter/widgets.dart'; import 'package:flutter_quill/internal.dart'; class ImageResizer extends StatefulWidget { @@ -39,21 +37,10 @@ class ImageResizerState extends State { @override Widget build(BuildContext context) { - switch (defaultTargetPlatform) { - case TargetPlatform.iOS: - return _showCupertinoMenu(); - case TargetPlatform.android: - return _showMaterialMenu(); - case TargetPlatform.macOS: - case TargetPlatform.windows: - case TargetPlatform.linux: - case TargetPlatform.fuchsia: - return _showMaterialMenu(); - default: - throw UnsupportedError( - 'Not supposed to be invoked for $defaultTargetPlatform', - ); + if (Theme.of(context).isCupertino) { + return _showCupertinoMenu(); } + return _showMaterialMenu(); } Widget _showMaterialMenu() { @@ -88,7 +75,7 @@ class ImageResizerState extends State { return Padding( padding: const EdgeInsets.symmetric(horizontal: 8), child: Card( - child: Slider( + child: Slider.adaptive( value: isWidth ? _width : _height, max: isWidth ? widget.maxWidth : widget.maxHeight, divisions: 1000, diff --git a/flutter_quill_extensions/pubspec.yaml b/flutter_quill_extensions/pubspec.yaml index 740e30384..2485be14c 100644 --- a/flutter_quill_extensions/pubspec.yaml +++ b/flutter_quill_extensions/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill_extensions description: Embed extensions for flutter_quill to support loading images and videos -version: 11.0.0-dev.6 +version: 11.0.0-dev.7 homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/ repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/ diff --git a/lib/src/editor/raw_editor/raw_editor_state.dart b/lib/src/editor/raw_editor/raw_editor_state.dart index 6d1bd2cf5..f026c43fd 100644 --- a/lib/src/editor/raw_editor/raw_editor_state.dart +++ b/lib/src/editor/raw_editor/raw_editor_state.dart @@ -322,11 +322,6 @@ class QuillRawEditorState extends EditorState case TargetPlatform.windows: widget.config.focusNode.unfocus(); break; - default: - throw UnsupportedError( - 'The platform ${defaultTargetPlatform.name} is not supported in the' - ' _defaultOnTapOutside()', - ); } } diff --git a/lib/src/editor/widgets/text/text_selection.dart b/lib/src/editor/widgets/text/text_selection.dart index e3dac7207..a748e60f5 100644 --- a/lib/src/editor/widgets/text/text_selection.dart +++ b/lib/src/editor/widgets/text/text_selection.dart @@ -295,8 +295,6 @@ class EditorTextSelectionOverlay { ? newSelection.extent : const TextPosition(offset: 0); break; - default: - throw ArgumentError('Invalid position'); } final currSelection = newSelection != null @@ -403,8 +401,6 @@ class _TextSelectionHandleOverlay extends StatefulWidget { return renderObject.selectionStartInViewport; case _TextSelectionHandlePosition.end: return renderObject.selectionEndInViewport; - default: - throw ArgumentError('Invalid position'); } } } @@ -491,8 +487,6 @@ class _TextSelectionHandleOverlayState isNormalized ? position.offset : widget.selection.extentOffset, ); break; - default: - throw ArgumentError('Invalid widget.position'); } if (newSelection.baseOffset >= newSelection.extentOffset) { diff --git a/pubspec.yaml b/pubspec.yaml index 768d838a5..f7fb7b017 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill description: "A rich text editor built for Android, iOS, Web, and desktop platforms. It's the WYSIWYG editor and a Quill component for Flutter." -version: 11.0.0-dev.15 +version: 11.0.0-dev.16 homepage: https://github.com/singerdmx/flutter-quill/ repository: https://github.com/singerdmx/flutter-quill/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/