Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellet committed Dec 6, 2023
1 parent 1705bff commit ec2d28c
Show file tree
Hide file tree
Showing 20 changed files with 189 additions and 213 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to this project will be documented in this file.

## 9.0.0-dev-6
* Move the `child` from `QuillToolbarConfigurations` into `QuillToolbar` directly

## 9.0.0-dev-5
* The `QuillToolbar` is now accepting only `child` with no configurations so you can customize everything you wants, the `QuillToolbar.simple()` or `QuillSimpleToolbar` implements a simple toolbar that is based on `QuillToolbar`, you are free to use it but it just an example and not standard
* Flutter Quill Extensions:
Expand Down
8 changes: 7 additions & 1 deletion example/lib/presentation/quill/quill_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ class MyQuillEditor extends StatelessWidget {
scrollController: scrollController,
focusNode: focusNode,
configurations: configurations.copyWith(
extraConfigurations: {
QuillEditorExtensionsConfigurations.key:
const QuillEditorExtensionsConfigurations(
assetsPrefix: 'dsadsasda', // Defaults to assets
),
},
customStyles: const DefaultStyles(
h1: DefaultTextBlockStyle(
TextStyle(
Expand Down Expand Up @@ -99,7 +105,7 @@ class MyQuillEditor extends StatelessWidget {
return getImageProviderByImageSource(
imageUrl,
imageProviderBuilder: null,
assetsPrefix: QuillSharedExtensionsConfigurations.get(
assetsPrefix: QuillEditorExtensionsConfigurations.get(
context: context)
.assetsPrefix,
);
Expand Down
11 changes: 3 additions & 8 deletions example/lib/presentation/quill/quill_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'dart:convert' show jsonEncode;
import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill_extensions/flutter_quill_extensions.dart'
show FlutterQuillEmbeds, QuillSharedExtensionsConfigurations;
show FlutterQuillEmbeds;

import 'package:quill_html_converter/quill_html_converter.dart';
import 'package:share_plus/share_plus.dart' show Share;
Expand Down Expand Up @@ -133,12 +133,7 @@ class _QuillScreenState extends State<QuillScreen> {

QuillSharedConfigurations get _sharedConfigurations {
return const QuillSharedConfigurations(
extraConfigurations: {
QuillSharedExtensionsConfigurations.key:
QuillSharedExtensionsConfigurations(
assetsPrefix: 'your-assets-folder-name', // Defaults to assets
),
},
);
// locale: Locale('en'),
);
}
}
188 changes: 94 additions & 94 deletions example/lib/presentation/quill/quill_toolbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,106 +100,106 @@ class MyQuillToolbar extends StatelessWidget {
// For more info
// https://github.com/singerdmx/flutter-quill/blob/master/doc/custom_toolbar.md
return QuillToolbar(
configurations: QuillToolbarConfigurations(
buttonOptions: const QuillToolbarButtonOptions(
configurations: const QuillToolbarConfigurations(
buttonOptions: QuillToolbarButtonOptions(
base: QuillToolbarBaseButtonOptions(
globalIconSize: 20,
globalIconButtonFactor: 1.4,
),
),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
IconButton(
onPressed: () => context
.read<SettingsCubit>()
.updateSettings(
state.copyWith(useCustomQuillToolbar: false)),
icon: const Icon(
Icons.width_normal,
),
),
QuillToolbarHistoryButton(
isUndo: true,
controller: controller,
),
QuillToolbarHistoryButton(
isUndo: false,
controller: controller,
),
QuillToolbarToggleStyleButton(
options: const QuillToolbarToggleStyleButtonOptions(),
controller: controller,
attribute: Attribute.bold,
),
QuillToolbarToggleStyleButton(
options: const QuillToolbarToggleStyleButtonOptions(),
controller: controller,
attribute: Attribute.italic,
),
QuillToolbarToggleStyleButton(
controller: controller,
attribute: Attribute.underline,
),
QuillToolbarClearFormatButton(
controller: controller,
),
const VerticalDivider(),
QuillToolbarImageButton(
controller: controller,
),
QuillToolbarCameraButton(
controller: controller,
),
QuillToolbarVideoButton(
controller: controller,
),
const VerticalDivider(),
QuillToolbarColorButton(
controller: controller,
isBackground: false,
),
QuillToolbarColorButton(
controller: controller,
isBackground: true,
),
const VerticalDivider(),
QuillToolbarSelectHeaderStyleButton(
controller: controller,
),
const VerticalDivider(),
QuillToolbarToggleCheckListButton(
controller: controller,
),
QuillToolbarToggleStyleButton(
controller: controller,
attribute: Attribute.ol,
),
QuillToolbarToggleStyleButton(
controller: controller,
attribute: Attribute.ul,
),
QuillToolbarToggleStyleButton(
controller: controller,
attribute: Attribute.inlineCode,
),
QuillToolbarToggleStyleButton(
controller: controller,
attribute: Attribute.blockQuote,
),
QuillToolbarIndentButton(
controller: controller,
isIncrease: true,
),
QuillToolbarIndentButton(
controller: controller,
isIncrease: false,
),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
IconButton(
onPressed: () => context
.read<SettingsCubit>()
.updateSettings(
state.copyWith(useCustomQuillToolbar: false)),
icon: const Icon(
Icons.width_normal,
),
const VerticalDivider(),
QuillToolbarLinkStyleButton(controller: controller),
],
),
),
QuillToolbarHistoryButton(
isUndo: true,
controller: controller,
),
QuillToolbarHistoryButton(
isUndo: false,
controller: controller,
),
QuillToolbarToggleStyleButton(
options: const QuillToolbarToggleStyleButtonOptions(),
controller: controller,
attribute: Attribute.bold,
),
QuillToolbarToggleStyleButton(
options: const QuillToolbarToggleStyleButtonOptions(),
controller: controller,
attribute: Attribute.italic,
),
QuillToolbarToggleStyleButton(
controller: controller,
attribute: Attribute.underline,
),
QuillToolbarClearFormatButton(
controller: controller,
),
const VerticalDivider(),
QuillToolbarImageButton(
controller: controller,
),
QuillToolbarCameraButton(
controller: controller,
),
QuillToolbarVideoButton(
controller: controller,
),
const VerticalDivider(),
QuillToolbarColorButton(
controller: controller,
isBackground: false,
),
QuillToolbarColorButton(
controller: controller,
isBackground: true,
),
const VerticalDivider(),
QuillToolbarSelectHeaderStyleButton(
controller: controller,
),
const VerticalDivider(),
QuillToolbarToggleCheckListButton(
controller: controller,
),
QuillToolbarToggleStyleButton(
controller: controller,
attribute: Attribute.ol,
),
QuillToolbarToggleStyleButton(
controller: controller,
attribute: Attribute.ul,
),
QuillToolbarToggleStyleButton(
controller: controller,
attribute: Attribute.inlineCode,
),
QuillToolbarToggleStyleButton(
controller: controller,
attribute: Attribute.blockQuote,
),
QuillToolbarIndentButton(
controller: controller,
isIncrease: true,
),
QuillToolbarIndentButton(
controller: controller,
isIncrease: false,
),
const VerticalDivider(),
QuillToolbarLinkStyleButton(controller: controller),
],
),
),
);
Expand Down
3 changes: 2 additions & 1 deletion example/lib/presentation/simple/simple_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class _SimpleScreenState extends State<SimpleScreen> {
body: Column(
children: [
QuillToolbar.simple(
QuillSimpleToolbarConfigurations(controller: _controller),
configurations:
QuillSimpleToolbarConfigurations(controller: _controller),
),
Expanded(
child: QuillEditor.basic(
Expand Down
22 changes: 10 additions & 12 deletions flutter_quill_extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,17 @@ This works for all platforms except Web
If you want to use image assets in the Quill Editor, you need to make sure your assets folder is `assets` otherwise:

```dart
QuillProvider(
configurations: const QuillConfigurations(
sharedConfigurations: QuillSharedConfigurations(
extraConfigurations: {
QuillSharedExtensionsConfigurations.key:
QuillSharedExtensionsConfigurations(
assetsPrefix: 'your-assets-folder-name', // Defaults to assets
),
},
),
QuillEditor.basic(
configurations: const QuillEditorConfigurations(
// ...
extraConfigurations: {
QuillEditorExtensionsConfigurations.key:
QuillEditorExtensionsConfigurations(
assetsPrefix: 'your-assets-folder-name', // Defaults to assets
),
child: ...,
)
},
),
)
```

This info is needed by the package to check if it asset image to use the `AssetImage` provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ class QuillEditorImageEmbedBuilder extends EmbedBuilder {
alignment: alignment,
height: height,
width: width,
assetsPrefix: QuillSharedExtensionsConfigurations.get(context: context)
assetsPrefix: QuillEditorExtensionsConfigurations.get(context: context)
.assetsPrefix,
);

final imageSaverService =
QuillSharedExtensionsConfigurations.get(context: context)
QuillEditorExtensionsConfigurations.get(context: context)
.imageSaverService;
return GestureDetector(
onTap: configurations.onImageClicked ??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class ImageOptionsMenu extends StatelessWidget {
MaterialPageRoute(
builder: (_) => ImageTapWrapper(
assetsPrefix:
QuillSharedExtensionsConfigurations.get(context: context)
QuillEditorExtensionsConfigurations.get(context: context)
.assetsPrefix,
imageUrl: imageSource,
configurations: configurations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class QuillToolbarImageButton extends StatelessWidget {

Future<void> _onPressedHandler(BuildContext context) async {
final imagePickerService =
QuillSharedExtensionsConfigurations.get(context: context)
QuillEditorExtensionsConfigurations.get(context: context)
.imagePickerService;

final onRequestPickImage =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class QuillToolbarCameraButton extends StatelessWidget {
QuillController controller,
) async {
final imagePickerService =
QuillSharedExtensionsConfigurations.get(context: context)
QuillEditorExtensionsConfigurations.get(context: context)
.imagePickerService;

final cameraAction = await _getCameraAction(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class QuillToolbarVideoButton extends StatelessWidget {

Future<void> _onPressedHandler(BuildContext context) async {
final imagePickerService =
QuillSharedExtensionsConfigurations.get(context: context)
QuillEditorExtensionsConfigurations.get(context: context)
.imagePickerService;

final onRequestPickVideo = options.videoConfigurations.onRequestPickVideo;
Expand Down
Loading

0 comments on commit ec2d28c

Please sign in to comment.