diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d9c2f1a..0cba5b33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - You can use now the `QuillRawEditor` without `QuillEditorProvider` - Bug fixes - Add implementation of image cropping in the `example` +- Update the `QuillToolbarIconButton` to use the material 3 buttons ## [8.4.1] - Add `copyWith` in `OptionalSize` class diff --git a/example/lib/pages/home_page.dart b/example/lib/pages/home_page.dart index f7b84513..5880cf2e 100644 --- a/example/lib/pages/home_page.dart +++ b/example/lib/pages/home_page.dart @@ -470,11 +470,12 @@ class _HomePageState extends State { ], uiSettings: [ AndroidUiSettings( - toolbarTitle: 'Cropper', - toolbarColor: Colors.deepOrange, - toolbarWidgetColor: Colors.white, - initAspectRatio: CropAspectRatioPreset.original, - lockAspectRatio: false), + toolbarTitle: 'Cropper', + toolbarColor: Colors.deepOrange, + toolbarWidgetColor: Colors.white, + initAspectRatio: CropAspectRatioPreset.original, + lockAspectRatio: false, + ), IOSUiSettings( title: 'Cropper', ), @@ -517,6 +518,7 @@ class _HomePageState extends State { configurations: QuillToolbarConfigurations( customButtons: customButtons, embedButtons: FlutterQuillEmbeds.toolbarButtons( + cameraButtonOptions: const QuillToolbarCameraButtonOptions(), imageButtonOptions: QuillToolbarImageButtonOptions( imageButtonConfigurations: QuillToolbarImageConfigurations( onImageInsertedCallback: (image) async { @@ -539,6 +541,7 @@ class _HomePageState extends State { configurations: QuillToolbarConfigurations( customButtons: customButtons, embedButtons: FlutterQuillEmbeds.toolbarButtons( + cameraButtonOptions: const QuillToolbarCameraButtonOptions(), imageButtonOptions: QuillToolbarImageButtonOptions( imageButtonConfigurations: QuillToolbarImageConfigurations( onImageInsertedCallback: (image) async { @@ -560,6 +563,7 @@ class _HomePageState extends State { configurations: QuillToolbarConfigurations( customButtons: customButtons, embedButtons: FlutterQuillEmbeds.toolbarButtons( + cameraButtonOptions: const QuillToolbarCameraButtonOptions(), videoButtonOptions: QuillToolbarVideoButtonOptions( videoConfigurations: QuillToolbarVideoConfigurations( onVideoInsertedCallback: (video) => diff --git a/flutter_quill_extensions/lib/presentation/embeds/toolbar/camera_button/camera_button.dart b/flutter_quill_extensions/lib/presentation/embeds/toolbar/camera_button/camera_button.dart index be7d7a14..f31171a6 100644 --- a/flutter_quill_extensions/lib/presentation/embeds/toolbar/camera_button/camera_button.dart +++ b/flutter_quill_extensions/lib/presentation/embeds/toolbar/camera_button/camera_button.dart @@ -1,5 +1,3 @@ -// ignore_for_file: use_build_context_synchronously - import 'package:flutter/material.dart'; import 'package:flutter_quill/flutter_quill.dart'; import 'package:flutter_quill/translations.dart'; @@ -104,6 +102,7 @@ class QuillToolbarCameraButton extends StatelessWidget { size: iconSize * 1.77, fillColor: iconFillColor, borderRadius: iconTheme?.borderRadius ?? 2, + // isDesktop(supportWeb: false) ? null : onPressed: () => _sharedOnPressed(context), ); } @@ -126,11 +125,9 @@ class QuillToolbarCameraButton extends StatelessWidget { BuildContext context, QuillController controller, ) async { - // if (onVideoPickCallback == null && onImagePickCallback == null) { - // throw ArgumentError( - // 'onImagePickCallback and onVideoPickCallback are both null', - // ); - // } + final imagePickerService = + QuillSharedExtensionsConfigurations.get(context: context) + .imagePickerService; final cameraAction = await _getCameraAction(context); @@ -138,10 +135,6 @@ class QuillToolbarCameraButton extends StatelessWidget { return; } - final imagePickerService = - QuillSharedExtensionsConfigurations.get(context: context) - .imagePickerService; - switch (cameraAction) { case CameraAction.video: final videoFile = await imagePickerService.pickVideo( diff --git a/lib/src/widgets/toolbar/buttons/quill_icon.dart b/lib/src/widgets/toolbar/buttons/quill_icon.dart index 37e5b81a..8c2b9637 100644 --- a/lib/src/widgets/toolbar/buttons/quill_icon.dart +++ b/lib/src/widgets/toolbar/buttons/quill_icon.dart @@ -28,6 +28,14 @@ class QuillToolbarIconButton extends StatelessWidget { @override Widget build(BuildContext context) { + // return IconButton( + // onPressed: () { + // onPressed?.call(); + // afterPressed?.call(); + // }, + // icon: icon ?? const SizedBox.shrink(), + // tooltip: tooltip, + // ); return ConstrainedBox( constraints: BoxConstraints.tightFor(width: size, height: size), child: UtilityWidgets.maybeTooltip( diff --git a/lib/src/widgets/toolbar/buttons/select_header_style.dart b/lib/src/widgets/toolbar/buttons/select_header_style.dart index 865a619d..b8179cf8 100644 --- a/lib/src/widgets/toolbar/buttons/select_header_style.dart +++ b/lib/src/widgets/toolbar/buttons/select_header_style.dart @@ -145,6 +145,8 @@ class QuillToolbarSelectHeaderStyleButtonsState } final theme = Theme.of(context); final isSelected = _selectedAttribute == attribute; + // TODO: This needs to be updated to materail 3 as well just like in + // quill_icon.dart return Padding( padding: const EdgeInsets.symmetric(horizontal: !kIsWeb ? 1.0 : 5.0), child: ConstrainedBox(