From c3ea29b6d310756bcf7d4259630d1d726cb69070 Mon Sep 17 00:00:00 2001 From: Luke Date: Mon, 3 Jun 2024 17:48:29 +0100 Subject: [PATCH] chore: update to upstream 543c885bc118726b5d56f39ddc6179f4304c1f65 --- .../app/src/profile/AndroidManifest.xml | 3 +- example/android/build.gradle | 1 + .../gradle/wrapper/gradle-wrapper.properties | 2 +- example/android/settings.gradle | 10 +- example/ios/Podfile.lock | 68 +- lib/src/components/molecules/block_table.dart | 32 +- .../molecules/slidable_list_tile.dart | 8 +- .../organisms/camera/camera_page.dart | 2 +- .../organisms/file_picker/giphy_picker.dart | 32 +- .../organisms/quill_editor/color_button.dart | 3 +- .../organisms/quill_editor/quill_editor.dart | 7 +- .../organisms/quill_editor/quill_toolbar.dart | 776 +++++++++--------- 12 files changed, 484 insertions(+), 460 deletions(-) diff --git a/example/android/app/src/profile/AndroidManifest.xml b/example/android/app/src/profile/AndroidManifest.xml index c208884..f880684 100644 --- a/example/android/app/src/profile/AndroidManifest.xml +++ b/example/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/example/android/build.gradle b/example/android/build.gradle index 394293f..e3cfb3a 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -2,6 +2,7 @@ allprojects { repositories { google() jcenter() + mavenCentral() } subprojects { diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 6b66533..aeaff6f 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 85de5cb..aed088f 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -5,12 +5,14 @@ pluginManagement { def flutterSdkPath = properties.getProperty("flutter.sdk") assert flutterSdkPath != null, "flutter.sdk not set in local.properties" return flutterSdkPath - }() + } + settings.ext.flutterSdkPath = flutterSdkPath() - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") repositories { google() + jcenter() mavenCentral() gradlePluginPortal() } @@ -18,8 +20,8 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.4.2" apply false - id "org.jetbrains.kotlin.android" version "1.7.21" apply false + id "com.android.application" version "7.3.0" apply false + id "org.jetbrains.kotlin.android" version "1.7.10" apply false } include ":app" \ No newline at end of file diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index f47e146..83040ac 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -6,35 +6,35 @@ PODS: - JPSVolumeButtonHandler - device_info_plus (0.0.1): - Flutter - - DKImagePickerController/Core (4.3.4): + - DKImagePickerController/Core (4.3.9): - DKImagePickerController/ImageDataManager - DKImagePickerController/Resource - - DKImagePickerController/ImageDataManager (4.3.4) - - DKImagePickerController/PhotoGallery (4.3.4): + - DKImagePickerController/ImageDataManager (4.3.9) + - DKImagePickerController/PhotoGallery (4.3.9): - DKImagePickerController/Core - DKPhotoGallery - - DKImagePickerController/Resource (4.3.4) - - DKPhotoGallery (0.0.17): - - DKPhotoGallery/Core (= 0.0.17) - - DKPhotoGallery/Model (= 0.0.17) - - DKPhotoGallery/Preview (= 0.0.17) - - DKPhotoGallery/Resource (= 0.0.17) + - DKImagePickerController/Resource (4.3.9) + - DKPhotoGallery (0.0.19): + - DKPhotoGallery/Core (= 0.0.19) + - DKPhotoGallery/Model (= 0.0.19) + - DKPhotoGallery/Preview (= 0.0.19) + - DKPhotoGallery/Resource (= 0.0.19) - SDWebImage - SwiftyGif - - DKPhotoGallery/Core (0.0.17): + - DKPhotoGallery/Core (0.0.19): - DKPhotoGallery/Model - DKPhotoGallery/Preview - SDWebImage - SwiftyGif - - DKPhotoGallery/Model (0.0.17): + - DKPhotoGallery/Model (0.0.19): - SDWebImage - SwiftyGif - - DKPhotoGallery/Preview (0.0.17): + - DKPhotoGallery/Preview (0.0.19): - DKPhotoGallery/Model - DKPhotoGallery/Resource - SDWebImage - SwiftyGif - - DKPhotoGallery/Resource (0.0.17): + - DKPhotoGallery/Resource (0.0.19): - SDWebImage - SwiftyGif - file_picker (0.0.1): @@ -62,17 +62,17 @@ PODS: - JPSVolumeButtonHandler (1.0.5) - just_audio (0.0.1): - Flutter - - libwebp (1.3.1): - - libwebp/demux (= 1.3.1) - - libwebp/mux (= 1.3.1) - - libwebp/sharpyuv (= 1.3.1) - - libwebp/webp (= 1.3.1) - - libwebp/demux (1.3.1): + - libwebp (1.3.2): + - libwebp/demux (= 1.3.2) + - libwebp/mux (= 1.3.2) + - libwebp/sharpyuv (= 1.3.2) + - libwebp/webp (= 1.3.2) + - libwebp/demux (1.3.2): - libwebp/webp - - libwebp/mux (1.3.1): + - libwebp/mux (1.3.2): - libwebp/demux - - libwebp/sharpyuv (1.3.1) - - libwebp/webp (1.3.1): + - libwebp/sharpyuv (1.3.2) + - libwebp/webp (1.3.2): - libwebp/sharpyuv - Mantle (2.2.0): - Mantle/extobjc (= 2.2.0) @@ -90,10 +90,10 @@ PODS: - record_darwin (1.0.0): - Flutter - FlutterMacOS - - SDWebImage (5.17.0): - - SDWebImage/Core (= 5.17.0) - - SDWebImage/Core (5.17.0) - - SDWebImageWebPCoder (0.13.0): + - SDWebImage (5.19.2): + - SDWebImage/Core (= 5.19.2) + - SDWebImage/Core (5.19.2) + - SDWebImageWebPCoder (0.14.6): - libwebp (~> 1.0) - SDWebImage/Core (~> 5.17) - share_plus (0.0.1): @@ -106,7 +106,7 @@ PODS: - FlutterMacOS - super_native_extensions (0.0.1): - Flutter - - SwiftyGif (5.4.4) + - SwiftyGif (5.4.5) - url_launcher_ios (0.0.1): - Flutter - video_compress (0.3.0): @@ -209,8 +209,8 @@ SPEC CHECKSUMS: audio_session: 088d2483ebd1dc43f51d253d4a1c517d9a2e7207 camerawesome: 1e06540f60158809bc70f398ed1ac2cf93fe4188 device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d - DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac - DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 + DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c + DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60 file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 flutter_image_compress_common: ec1d45c362c9d30a3f6a0426c297f47c52007e3e @@ -220,7 +220,7 @@ SPEC CHECKSUMS: irondash_engine_context: 3458bf979b90d616ffb8ae03a150bafe2e860cc9 JPSVolumeButtonHandler: 53110330c9168ed325def93eabff39f0fe3e8082 just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa - libwebp: 33dc822fbbf4503668d09f7885bbfedc76c45e96 + libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009 Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d open_filex: 6e26e659846ec990262224a12ef1c528bb4edbe4 OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c @@ -228,13 +228,13 @@ SPEC CHECKSUMS: path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 record_darwin: 1f6619f2abac4d1ca91d3eeab038c980d76f1517 - SDWebImage: 750adf017a315a280c60fde706ab1e552a3ae4e9 - SDWebImageWebPCoder: af09429398d99d524cae2fe00f6f0f6e491ed102 + SDWebImage: dfe95b2466a9823cf9f0c6d01217c06550d7b29a + SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380 share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec super_native_extensions: 4916b3c627a9c7fffdc48a23a9eca0b1ac228fa7 - SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f + SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe video_compress: fce97e4fb1dfd88175aa07d2ffc8a2f297f87fbe video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3 @@ -242,4 +242,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: ef2759a31e8883d6b534c00ef22a7f4104f8de0d -COCOAPODS: 1.15.1 +COCOAPODS: 1.15.2 diff --git a/lib/src/components/molecules/block_table.dart b/lib/src/components/molecules/block_table.dart index 89d24c1..34708c3 100644 --- a/lib/src/components/molecules/block_table.dart +++ b/lib/src/components/molecules/block_table.dart @@ -122,7 +122,6 @@ class ZdsBlockTable extends StatefulWidget { class _BlockTable extends State with WidgetsBindingObserver { final LinkedScrollControllerGroup _controllers = LinkedScrollControllerGroup(); - late final double headerHeight; late ScrollController _tableHeader; late ScrollController _tableBody; @@ -139,13 +138,20 @@ class _BlockTable extends State with WidgetsBindingObserver { _tableBody = _controllers.addAndGet(); WidgetsBinding.instance.addPostFrameCallback((Duration timeStamp) { - headerHeight = widget.rowHeaderHeight; buildTable(); }); WidgetsBinding.instance.addObserver(this); } + TextScaler get _textScaler => MediaQuery.of(context).textScaler; + + double get _headerHeight => _textScaler.scale(widget.rowHeaderHeight); + + double get _columnWidth => _textScaler.scale(widget.columnWidth); + + double get _cellHeight => _textScaler.scale(widget.cellHeight); + @override void didChangeMetrics() { WidgetsBinding.instance.addPostFrameCallback((Duration timeStamp) { @@ -252,7 +258,7 @@ class _BlockTable extends State with WidgetsBindingObserver { ), alignment: Alignment.center, width: _getDayColumnWidth(), - height: 28, + height: _textScaler.scale(28), child: Text( items[index].text, style: themeData.textTheme.bodySmall?.copyWith( @@ -285,7 +291,7 @@ class _BlockTable extends State with WidgetsBindingObserver { children: [ if (row.header != null) Container( - height: headerHeight, + height: _headerHeight, width: _getAssocColumnWidth(), decoration: BoxDecoration( color: zetaColors.borderDisabled, @@ -327,7 +333,7 @@ class _BlockTable extends State with WidgetsBindingObserver { ), alignment: Alignment.center, width: _getAssocColumnWidth(), - height: widget.cellHeight + widget.cellPadding, + height: _cellHeight + widget.cellPadding, margin: const EdgeInsets.only(bottom: 1), child: cellItem.child ?? Text( @@ -355,7 +361,7 @@ class _BlockTable extends State with WidgetsBindingObserver { List _buildRowElements(int index) { final List cells = []; final List rows = widget.rows; - final double cellHeight = widget.cellHeight + widget.cellPadding; + final double cellHeight = _cellHeight + widget.cellPadding; final zetaColors = Zeta.of(context).colors; for (int j = 0; j < rows[index].data.length; j++) { final List columnWidgets = []; @@ -363,7 +369,7 @@ class _BlockTable extends State with WidgetsBindingObserver { if (rows[index].header != null) { columnWidgets.add( Container( - height: headerHeight, + height: _headerHeight, decoration: BoxDecoration( color: zetaColors.borderDisabled, border: Border( @@ -447,7 +453,7 @@ class _BlockTable extends State with WidgetsBindingObserver { Container( alignment: Alignment.center, width: _getDayColumnWidth(), - height: cellHeight + (rows[index].header != null ? headerHeight : 0), + height: cellHeight + (rows[index].header != null ? _headerHeight : 0), child: cells[indx], ), const SizedBox( @@ -489,7 +495,7 @@ class _BlockTable extends State with WidgetsBindingObserver { ), alignment: Alignment.center, width: _getAssocColumnWidth(), - height: 28, + height: _textScaler.scale(28), ).paddingOnly(right: 1); } @@ -503,7 +509,7 @@ class _BlockTable extends State with WidgetsBindingObserver { } double _firstColMinWidth() { - return widget.columnWidth + 40; + return _columnWidth + 40; } double _screenWidthSafe() { @@ -515,17 +521,17 @@ class _BlockTable extends State with WidgetsBindingObserver { double _getDayColumnWidth() { final bool isLandscape = MediaQuery.of(context).orientation == Orientation.landscape; if (!isLandscape && (!context.isTablet())) { - return widget.columnWidth; + return _columnWidth; } double screenWidth = _screenWidthSafe().floorToDouble(); screenWidth -= _firstColMinWidth(); // remove first column final double suggestedWidth = (screenWidth / 7).floorToDouble(); - return suggestedWidth > widget.columnWidth ? suggestedWidth : widget.columnWidth; + return suggestedWidth > _columnWidth ? suggestedWidth : _columnWidth; } @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { super.debugFillProperties(properties); - properties.add(DoubleProperty('headerHeight', headerHeight)); + properties.add(DoubleProperty('headerHeight', _headerHeight)); } } diff --git a/lib/src/components/molecules/slidable_list_tile.dart b/lib/src/components/molecules/slidable_list_tile.dart index d6b5024..50f9b92 100644 --- a/lib/src/components/molecules/slidable_list_tile.dart +++ b/lib/src/components/molecules/slidable_list_tile.dart @@ -49,6 +49,7 @@ class ZdsSlidableListTile extends StatelessWidget { this.onTap, this.slideEnabled = true, this.semanticDescription, + this.excludeSemantics = false, }) : assert(actions == null || slideButtonWidth * actions.length <= width, ''); /// The tile's main content. Usually a [Row] @@ -86,6 +87,8 @@ class ZdsSlidableListTile extends StatelessWidget { /// Typically will contain all the text displayed on the card UI. final String? semanticDescription; + /// Flag to exclude child component semantics. + final bool excludeSemantics; @override Widget build(BuildContext context) { final Map semanticActions = {}; @@ -99,7 +102,7 @@ class ZdsSlidableListTile extends StatelessWidget { return Semantics( label: semanticDescription, customSemanticsActions: semanticActions, - excludeSemantics: semanticDescription != null, + excludeSemantics: excludeSemantics, child: Slidable( enabled: slideEnabled, startActionPane: leadingActions != null && leadingActions!.isNotEmpty @@ -147,7 +150,8 @@ class ZdsSlidableListTile extends StatelessWidget { ..add(ObjectFlagProperty.has('onTap', onTap)) ..add(DiagnosticsProperty('slideEnabled', slideEnabled)) ..add(DoubleProperty('minHeight', minHeight)) - ..add(StringProperty('semanticDescription', semanticDescription)); + ..add(StringProperty('semanticDescription', semanticDescription)) + ..add(DiagnosticsProperty('excludeSemantics', excludeSemantics)); } } diff --git a/lib/src/components/organisms/camera/camera_page.dart b/lib/src/components/organisms/camera/camera_page.dart index d748a25..f23c500 100644 --- a/lib/src/components/organisms/camera/camera_page.dart +++ b/lib/src/components/organisms/camera/camera_page.dart @@ -147,7 +147,7 @@ class ZdsCamera extends StatelessWidget { @override Widget build(BuildContext context) { return PopScope( - onPopInvoked: (_) => Future.value(false), + canPop: false, child: Scaffold( backgroundColor: Colors.black, body: SafeArea( diff --git a/lib/src/components/organisms/file_picker/giphy_picker.dart b/lib/src/components/organisms/file_picker/giphy_picker.dart index 226b167..8cab790 100644 --- a/lib/src/components/organisms/file_picker/giphy_picker.dart +++ b/lib/src/components/organisms/file_picker/giphy_picker.dart @@ -62,7 +62,7 @@ class _ZdsGiphyPickerState extends State { int offset = 0; /// Controller to manage scroll behavior. - ScrollController scrollController = ScrollController(); + final ScrollController _scrollController = ScrollController(); /// Controller to manage the search text. final TextEditingController _searchController = TextEditingController(); @@ -71,9 +71,9 @@ class _ZdsGiphyPickerState extends State { Timer? _debounce; /// Delay before the debounce effect takes place. - late Duration debounceDelay; + late Duration _debounceDelay; - List selectedGIFs = []; + final List _selectedGifs = []; @override void initState() { @@ -83,7 +83,7 @@ class _ZdsGiphyPickerState extends State { setState(() {}); }); - scrollController.addListener(_loadMore); + _scrollController.addListener(_loadMore); } @override @@ -92,7 +92,7 @@ class _ZdsGiphyPickerState extends State { const double gifWidth = 80; - scrollController.addListener(_loadMore); + _scrollController.addListener(_loadMore); // Set items count responsive final int crossAxisCount = (MediaQuery.of(context).size.width / gifWidth).round(); @@ -134,9 +134,9 @@ class _ZdsGiphyPickerState extends State { actions: widget.allowMultiple ? [ TextButton( - onPressed: selectedGIFs.isNotEmpty + onPressed: _selectedGifs.isNotEmpty ? () { - Navigator.pop(context, selectedGIFs); + Navigator.pop(context, _selectedGifs); } : null, child: Text(ComponentStrings.of(context).get('ADD', 'Add')), @@ -170,7 +170,7 @@ class _ZdsGiphyPickerState extends State { child: GridView.builder( itemCount: _list.length, padding: const EdgeInsets.symmetric(horizontal: 12), - controller: scrollController, + controller: _scrollController, gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( maxCrossAxisExtent: box.maxWidth > 500 ? 200 : 100, crossAxisSpacing: 2, @@ -239,12 +239,12 @@ class _ZdsGiphyPickerState extends State { ), if (widget.allowMultiple) Checkbox( - value: selectedGIFs.contains(gif), + value: _selectedGifs.contains(gif), shape: const CircleBorder(), onChanged: (bool? value) { _toggleCheckBox(gif); }, - side: selectedGIFs.contains(gif) + side: _selectedGifs.contains(gif) ? const BorderSide( color: Colors.red, width: 2, @@ -258,10 +258,10 @@ class _ZdsGiphyPickerState extends State { void _toggleCheckBox(GiphyGif gif) { setState(() { - if (selectedGIFs.contains(gif)) { - selectedGIFs.remove(gif); + if (_selectedGifs.contains(gif)) { + _selectedGifs.remove(gif); } else { - selectedGIFs.add(gif); + _selectedGifs.add(gif); } }); } @@ -324,9 +324,9 @@ class _ZdsGiphyPickerState extends State { void debugFillProperties(DiagnosticPropertiesBuilder properties) { super.debugFillProperties(properties); properties - ..add(DiagnosticsProperty('debounceDelay', debounceDelay)) + ..add(DiagnosticsProperty('debounceDelay', _debounceDelay)) ..add(IntProperty('offset', offset)) - ..add(DiagnosticsProperty('scrollController', scrollController)) - ..add(IterableProperty('selecetdGifs', selectedGIFs)); + ..add(DiagnosticsProperty('scrollController', _scrollController)) + ..add(IterableProperty('selecetdGifs', _selectedGifs)); } } diff --git a/lib/src/components/organisms/quill_editor/color_button.dart b/lib/src/components/organisms/quill_editor/color_button.dart index 079352e..70d603b 100644 --- a/lib/src/components/organisms/quill_editor/color_button.dart +++ b/lib/src/components/organisms/quill_editor/color_button.dart @@ -4,12 +4,11 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_colorpicker/flutter_colorpicker.dart' hide ColorExtension1; +import 'package:flutter_colorpicker/flutter_colorpicker.dart'; import 'package:flutter_quill/flutter_quill.dart'; import 'package:flutter_quill/translations.dart'; import '../../../utils/localizations/translation.dart'; -import '../../../utils/tools/utils.dart'; /// Controls color styles. /// diff --git a/lib/src/components/organisms/quill_editor/quill_editor.dart b/lib/src/components/organisms/quill_editor/quill_editor.dart index a64fb15..e25e6db 100644 --- a/lib/src/components/organisms/quill_editor/quill_editor.dart +++ b/lib/src/components/organisms/quill_editor/quill_editor.dart @@ -97,15 +97,15 @@ class ZdsQuillEditor extends StatelessWidget { // If not readOnly, wrap the editor in a column with the toolbar return Column( children: [ - if (quillToolbarPosition == QuillToolbarPosition.top) _buildToolbar(context), + if (quillToolbarPosition == QuillToolbarPosition.top) _buildToolbar(context, QuillToolbarPosition.top), Expanded(child: editor), - if (quillToolbarPosition == QuillToolbarPosition.bottom) _buildToolbar(context), + if (quillToolbarPosition == QuillToolbarPosition.bottom) _buildToolbar(context, QuillToolbarPosition.bottom), ], ); } /// Constructs the toolbar for the Quill editor. - Widget _buildToolbar(BuildContext context) { + Widget _buildToolbar(BuildContext context, QuillToolbarPosition position) { return ZdsQuillToolbar.custom( context: context, controller: controller, @@ -113,6 +113,7 @@ class ZdsQuillEditor extends StatelessWidget { toolbarIconSize: toolbarIconSize, langCode: langCode, toolbarColor: toolbarColor, + quillToolbarPosition: position, ); } diff --git a/lib/src/components/organisms/quill_editor/quill_toolbar.dart b/lib/src/components/organisms/quill_editor/quill_toolbar.dart index 1a26713..45c0cd5 100644 --- a/lib/src/components/organisms/quill_editor/quill_toolbar.dart +++ b/lib/src/components/organisms/quill_editor/quill_toolbar.dart @@ -199,6 +199,7 @@ class ZdsQuillToolbar extends QuillToolbar { required BuildContext context, required QuillController controller, required Set toolbarOptions, + QuillToolbarPosition quillToolbarPosition = QuillToolbarPosition.bottom, double? toolbarIconSize, String? langCode, Color? toolbarColor, @@ -210,6 +211,7 @@ class ZdsQuillToolbar extends QuillToolbar { toolbarIconSize: toolbarIconSize ?? kDefaultIconSize, controller: controller, color: effectiveToolbarColor, + quillToolbarPosition: quillToolbarPosition, locale: (langCode?.isNotEmpty ?? false) ? Locale(langCode!.substring(0, 2)) : null, showUndo: toolbarOptions.contains(QuillToolbarOption.undo), showRedo: toolbarOptions.contains(QuillToolbarOption.redo), @@ -219,6 +221,7 @@ class ZdsQuillToolbar extends QuillToolbar { showStrikeThrough: toolbarOptions.contains(QuillToolbarOption.strikeThrough), showSmallButton: toolbarOptions.contains(QuillToolbarOption.smallButton), showColorButton: toolbarOptions.contains(QuillToolbarOption.textColor), + showCodeBlock: toolbarOptions.contains(QuillToolbarOption.codeBlock), showBackgroundColorButton: toolbarOptions.contains(QuillToolbarOption.backgroundColor), showClearFormat: toolbarOptions.contains(QuillToolbarOption.clearFormat), showInlineCode: toolbarOptions.contains(QuillToolbarOption.inlineCode), @@ -230,7 +233,6 @@ class ZdsQuillToolbar extends QuillToolbar { showIndent: toolbarOptions.contains(QuillToolbarOption.indentation), showQuote: toolbarOptions.contains(QuillToolbarOption.quotes), showLink: toolbarOptions.contains(QuillToolbarOption.link), - linkRegExp: RegExp(r'(http|ftp|https)://[\w-]+(\.[\w-]+)+([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?'), showSubscript: false, showSuperscript: false, showSearchButton: false, @@ -264,6 +266,7 @@ class ZdsQuillToolbar extends QuillToolbar { bool showStrikeThrough = true, bool showInlineCode = true, bool showColorButton = true, + bool showCodeBlock = true, bool showBackgroundColorButton = true, bool showClearFormat = true, bool showAlignmentButtons = false, @@ -284,7 +287,7 @@ class ZdsQuillToolbar extends QuillToolbar { bool showSearchButton = true, bool showSubscript = true, bool showSuperscript = true, - bool showCodeBlock = false, + QuillToolbarPosition quillToolbarPosition = QuillToolbarPosition.bottom, List customButtons = const [], /// Toolbar items to display for controls of embed blocks @@ -377,414 +380,423 @@ class ZdsQuillToolbar extends QuillToolbar { ), ), key: key, - child: Builder( - builder: (context) { - // default button tooltips - final buttonTooltips = tooltips ?? - { - ToolbarButtons.undo: componentString.get('STR_UNDO', context.loc.undo), - ToolbarButtons.redo: componentString.get('REDO', context.loc.redo), - ToolbarButtons.fontFamily: componentString.get('FONT_FAMILY', context.loc.fontFamily), - ToolbarButtons.fontSize: componentString.get('FONT_SIZE', context.loc.fontSize), - ToolbarButtons.bold: componentString.get('BOLD', context.loc.bold), - ToolbarButtons.subscript: componentString.get('SUBSCRIPT', context.loc.subscript), - ToolbarButtons.superscript: componentString.get('SUPERSCRIPT', context.loc.superscript), - ToolbarButtons.italic: componentString.get('ITALIC', context.loc.italic), - ToolbarButtons.small: componentString.get('SMALL', context.loc.small), - ToolbarButtons.underline: componentString.get('UNDERLINE', context.loc.underline), - ToolbarButtons.strikeThrough: componentString.get('STRIKE_THROUGH', context.loc.strikeThrough), - ToolbarButtons.inlineCode: componentString.get('INLINE_CODE', context.loc.inlineCode), - ToolbarButtons.color: componentString.get('FONT_COLOR', context.loc.fontColor), - ToolbarButtons.backgroundColor: componentString.get('BACKGROUND_COLOR', context.loc.backgroundColor), - ToolbarButtons.clearFormat: componentString.get('CLEAR_FORMAT', context.loc.clearFormat), - ToolbarButtons.leftAlignment: componentString.get('ALIGN_LEFT', context.loc.alignLeft), - ToolbarButtons.centerAlignment: componentString.get('ALIGN_CENTER', context.loc.alignCenter), - ToolbarButtons.rightAlignment: componentString.get('ALIGN_RIGHT', context.loc.alignRight), - ToolbarButtons.justifyAlignment: componentString.get('JUSTIFY_WIDTH', context.loc.justifyWinWidth), - ToolbarButtons.direction: componentString.get('TEXT_DIRECTION', context.loc.textDirection), - ToolbarButtons.headerStyle: componentString.get('HEADER_STYLE', context.loc.headerStyle), - ToolbarButtons.listNumbers: componentString.get('NUMBERED_LIST', context.loc.numberedList), - ToolbarButtons.listBullets: componentString.get('BULLET_LIST', context.loc.bulletList), - ToolbarButtons.listChecks: componentString.get('CHECKED_LIST', context.loc.checkedList), - ToolbarButtons.codeBlock: componentString.get('CODE_BLOCK', context.loc.codeBlock), - ToolbarButtons.quote: componentString.get('EDITOR_QUOTE', context.loc.quote), - ToolbarButtons.indentIncrease: componentString.get('INCREASE_INDENT', context.loc.increaseIndent), - ToolbarButtons.indentDecrease: componentString.get('DECREASE_INDENT', context.loc.decreaseIndent), - ToolbarButtons.link: componentString.get('INSERT_URL', context.loc.link), - ToolbarButtons.search: componentString.get('SEARCH', context.loc.search), - }; - - return Container( - decoration: configurations.decoration ?? BoxDecoration(color: configurations.color), - constraints: BoxConstraints.tightFor( - height: configurations.axis == Axis.horizontal ? configurations.toolbarSize : null, - width: configurations.axis == Axis.vertical ? configurations.toolbarSize : null, - ), - child: Material( - color: configurations.color, - child: QuillToolbarArrowIndicatedButtonList( - axis: Axis.horizontal, - buttons: [ - if (showUndo) - QuillToolbarHistoryButton( - controller: controller, - isUndo: true, - options: QuillToolbarHistoryButtonOptions( - iconButtonFactor: toolbarSectionSpacing, - iconData: Icons.undo_outlined, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.undo], + child: TooltipTheme( + data: TooltipThemeData(preferBelow: quillToolbarPosition == QuillToolbarPosition.top), + child: Builder( + builder: (context) { + // default button tooltips + final buttonTooltips = tooltips ?? + { + ToolbarButtons.undo: componentString.get('STR_UNDO', context.loc.undo), + ToolbarButtons.redo: componentString.get('REDO', context.loc.redo), + ToolbarButtons.fontFamily: componentString.get('FONT_FAMILY', context.loc.fontFamily), + ToolbarButtons.fontSize: componentString.get('FONT_SIZE', context.loc.fontSize), + ToolbarButtons.bold: componentString.get('BOLD', context.loc.bold), + ToolbarButtons.subscript: componentString.get('SUBSCRIPT', context.loc.subscript), + ToolbarButtons.superscript: componentString.get('SUPERSCRIPT', context.loc.superscript), + ToolbarButtons.italic: componentString.get('ITALIC', context.loc.italic), + ToolbarButtons.small: componentString.get('SMALL', context.loc.small), + ToolbarButtons.underline: componentString.get('UNDERLINE', context.loc.underline), + ToolbarButtons.strikeThrough: componentString.get('STRIKE_THROUGH', context.loc.strikeThrough), + ToolbarButtons.inlineCode: componentString.get('INLINE_CODE', context.loc.inlineCode), + ToolbarButtons.color: componentString.get('FONT_COLOR', context.loc.fontColor), + ToolbarButtons.backgroundColor: componentString.get('BACKGROUND_COLOR', context.loc.backgroundColor), + ToolbarButtons.clearFormat: componentString.get('CLEAR_FORMAT', context.loc.clearFormat), + ToolbarButtons.leftAlignment: componentString.get('ALIGN_LEFT', context.loc.alignLeft), + ToolbarButtons.centerAlignment: componentString.get('ALIGN_CENTER', context.loc.alignCenter), + ToolbarButtons.rightAlignment: componentString.get('ALIGN_RIGHT', context.loc.alignRight), + ToolbarButtons.justifyAlignment: componentString.get('JUSTIFY_WIDTH', context.loc.justifyWinWidth), + ToolbarButtons.direction: componentString.get('TEXT_DIRECTION', context.loc.textDirection), + ToolbarButtons.headerStyle: componentString.get('HEADER_STYLE', context.loc.headerStyle), + ToolbarButtons.listNumbers: componentString.get('NUMBERED_LIST', context.loc.numberedList), + ToolbarButtons.listBullets: componentString.get('BULLET_LIST', context.loc.bulletList), + ToolbarButtons.listChecks: componentString.get('CHECKED_LIST', context.loc.checkedList), + ToolbarButtons.codeBlock: componentString.get('CODE_BLOCK', context.loc.codeBlock), + ToolbarButtons.quote: componentString.get('EDITOR_QUOTE', context.loc.quote), + ToolbarButtons.indentIncrease: componentString.get('INCREASE_INDENT', context.loc.increaseIndent), + ToolbarButtons.indentDecrease: componentString.get('DECREASE_INDENT', context.loc.decreaseIndent), + ToolbarButtons.link: componentString.get('INSERT_URL', context.loc.link), + ToolbarButtons.search: componentString.get('SEARCH', context.loc.search), + }; + + return Container( + decoration: configurations.decoration ?? BoxDecoration(color: configurations.color), + constraints: BoxConstraints.tightFor( + height: configurations.axis == Axis.horizontal ? configurations.toolbarSize : null, + width: configurations.axis == Axis.vertical ? configurations.toolbarSize : null, + ), + child: Material( + color: configurations.color, + child: QuillToolbarArrowIndicatedButtonList( + axis: Axis.horizontal, + buttons: [ + if (showUndo) + QuillToolbarHistoryButton( + controller: controller, + isUndo: true, + options: QuillToolbarHistoryButtonOptions( + iconButtonFactor: toolbarSectionSpacing, + iconData: Icons.undo_outlined, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.undo], + ), ), - ), - if (showRedo) ...[ - QuillToolbarHistoryButton( - controller: controller, - isUndo: false, - options: QuillToolbarHistoryButtonOptions( - iconData: Icons.redo_outlined, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.redo], + if (showRedo) ...[ + QuillToolbarHistoryButton( + controller: controller, + isUndo: false, + options: QuillToolbarHistoryButtonOptions( + iconData: Icons.redo_outlined, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.redo], + ), ), - ), - if (showDividers) QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), - ], - if (showHeaderStyle) ...[ - QuillToolbarSelectHeaderStyleButtons( - controller: controller, - options: QuillToolbarSelectHeaderStyleButtonsOptions( - tooltip: buttonTooltips[ToolbarButtons.headerStyle], - axis: axis, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, + if (showDividers) + QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), + ], + if (showHeaderStyle) ...[ + QuillToolbarSelectHeaderStyleButtons( + controller: controller, + options: QuillToolbarSelectHeaderStyleButtonsOptions( + tooltip: buttonTooltips[ToolbarButtons.headerStyle], + axis: axis, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + ), ), - ), - if (showDividers) QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), - ], - if (showBoldButton) - QuillToolbarToggleStyleButton( - attribute: Attribute.bold, - controller: controller, - options: QuillToolbarToggleStyleButtonOptions( - iconData: Icons.format_bold, - iconSize: toolbarIconSize, - tooltip: buttonTooltips[ToolbarButtons.bold], - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, + if (showDividers) + QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), + ], + if (showBoldButton) + QuillToolbarToggleStyleButton( + attribute: Attribute.bold, + controller: controller, + options: QuillToolbarToggleStyleButtonOptions( + iconData: Icons.format_bold, + iconSize: toolbarIconSize, + tooltip: buttonTooltips[ToolbarButtons.bold], + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + ), ), - ), - if (showSubscript) - QuillToolbarToggleStyleButton( - attribute: Attribute.subscript, - controller: controller, - options: QuillToolbarToggleStyleButtonOptions( - iconData: Icons.subscript, - iconSize: toolbarIconSize, - tooltip: buttonTooltips[ToolbarButtons.subscript], - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, + if (showSubscript) + QuillToolbarToggleStyleButton( + attribute: Attribute.subscript, + controller: controller, + options: QuillToolbarToggleStyleButtonOptions( + iconData: Icons.subscript, + iconSize: toolbarIconSize, + tooltip: buttonTooltips[ToolbarButtons.subscript], + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + ), ), - ), - if (showSuperscript) - QuillToolbarToggleStyleButton( - attribute: Attribute.superscript, - controller: controller, - options: QuillToolbarToggleStyleButtonOptions( - iconData: Icons.superscript, - iconSize: toolbarIconSize, - tooltip: buttonTooltips[ToolbarButtons.superscript], - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, + if (showSuperscript) + QuillToolbarToggleStyleButton( + attribute: Attribute.superscript, + controller: controller, + options: QuillToolbarToggleStyleButtonOptions( + iconData: Icons.superscript, + iconSize: toolbarIconSize, + tooltip: buttonTooltips[ToolbarButtons.superscript], + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + ), ), - ), - if (showItalicButton) - QuillToolbarToggleStyleButton( - attribute: Attribute.italic, - controller: controller, - options: QuillToolbarToggleStyleButtonOptions( - iconData: Icons.format_italic, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - tooltip: buttonTooltips[ToolbarButtons.italic], - afterButtonPressed: afterButtonPressed, + if (showItalicButton) + QuillToolbarToggleStyleButton( + attribute: Attribute.italic, + controller: controller, + options: QuillToolbarToggleStyleButtonOptions( + iconData: Icons.format_italic, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + tooltip: buttonTooltips[ToolbarButtons.italic], + afterButtonPressed: afterButtonPressed, + ), ), - ), - if (showUnderLineButton) - QuillToolbarToggleStyleButton( - attribute: Attribute.underline, - controller: controller, - options: QuillToolbarToggleStyleButtonOptions( - iconData: Icons.format_underline, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.underline], + if (showUnderLineButton) + QuillToolbarToggleStyleButton( + attribute: Attribute.underline, + controller: controller, + options: QuillToolbarToggleStyleButtonOptions( + iconData: Icons.format_underline, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.underline], + ), ), - ), - if (showStrikeThrough) - QuillToolbarToggleStyleButton( - attribute: Attribute.strikeThrough, - controller: controller, - options: QuillToolbarToggleStyleButtonOptions( - iconData: Icons.format_strikethrough, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.strikeThrough], + if (showStrikeThrough) + QuillToolbarToggleStyleButton( + attribute: Attribute.strikeThrough, + controller: controller, + options: QuillToolbarToggleStyleButtonOptions( + iconData: Icons.format_strikethrough, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.strikeThrough], + ), ), - ), - if (showSmallButton) - QuillToolbarToggleStyleButton( - attribute: Attribute.small, - controller: controller, - options: QuillToolbarToggleStyleButtonOptions( - iconData: Icons.format_size, - iconSize: toolbarIconSize, - tooltip: buttonTooltips[ToolbarButtons.small], - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, + if (showSmallButton) + QuillToolbarToggleStyleButton( + attribute: Attribute.small, + controller: controller, + options: QuillToolbarToggleStyleButtonOptions( + iconData: Icons.format_size, + iconSize: toolbarIconSize, + tooltip: buttonTooltips[ToolbarButtons.small], + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + ), ), - ), - if (showInlineCode) - Column( - children: [ - QuillToolbarToggleStyleButton( - attribute: Attribute.inlineCode, - controller: controller, - options: QuillToolbarToggleStyleButtonOptions( - iconData: Icons.code, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.inlineCode], + if (showInlineCode) + Column( + children: [ + QuillToolbarToggleStyleButton( + attribute: Attribute.inlineCode, + controller: controller, + options: QuillToolbarToggleStyleButtonOptions( + iconData: Icons.code, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.inlineCode], + ), ), + ], + ), + if (showDividers) QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), + if (showColorButton) + ZdsQuillToolbarColorButton( + controller: controller, + isBackground: false, + options: QuillToolbarColorButtonOptions( + iconData: Icons.color_lens, + iconSize: toolbarIconSize, + tooltip: buttonTooltips[ToolbarButtons.color], + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, ), - ], - ), - if (showDividers) QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), - if (showColorButton) - ZdsQuillToolbarColorButton( - controller: controller, - isBackground: false, - options: QuillToolbarColorButtonOptions( - iconData: Icons.color_lens, - iconSize: toolbarIconSize, - tooltip: buttonTooltips[ToolbarButtons.color], - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, ), - ), - if (showBackgroundColorButton) - ZdsQuillToolbarColorButton( - controller: controller, - isBackground: true, - options: QuillToolbarColorButtonOptions( - iconData: Icons.format_color_fill, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.backgroundColor], + if (showBackgroundColorButton) + ZdsQuillToolbarColorButton( + controller: controller, + isBackground: true, + options: QuillToolbarColorButtonOptions( + iconData: Icons.format_color_fill, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.backgroundColor], + ), ), - ), - if (showClearFormat) - QuillToolbarClearFormatButton( - controller: controller, - options: QuillToolbarBaseButtonOptions( - iconData: Icons.format_clear, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.clearFormat], + if (showClearFormat) + QuillToolbarClearFormatButton( + controller: controller, + options: QuillToolbarBaseButtonOptions( + iconData: Icons.format_clear, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.clearFormat], + ), ), - ), - if (embedButtons != null) - for (final EmbedButtonBuilder builder in embedButtons) - builder(controller, toolbarIconSize, iconTheme, dialogTheme), - if (showDividers && - isButtonGroupShown[0] && - (isButtonGroupShown[1] || - isButtonGroupShown[2] || - isButtonGroupShown[3] || - isButtonGroupShown[4] || - isButtonGroupShown[5])) - QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), - if (showAlignmentButtons) - QuillToolbarSelectAlignmentButtons( - controller: controller, - options: QuillToolbarSelectAlignmentButtonOptions( - tooltips: QuillSelectAlignmentValues( - leftAlignment: buttonTooltips[ToolbarButtons.leftAlignment] ?? context.loc.alignLeft, - centerAlignment: buttonTooltips[ToolbarButtons.centerAlignment] ?? context.loc.alignCenter, - rightAlignment: buttonTooltips[ToolbarButtons.rightAlignment] ?? context.loc.alignRight, - justifyAlignment: - buttonTooltips[ToolbarButtons.justifyAlignment] ?? context.loc.justifyWinWidth, + if (embedButtons != null) + for (final EmbedButtonBuilder builder in embedButtons) + builder(controller, toolbarIconSize, iconTheme, dialogTheme), + if (showDividers && + isButtonGroupShown[0] && + (isButtonGroupShown[1] || + isButtonGroupShown[2] || + isButtonGroupShown[3] || + isButtonGroupShown[4] || + isButtonGroupShown[5])) + QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), + if (showAlignmentButtons) + QuillToolbarSelectAlignmentButtons( + controller: controller, + options: QuillToolbarSelectAlignmentButtonOptions( + tooltips: QuillSelectAlignmentValues( + leftAlignment: buttonTooltips[ToolbarButtons.leftAlignment] ?? context.loc.alignLeft, + centerAlignment: buttonTooltips[ToolbarButtons.centerAlignment] ?? context.loc.alignCenter, + rightAlignment: buttonTooltips[ToolbarButtons.rightAlignment] ?? context.loc.alignRight, + justifyAlignment: + buttonTooltips[ToolbarButtons.justifyAlignment] ?? context.loc.justifyWinWidth, + ), + iconSize: toolbarIconSize, + iconTheme: iconTheme, + showLeftAlignment: showLeftAlignment, + showCenterAlignment: showCenterAlignment, + showRightAlignment: showRightAlignment, + showJustifyAlignment: showJustifyAlignment, + afterButtonPressed: afterButtonPressed, ), - iconSize: toolbarIconSize, - iconTheme: iconTheme, - showLeftAlignment: showLeftAlignment, - showCenterAlignment: showCenterAlignment, - showRightAlignment: showRightAlignment, - showJustifyAlignment: showJustifyAlignment, - afterButtonPressed: afterButtonPressed, ), - ), - if (showDirection) - QuillToolbarToggleStyleButton( - attribute: Attribute.rtl, - controller: controller, - options: QuillToolbarToggleStyleButtonOptions( - iconData: Icons.format_textdirection_r_to_l, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.direction], + if (showDirection) + QuillToolbarToggleStyleButton( + attribute: Attribute.rtl, + controller: controller, + options: QuillToolbarToggleStyleButtonOptions( + iconData: Icons.format_textdirection_r_to_l, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.direction], + ), ), - ), - if (showDividers && - isButtonGroupShown[1] && - (isButtonGroupShown[2] || - isButtonGroupShown[3] || - isButtonGroupShown[4] || - isButtonGroupShown[5])) - QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), - if (showDividers && - showHeaderStyle && - isButtonGroupShown[2] && - (isButtonGroupShown[3] || isButtonGroupShown[4] || isButtonGroupShown[5])) - QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), - if (showListNumbers) - QuillToolbarToggleStyleButton( - attribute: Attribute.ol, - controller: controller, - options: QuillToolbarToggleStyleButtonOptions( - iconData: Icons.format_list_numbered, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.listNumbers], + if (showDividers && + isButtonGroupShown[1] && + (isButtonGroupShown[2] || + isButtonGroupShown[3] || + isButtonGroupShown[4] || + isButtonGroupShown[5])) + QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), + if (showDividers && + showHeaderStyle && + isButtonGroupShown[2] && + (isButtonGroupShown[3] || isButtonGroupShown[4] || isButtonGroupShown[5])) + QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), + if (showListNumbers) + QuillToolbarToggleStyleButton( + attribute: Attribute.ol, + controller: controller, + options: QuillToolbarToggleStyleButtonOptions( + iconData: Icons.format_list_numbered, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.listNumbers], + ), ), - ), - if (showListBullets) - QuillToolbarToggleStyleButton( - attribute: Attribute.ul, - controller: controller, - options: QuillToolbarToggleStyleButtonOptions( - iconData: Icons.format_list_bulleted, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.listBullets], + if (showListBullets) + QuillToolbarToggleStyleButton( + attribute: Attribute.ul, + controller: controller, + options: QuillToolbarToggleStyleButtonOptions( + iconData: Icons.format_list_bulleted, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.listBullets], + ), ), - ), - if (showListCheck) - QuillToolbarToggleCheckListButton( - controller: controller, - options: QuillToolbarToggleCheckListButtonOptions( - iconData: Icons.check_box, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.listChecks], + if (showListCheck) + QuillToolbarToggleCheckListButton( + controller: controller, + options: QuillToolbarToggleCheckListButtonOptions( + iconData: Icons.check_box, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.listChecks], + ), ), - ), - if (showCodeBlock) - QuillToolbarToggleStyleButton( - attribute: Attribute.codeBlock, - controller: controller, - options: QuillToolbarToggleStyleButtonOptions( - iconData: Icons.code, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.codeBlock], + if (showCodeBlock) + QuillToolbarToggleStyleButton( + attribute: Attribute.codeBlock, + controller: controller, + options: QuillToolbarToggleStyleButtonOptions( + iconData: Icons.code, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.codeBlock], + ), ), - ), - if (showDividers && isButtonGroupShown[3] && (isButtonGroupShown[4] || isButtonGroupShown[5])) - QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), - if (showQuote) - QuillToolbarToggleStyleButton( - attribute: Attribute.blockQuote, - controller: controller, - options: QuillToolbarToggleStyleButtonOptions( - iconData: Icons.format_quote, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.quote], + if (showDividers && isButtonGroupShown[3] && (isButtonGroupShown[4] || isButtonGroupShown[5])) + QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), + if (showQuote) + QuillToolbarToggleStyleButton( + attribute: Attribute.blockQuote, + controller: controller, + options: QuillToolbarToggleStyleButtonOptions( + iconData: Icons.format_quote, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.quote], + ), ), - ), - if (showIndent) - QuillToolbarIndentButton( - controller: controller, - isIncrease: true, - options: QuillToolbarIndentButtonOptions( - iconData: Icons.format_indent_increase, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.indentIncrease], + if (showIndent) + QuillToolbarIndentButton( + controller: controller, + isIncrease: true, + options: QuillToolbarIndentButtonOptions( + iconData: Icons.format_indent_increase, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.indentIncrease], + ), ), - ), - if (showIndent) - QuillToolbarIndentButton( - controller: controller, - isIncrease: false, - options: QuillToolbarIndentButtonOptions( - iconData: Icons.format_indent_decrease, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.indentDecrease], + if (showIndent) + QuillToolbarIndentButton( + controller: controller, + isIncrease: false, + options: QuillToolbarIndentButtonOptions( + iconData: Icons.format_indent_decrease, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.indentDecrease], + ), ), - ), - if (showDividers && isButtonGroupShown[4] && isButtonGroupShown[5]) - QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), - if (showLink) - QuillToolbarLinkStyleButton( - controller: controller, - options: QuillToolbarLinkStyleButtonOptions( - iconSize: toolbarIconSize, - iconTheme: iconTheme, - dialogTheme: dialogTheme, - afterButtonPressed: afterButtonPressed, - linkRegExp: linkRegExp, - linkDialogAction: linkDialogAction, - tooltip: buttonTooltips[ToolbarButtons.link], + if (showDividers && isButtonGroupShown[4] && isButtonGroupShown[5]) + QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), + if (showLink) + QuillToolbarLinkStyleButton( + controller: controller, + options: QuillToolbarLinkStyleButtonOptions( + iconSize: toolbarIconSize, + iconTheme: iconTheme, + dialogTheme: dialogTheme, + afterButtonPressed: afterButtonPressed, + linkRegExp: linkRegExp ?? + RegExp( + r'(http|ftp|https)://[\w-]+(\.[\w-]+)+([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?', + ), + linkDialogAction: linkDialogAction, + tooltip: buttonTooltips[ToolbarButtons.link], + ), ), - ), - if (showSearchButton) - QuillToolbarSearchButton( - controller: controller, - options: QuillToolbarSearchButtonOptions( - iconData: Icons.search, - iconSize: toolbarIconSize, - iconTheme: iconTheme, - dialogTheme: dialogTheme, - afterButtonPressed: afterButtonPressed, - tooltip: buttonTooltips[ToolbarButtons.search], + if (showSearchButton) + QuillToolbarSearchButton( + controller: controller, + options: QuillToolbarSearchButtonOptions( + iconData: Icons.search, + iconSize: toolbarIconSize, + iconTheme: iconTheme, + dialogTheme: dialogTheme, + afterButtonPressed: afterButtonPressed, + tooltip: buttonTooltips[ToolbarButtons.search], + ), ), - ), - if (customButtons.isNotEmpty) - if (showDividers) QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), - for (final customButton in customButtons) - QuillToolbarCustomButton( - options: customButton.options, - controller: controller, - ), - for (final customButton in configurations.customButtons) - QuillToolbarCustomButton( - options: customButton, - controller: controller, - ), - ], + if (customButtons.isNotEmpty) + if (showDividers) + QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), + for (final customButton in customButtons) + QuillToolbarCustomButton( + options: customButton.options, + controller: controller, + ), + for (final customButton in configurations.customButtons) + QuillToolbarCustomButton( + options: customButton, + controller: controller, + ), + ], + ), ), - ), - ); - }, + ); + }, + ), ), ); }