Update camera_button.dart

pull/1520/head
Ellet 1 year ago
parent 5abe224e58
commit 616dbff748
No known key found for this signature in database
GPG Key ID: C488CC70BBCEF0D1
  1. 1
      CHANGELOG.md
  2. 6
      example/lib/pages/home_page.dart
  3. 15
      flutter_quill_extensions/lib/presentation/embeds/toolbar/camera_button/camera_button.dart
  4. 8
      lib/src/widgets/toolbar/buttons/quill_icon.dart
  5. 2
      lib/src/widgets/toolbar/buttons/select_header_style.dart

@ -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

@ -474,7 +474,8 @@ class _HomePageState extends State<HomePage> {
toolbarColor: Colors.deepOrange,
toolbarWidgetColor: Colors.white,
initAspectRatio: CropAspectRatioPreset.original,
lockAspectRatio: false),
lockAspectRatio: false,
),
IOSUiSettings(
title: 'Cropper',
),
@ -517,6 +518,7 @@ class _HomePageState extends State<HomePage> {
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<HomePage> {
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<HomePage> {
configurations: QuillToolbarConfigurations(
customButtons: customButtons,
embedButtons: FlutterQuillEmbeds.toolbarButtons(
cameraButtonOptions: const QuillToolbarCameraButtonOptions(),
videoButtonOptions: QuillToolbarVideoButtonOptions(
videoConfigurations: QuillToolbarVideoConfigurations(
onVideoInsertedCallback: (video) =>

@ -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(

@ -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(

@ -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(

Loading…
Cancel
Save