From 409d2d1736c78b904f495b2fcebfa27e89cc6131 Mon Sep 17 00:00:00 2001 From: Ellet Date: Sat, 21 Sep 2024 15:21:31 +0300 Subject: [PATCH] chore: deprecate flutter_quill/extensions.dart (#2258) * chore: deprecate flutter_quill/extensions.dart * chore: remove all usages of extensions.dart in flutter_quill --- .../lib/screens/quill/my_quill_editor.dart | 2 +- .../lib/screens/quill/my_quill_toolbar.dart | 2 +- .../utils/element_utils/element_utils.dart | 2 +- .../lib/src/editor/image/image_menu.dart | 2 +- .../image/models/image_configurations.dart | 2 +- .../toolbar/camera/select_camera_action.dart | 2 +- .../toolbar/image/select_image_source.dart | 2 +- .../toolbar/video/select_video_source.dart | 2 +- lib/extensions.dart | 5 +++++ lib/flutter_quill_internal.dart | 21 +++++++++++++++++++ .../editor/embed/embed_editor_builder.dart | 2 +- lib/src/toolbar/buttons/clipboard_button.dart | 2 +- .../toolbar/buttons/font_family_button.dart | 2 +- lib/src/toolbar/buttons/font_size_button.dart | 2 +- .../toolbar/buttons/link_style2_button.dart | 4 ++-- .../toolbar/buttons/search/search_dialog.dart | 3 ++- 16 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 lib/flutter_quill_internal.dart diff --git a/example/lib/screens/quill/my_quill_editor.dart b/example/lib/screens/quill/my_quill_editor.dart index 505a9a09c..ad5eb13e5 100644 --- a/example/lib/screens/quill/my_quill_editor.dart +++ b/example/lib/screens/quill/my_quill_editor.dart @@ -5,8 +5,8 @@ import 'package:cached_network_image/cached_network_image.dart' import 'package:desktop_drop/desktop_drop.dart' show DropTarget; import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/material.dart'; -import 'package:flutter_quill/extensions.dart'; import 'package:flutter_quill/flutter_quill.dart'; +import 'package:flutter_quill/flutter_quill_internal.dart'; import 'package:flutter_quill_extensions/flutter_quill_extensions.dart'; // ignore: implementation_imports import 'package:flutter_quill_extensions/src/editor/image/widgets/image.dart' diff --git a/example/lib/screens/quill/my_quill_toolbar.dart b/example/lib/screens/quill/my_quill_toolbar.dart index 3c7faa524..ef13bd34d 100644 --- a/example/lib/screens/quill/my_quill_toolbar.dart +++ b/example/lib/screens/quill/my_quill_toolbar.dart @@ -3,8 +3,8 @@ import 'dart:io' as io show File; import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_quill/extensions.dart'; import 'package:flutter_quill/flutter_quill.dart'; +import 'package:flutter_quill/flutter_quill_internal.dart'; import 'package:flutter_quill_extensions/flutter_quill_extensions.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:image_cropper/image_cropper.dart'; diff --git a/flutter_quill_extensions/lib/src/common/utils/element_utils/element_utils.dart b/flutter_quill_extensions/lib/src/common/utils/element_utils/element_utils.dart index 6be7c1635..a350f288e 100644 --- a/flutter_quill_extensions/lib/src/common/utils/element_utils/element_utils.dart +++ b/flutter_quill_extensions/lib/src/common/utils/element_utils/element_utils.dart @@ -1,7 +1,7 @@ import 'package:flutter/foundation.dart' show immutable; import 'package:flutter/widgets.dart' show Alignment, BuildContext; -import 'package:flutter_quill/extensions.dart'; import 'package:flutter_quill/flutter_quill.dart' show Attribute, Node; +import 'package:flutter_quill/flutter_quill_internal.dart'; import 'element_shared_utils.dart'; diff --git a/flutter_quill_extensions/lib/src/editor/image/image_menu.dart b/flutter_quill_extensions/lib/src/editor/image/image_menu.dart index c0efff770..36e009c5c 100644 --- a/flutter_quill_extensions/lib/src/editor/image/image_menu.dart +++ b/flutter_quill_extensions/lib/src/editor/image/image_menu.dart @@ -1,9 +1,9 @@ import 'package:flutter/cupertino.dart' show showCupertinoModalPopup; import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/material.dart'; -import 'package:flutter_quill/extensions.dart'; import 'package:flutter_quill/flutter_quill.dart' show ImageUrl, QuillController, StyleAttribute, getEmbedNode; +import 'package:flutter_quill/flutter_quill_internal.dart'; import 'package:flutter_quill/translations.dart'; import 'package:super_clipboard/super_clipboard.dart'; diff --git a/flutter_quill_extensions/lib/src/editor/image/models/image_configurations.dart b/flutter_quill_extensions/lib/src/editor/image/models/image_configurations.dart index f8edcf0a7..8af3527f3 100644 --- a/flutter_quill_extensions/lib/src/editor/image/models/image_configurations.dart +++ b/flutter_quill_extensions/lib/src/editor/image/models/image_configurations.dart @@ -1,7 +1,7 @@ import 'dart:io' show File; import 'package:flutter/foundation.dart'; -import 'package:flutter_quill/extensions.dart'; +import 'package:flutter_quill/flutter_quill_internal.dart'; import '../image_embed_types.dart'; diff --git a/flutter_quill_extensions/lib/src/toolbar/camera/select_camera_action.dart b/flutter_quill_extensions/lib/src/toolbar/camera/select_camera_action.dart index 28e66da66..5d10de8b2 100644 --- a/flutter_quill_extensions/lib/src/toolbar/camera/select_camera_action.dart +++ b/flutter_quill_extensions/lib/src/toolbar/camera/select_camera_action.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_quill/extensions.dart'; +import 'package:flutter_quill/flutter_quill_internal.dart'; import 'package:flutter_quill/translations.dart'; import 'camera_types.dart'; diff --git a/flutter_quill_extensions/lib/src/toolbar/image/select_image_source.dart b/flutter_quill_extensions/lib/src/toolbar/image/select_image_source.dart index d67d11125..2a7241a25 100644 --- a/flutter_quill_extensions/lib/src/toolbar/image/select_image_source.dart +++ b/flutter_quill_extensions/lib/src/toolbar/image/select_image_source.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_quill/extensions.dart' show isDesktopApp; +import 'package:flutter_quill/flutter_quill_internal.dart' show isDesktopApp; import 'package:flutter_quill/translations.dart'; import '../../editor/image/image_embed_types.dart'; diff --git a/flutter_quill_extensions/lib/src/toolbar/video/select_video_source.dart b/flutter_quill_extensions/lib/src/toolbar/video/select_video_source.dart index 0c3126ef0..c19080f1a 100644 --- a/flutter_quill_extensions/lib/src/toolbar/video/select_video_source.dart +++ b/flutter_quill_extensions/lib/src/toolbar/video/select_video_source.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_quill/extensions.dart' show isDesktopApp; +import 'package:flutter_quill/flutter_quill_internal.dart' show isDesktopApp; import 'package:flutter_quill/translations.dart'; import 'models/video.dart'; diff --git a/lib/extensions.dart b/lib/extensions.dart index 002d1bd9e..96226bc9f 100644 --- a/lib/extensions.dart +++ b/lib/extensions.dart @@ -1,3 +1,8 @@ +@Deprecated( + 'The extensions.dart file was primarily intended for flutter_quill_extensions ' + 'to expose certain internal APIs and should not be used directly, as it is subject to breaking changes.\n' + 'The replacement is flutter_quill_internal.dart which is also for internal use only.', +) library flutter_quill.extensions; // This file contains exports that are meant to be used diff --git a/lib/flutter_quill_internal.dart b/lib/flutter_quill_internal.dart new file mode 100644 index 000000000..215778ee1 --- /dev/null +++ b/lib/flutter_quill_internal.dart @@ -0,0 +1,21 @@ +// WARNING: This file is for internal use for flutter_quill_extensions +// and other related packages. Breaking changes +// can be introduced in minor versions. + +@experimental +library; + +// This file contains exports that are meant to be used +// internally and are not part of the public API as +// breaking changes can happen. + +import 'package:meta/meta.dart' show experimental; + +export 'src/common/utils/platform.dart'; +export 'src/common/utils/string.dart'; +export 'src/common/utils/widgets.dart'; +export 'src/document/nodes/leaf.dart'; +export 'src/rules/delete.dart'; +export 'src/rules/format.dart'; +export 'src/rules/insert.dart'; +export 'src/rules/rule.dart'; diff --git a/lib/src/editor/embed/embed_editor_builder.dart b/lib/src/editor/embed/embed_editor_builder.dart index 3710db91a..00391b45e 100644 --- a/lib/src/editor/embed/embed_editor_builder.dart +++ b/lib/src/editor/embed/embed_editor_builder.dart @@ -1,8 +1,8 @@ import 'package:flutter/widgets.dart'; -import '../../../extensions.dart'; import '../../controller/quill_controller.dart'; import '../../document/nodes/leaf.dart' as leaf; +import '../../document/nodes/leaf.dart'; abstract class EmbedBuilder { const EmbedBuilder(); diff --git a/lib/src/toolbar/buttons/clipboard_button.dart b/lib/src/toolbar/buttons/clipboard_button.dart index 2c2be1ec1..b66ffbb62 100644 --- a/lib/src/toolbar/buttons/clipboard_button.dart +++ b/lib/src/toolbar/buttons/clipboard_button.dart @@ -3,8 +3,8 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import '../../../extensions.dart'; import '../../../flutter_quill.dart'; +import '../../common/utils/widgets.dart'; import '../../editor_toolbar_controller_shared/clipboard/clipboard_service_provider.dart'; import '../../l10n/extensions/localizations_ext.dart'; import '../base_button/base_value_button.dart'; diff --git a/lib/src/toolbar/buttons/font_family_button.dart b/lib/src/toolbar/buttons/font_family_button.dart index f759383cf..89742fb4a 100644 --- a/lib/src/toolbar/buttons/font_family_button.dart +++ b/lib/src/toolbar/buttons/font_family_button.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -import '../../../extensions.dart'; +import '../../common/utils/widgets.dart'; import '../../document/attribute.dart'; import '../../l10n/extensions/localizations_ext.dart'; import '../base_button/base_value_button.dart'; diff --git a/lib/src/toolbar/buttons/font_size_button.dart b/lib/src/toolbar/buttons/font_size_button.dart index bf94591d3..eb825bd67 100644 --- a/lib/src/toolbar/buttons/font_size_button.dart +++ b/lib/src/toolbar/buttons/font_size_button.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; -import '../../../extensions.dart'; import '../../common/utils/font.dart'; +import '../../common/utils/widgets.dart'; import '../../document/attribute.dart'; import '../../l10n/extensions/localizations_ext.dart'; import '../base_button/base_value_button.dart'; diff --git a/lib/src/toolbar/buttons/link_style2_button.dart b/lib/src/toolbar/buttons/link_style2_button.dart index 69528532b..3a77102e4 100644 --- a/lib/src/toolbar/buttons/link_style2_button.dart +++ b/lib/src/toolbar/buttons/link_style2_button.dart @@ -2,13 +2,13 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:url_launcher/link.dart'; -import '../../../extensions.dart' - show UtilityWidgets, AutoFormatMultipleLinksRule; +import '../../common/utils/widgets.dart'; import '../../controller/quill_controller.dart'; import '../../editor/widgets/link.dart'; import '../../editor_toolbar_shared/quill_configurations_ext.dart'; import '../../l10n/extensions/localizations_ext.dart'; import '../../l10n/widgets/localizations.dart'; +import '../../rules/insert.dart'; import '../base_button/base_value_button.dart'; import '../base_toolbar.dart'; import '../simple_toolbar_provider.dart'; diff --git a/lib/src/toolbar/buttons/search/search_dialog.dart b/lib/src/toolbar/buttons/search/search_dialog.dart index 72d959ef1..dc5648d2e 100644 --- a/lib/src/toolbar/buttons/search/search_dialog.dart +++ b/lib/src/toolbar/buttons/search/search_dialog.dart @@ -2,9 +2,10 @@ import 'dart:async'; import 'package:flutter/material.dart'; -import '../../../../extensions.dart'; +import '../../../common/utils/platform.dart'; import '../../../controller/quill_controller.dart'; import '../../../document/document.dart'; +import '../../../document/nodes/leaf.dart'; import '../../../l10n/extensions/localizations_ext.dart'; import '../../../l10n/widgets/localizations.dart'; import '../../theme/quill_dialog_theme.dart';