Fixes for step 2 update (#1449)

* Improve main workflow

* Fixes

* Bug fixes

* Edit toolbar configurations

* Fix conflicts

* Bug fixes
pull/1454/head
Ahmed Hnewa 1 year ago committed by GitHub
parent 7033d80584
commit 55f5101ccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/PULL_REQUEST_TEMPLATE.md
  2. 27
      .github/workflows/main.yml
  3. 4
      CHANGELOG.md
  4. 4
      before-push.sh
  5. 3
      example/ios/Runner.xcodeproj/project.pbxproj
  6. 2
      example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
  7. 2
      flutter_quill_extensions/lib/embeds/builders.dart
  8. 2
      flutter_quill_extensions/lib/embeds/toolbar/camera_button.dart
  9. 2
      flutter_quill_extensions/lib/embeds/toolbar/image_video_utils.dart
  10. 2
      flutter_quill_extensions/lib/embeds/toolbar/media_button.dart
  11. 4
      lib/flutter_quill.dart
  12. 9
      lib/src/models/config/editor/configurations.dart
  13. 10
      lib/src/models/config/quill_configurations.dart
  14. 9
      lib/src/models/config/shared_configurations.dart
  15. 14
      lib/src/models/config/toolbar/buttons/base.dart
  16. 2
      lib/src/models/config/toolbar/buttons/font_family.dart
  17. 68
      lib/src/models/config/toolbar/buttons/font_size.dart
  18. 48
      lib/src/models/config/toolbar/configurations.dart
  19. 2
      lib/src/test/widget_tester_extension.dart
  20. 4
      lib/src/utils/extensions/build_context.dart
  21. 2
      lib/src/widgets/delegate.dart
  22. 22
      lib/src/widgets/editor/editor.dart
  23. 2
      lib/src/widgets/raw_editor/raw_editor.dart
  24. 2
      lib/src/widgets/raw_editor/raw_editor_state_selection_delegate_mixin.dart
  25. 2
      lib/src/widgets/raw_editor/raw_editor_state_text_input_client_mixin.dart
  26. 2
      lib/src/widgets/text_block.dart
  27. 2
      lib/src/widgets/text_selection.dart
  28. 2
      lib/src/widgets/toolbar/buttons/clear_format.dart
  29. 2
      lib/src/widgets/toolbar/buttons/color.dart
  30. 2
      lib/src/widgets/toolbar/buttons/custom_button.dart
  31. 27
      lib/src/widgets/toolbar/buttons/font_family.dart
  32. 2
      lib/src/widgets/toolbar/buttons/history.dart
  33. 2
      lib/src/widgets/toolbar/buttons/indent.dart
  34. 2
      lib/src/widgets/toolbar/buttons/link_style.dart
  35. 2
      lib/src/widgets/toolbar/buttons/link_style2.dart
  36. 73
      lib/src/widgets/toolbar/buttons/quill_font_size.dart
  37. 2
      lib/src/widgets/toolbar/buttons/search.dart
  38. 2
      lib/src/widgets/toolbar/buttons/select_alignment.dart
  39. 2
      lib/src/widgets/toolbar/buttons/select_header_style.dart
  40. 2
      lib/src/widgets/toolbar/buttons/toggle_check_list.dart
  41. 2
      lib/src/widgets/toolbar/buttons/toggle_style.dart
  42. 86
      lib/src/widgets/toolbar/toolbar.dart
  43. 4
      lib/src/widgets/utils/provider.dart
  44. 3
      pubspec.yaml

@ -43,4 +43,4 @@ Closes #IssueNumber
- [ ] I have run `dart format .`` on the project <!-- REQUIRED -->
- [ ] I have run `dart fix --apply` on the project <!-- REQUIRED -->
- [ ] I have run `flutter test` and `flutter analyze` and it passed successfully <!-- REQUIRED -->
- [ ] I have run `./before-push.sh` and everything is fine <!-- Optional >
- [ ] I have run `./before-push.sh` and everything is fine <!-- Optional -->

@ -15,9 +15,24 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- run: flutter --version
- run: flutter pub get
- run: flutter pub get -C flutter_quill_extensions
- run: flutter analyze
- run: flutter test
- run: flutter pub publish --dry-run
- name: Check flutter version
run: flutter --version
- name: Install dependencies
run: flutter pub get
- name: Install flutter_quill_extensions dependencies
run: flutter pub get -C flutter_quill_extensions
- name: Run flutter analysis
run: flutter analyze
- name: Check dart code formatting
run: dart format --set-exit-if-changed .
- name: Check if package is ready for publishing
run: flutter pub publish --dry-run
- name: Run flutter tests
run: flutter test

@ -1,3 +1,7 @@
## [7.6.1]
- Bug fixes
## [7.6.0]
- **Breaking change**: To customize the buttons in the toolbar, you can do that in the `QuillProvider`

@ -20,4 +20,8 @@ dart fix --apply
echo "Running 'dart format .'"
dart format .
# Check dart code formatting
echo "Running `dart format --set-exit-if-changed .`"
dart format --set-exit-if-changed .
echo "Script completed."

@ -167,7 +167,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
@ -215,6 +215,7 @@
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_quill/extensions.dart' as base;
import 'package:flutter_quill/flutter_quill.dart' hide Text;
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill/translations.dart';
import 'package:math_keyboard/math_keyboard.dart';
import 'package:universal_html/html.dart' as html;

@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart' hide Text;
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill/translations.dart';
import 'package:image_picker/image_picker.dart';

@ -3,7 +3,7 @@ import 'dart:io' show File;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_quill/extensions.dart';
import 'package:flutter_quill/flutter_quill.dart' hide Text;
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill/translations.dart';
import 'package:image_picker/image_picker.dart';

@ -4,7 +4,7 @@ import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_quill/extensions.dart';
import 'package:flutter_quill/flutter_quill.dart' hide Text;
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill/translations.dart';
import 'package:image_picker/image_picker.dart';

@ -22,10 +22,10 @@ export 'src/models/themes/quill_icon_theme.dart';
export 'src/utils/embeds.dart';
export 'src/widgets/controller.dart';
export 'src/widgets/default_styles.dart';
export 'src/widgets/editor.dart';
export 'src/widgets/editor/editor.dart';
export 'src/widgets/embeds.dart';
export 'src/widgets/link.dart' show LinkActionPickerDelegate, LinkMenuAction;
export 'src/widgets/style_widgets/style_widgets.dart';
export 'src/widgets/toolbar.dart';
export 'src/widgets/toolbar/enum.dart';
export 'src/widgets/toolbar/toolbar.dart';
export 'src/widgets/utils/provider.dart';

@ -1,8 +1,9 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart' show immutable;
/// The configurations for the quill editor widget of flutter quill
@immutable
class QuillEditorConfigurations {
class QuillEditorConfigurations extends Equatable {
const QuillEditorConfigurations({
this.placeholder,
this.readOnly = false,
@ -18,4 +19,10 @@ class QuillEditorConfigurations {
///
/// Defaults to `false`. Must not be `null`.
final bool readOnly;
@override
List<Object?> get props => [
placeholder,
readOnly,
];
}

@ -1,3 +1,4 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart' show immutable;
import '../../../flutter_quill.dart';
@ -7,7 +8,7 @@ export './shared_configurations.dart';
export './toolbar/configurations.dart';
@immutable
class QuillConfigurations {
class QuillConfigurations extends Equatable {
const QuillConfigurations({
required this.controller,
this.editorConfigurations = const QuillEditorConfigurations(),
@ -32,4 +33,11 @@ class QuillConfigurations {
/// The shared configurations between [QuillEditorConfigurations] and
/// [QuillToolbarConfigurations] so we don't duplicate things
final QuillSharedConfigurations sharedConfigurations;
@override
List<Object?> get props => [
editorConfigurations,
toolbarConfigurations,
sharedConfigurations,
];
}

@ -1,10 +1,11 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart' show Color, Colors, Locale;
import './editor/configurations.dart' show QuillEditorConfigurations;
import './toolbar/configurations.dart' show QuillToolbarConfigurations;
/// The shared configurations between [QuillEditorConfigurations] and
/// [QuillToolbarConfigurations] so we don't duplicate things
class QuillSharedConfigurations {
class QuillSharedConfigurations extends Equatable {
const QuillSharedConfigurations({
this.dialogBarrierColor = Colors.black54,
this.locale,
@ -18,4 +19,10 @@ class QuillSharedConfigurations {
/// The locale to use for the editor and toolbar, defaults to system locale
/// More https://github.com/singerdmx/flutter-quill#translation
final Locale? locale;
@override
List<Object?> get props => [
dialogBarrierColor,
locale,
];
}

@ -1,3 +1,4 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart' show VoidCallback, immutable;
import 'package:flutter/widgets.dart' show IconData, Widget;
@ -9,7 +10,7 @@ import '../../quill_configurations.dart' show kDefaultIconSize;
/// it's used in [childBuilder] so the developer can custmize this when using it
/// The [I] is extra options for the button, usually for it's state
@immutable
class QuillToolbarBaseButtonOptions<T, I> {
class QuillToolbarBaseButtonOptions<T, I> extends Equatable {
const QuillToolbarBaseButtonOptions({
this.iconData,
this.globalIconSize = kDefaultIconSize,
@ -45,4 +46,15 @@ class QuillToolbarBaseButtonOptions<T, I> {
/// By default it will be from the one in [QuillProvider]
/// To override it you must pass not null controller
final QuillController? controller;
@override
List<Object?> get props => [
iconData,
globalIconSize,
afterButtonPressed,
tooltip,
iconTheme,
childBuilder,
controller,
];
}

@ -25,7 +25,7 @@ class QuillToolbarFontFamilyButtonOptions extends QuillToolbarBaseButtonOptions<
QuillToolbarFontFamilyButtonOptions,
QuillToolbarFontFamilyButtonExtraOptions> {
const QuillToolbarFontFamilyButtonOptions({
required this.attribute,
this.attribute = Attribute.font,
this.rawItemsMap,
super.controller,
super.iconData,

@ -0,0 +1,68 @@
import 'package:flutter/foundation.dart' show immutable;
import 'package:flutter/material.dart'
show Colors, PopupMenuEntry, ValueChanged;
import 'package:flutter/widgets.dart'
show
Color,
EdgeInsetsGeometry,
TextStyle,
VoidCallback,
TextOverflow,
EdgeInsets;
import '../../../../widgets/controller.dart';
import '../../../documents/attribute.dart';
import '../../../themes/quill_icon_theme.dart';
import '../../quill_configurations.dart';
@immutable
class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions {
const QuillToolbarFontSizeButtonOptions({
this.iconSize,
this.fillColor,
this.hoverElevation = 1,
this.highlightElevation = 1,
this.items,
this.rawItemsMap,
this.onSelected,
this.iconTheme,
this.attribute = Attribute.size,
this.controller,
this.afterButtonPressed,
this.tooltip,
this.padding,
this.style,
this.width,
this.initialValue,
this.labelOverflow = TextOverflow.visible,
this.itemHeight,
this.itemPadding,
this.defaultItemColor = Colors.red,
});
final double? iconSize;
final Color? fillColor;
final double hoverElevation;
final double highlightElevation;
@Deprecated('It is not required because of `rawItemsMap`')
final List<PopupMenuEntry<String>>? items;
final Map<String, String>? rawItemsMap;
final ValueChanged<String>? onSelected;
@override
final QuillIconTheme? iconTheme;
final Attribute attribute;
@override
final QuillController? controller;
@override
final VoidCallback? afterButtonPressed;
@override
final String? tooltip;
final EdgeInsetsGeometry? padding;
final TextStyle? style;
final double? width;
final String? initialValue;
final TextOverflow labelOverflow;
final double? itemHeight;
final EdgeInsets? itemPadding;
final Color? defaultItemColor;
}

@ -1,11 +1,14 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart' show immutable;
import '../../documents/attribute.dart';
import 'buttons/base.dart';
import 'buttons/font_family.dart';
// import 'buttons/font_size.dart';
import 'buttons/history.dart';
export './buttons/base.dart';
export './buttons/font_family.dart';
export './buttons/font_size.dart';
export './buttons/history.dart';
export './buttons/toggle_style.dart';
@ -23,7 +26,7 @@ const double kToolbarSectionSpacing = 4;
/// The configurations for the toolbar widget of flutter quill
@immutable
class QuillToolbarConfigurations {
class QuillToolbarConfigurations extends Equatable {
const QuillToolbarConfigurations({
this.buttonOptions = const QuillToolbarButtonOptions(),
this.multiRowsDisplay = true,
@ -44,7 +47,7 @@ class QuillToolbarConfigurations {
if (alternativeToolbarSize != null) {
return alternativeToolbarSize;
}
return buttonOptions.baseButtonOptions.globalIconSize * 2;
return buttonOptions.base.globalIconSize * 2;
}
/// If you want change spesefic buttons or all of them
@ -67,27 +70,42 @@ class QuillToolbarConfigurations {
/// };
/// ```
final Map<String, String>? fontFamilyValues;
@override
List<Object?> get props => [
buttonOptions,
multiRowsDisplay,
fontFamilyValues,
toolbarSize,
];
}
/// The configurations for the buttons of the toolbar widget of flutter quill
@immutable
class QuillToolbarButtonOptions {
class QuillToolbarButtonOptions extends Equatable {
const QuillToolbarButtonOptions({
this.baseButtonOptions = const QuillToolbarBaseButtonOptions(),
this.undoHistoryButtonOptions = const QuillToolbarHistoryButtonOptions(
this.base = const QuillToolbarBaseButtonOptions(),
this.undoHistory = const QuillToolbarHistoryButtonOptions(
isUndo: true,
),
this.redoHistoryButtonOptions = const QuillToolbarHistoryButtonOptions(
this.redoHistory = const QuillToolbarHistoryButtonOptions(
isUndo: false,
),
this.fontFamilyButtonOptions = const QuillToolbarFontFamilyButtonOptions(
attribute: Attribute.font,
),
this.fontFamily = const QuillToolbarFontFamilyButtonOptions(),
// this.fontSize = const QuillToolbarFontSizeButtonOptions(),
});
/// The base configurations for all the buttons
final QuillToolbarBaseButtonOptions baseButtonOptions;
final QuillToolbarHistoryButtonOptions undoHistoryButtonOptions;
final QuillToolbarHistoryButtonOptions redoHistoryButtonOptions;
final QuillToolbarFontFamilyButtonOptions fontFamilyButtonOptions;
/// The base configurations for all the buttons which will apply to all
/// but if the options overrided in the spesefic button options
/// then it will use that instead
final QuillToolbarBaseButtonOptions base;
final QuillToolbarHistoryButtonOptions undoHistory;
final QuillToolbarHistoryButtonOptions redoHistory;
final QuillToolbarFontFamilyButtonOptions fontFamily;
// final QuillToolbarFontSizeButtonOptions fontSize;
@override
List<Object?> get props => [
base,
];
}

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import '../widgets/editor.dart';
import '../widgets/editor/editor.dart';
import '../widgets/raw_editor/raw_editor.dart';
/// Extends

@ -102,7 +102,7 @@ extension BuildContextExt on BuildContext {
/// get the provider widget first and then we will return base button
/// don't throw exception if [QuillProvider] is not in the widget tree
QuillToolbarBaseButtonOptions? get quillToolbarBaseButtonOptions {
return quillToolbarConfigurations?.buttonOptions.baseButtonOptions;
return quillToolbarConfigurations?.buttonOptions.base;
}
/// return [QuillToolbarBaseButtonOptions] as not null. Since the quill
@ -110,6 +110,6 @@ extension BuildContextExt on BuildContext {
/// get the provider widget first and then we will return base button
/// throw exception if [QuillProvider] is not in the widget tree
QuillToolbarBaseButtonOptions get requireQuillToolbarBaseButtonOptions {
return requireQuillToolbarConfigurations.buttonOptions.baseButtonOptions;
return requireQuillToolbarConfigurations.buttonOptions.base;
}
}

@ -6,7 +6,7 @@ import 'package:flutter/scheduler.dart';
import '../models/documents/attribute.dart';
import '../models/documents/nodes/leaf.dart';
import '../utils/platform.dart';
import 'editor.dart';
import 'editor/editor.dart';
import 'embeds.dart';
import 'text_selection.dart';

@ -11,17 +11,17 @@ import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:i18n_extension/i18n_widget.dart';
import '../../flutter_quill.dart';
import '../models/documents/nodes/container.dart' as container_node;
import '../utils/extensions/build_context.dart';
import '../utils/platform.dart';
import 'box.dart';
import 'cursor.dart';
import 'delegate.dart';
import 'float_cursor.dart';
import 'link.dart';
import 'raw_editor/raw_editor.dart';
import 'text_selection.dart';
import '../../../flutter_quill.dart';
import '../../models/documents/nodes/container.dart' as container_node;
import '../../utils/extensions/build_context.dart';
import '../../utils/platform.dart';
import '../box.dart';
import '../cursor.dart';
import '../delegate.dart';
import '../float_cursor.dart';
import '../link.dart';
import '../raw_editor/raw_editor.dart';
import '../text_selection.dart';
/// Base interface for the editor state which defines contract used by
/// various mixins.

@ -41,7 +41,7 @@ import '../controller.dart';
import '../cursor.dart';
import '../default_styles.dart';
import '../delegate.dart';
import '../editor.dart';
import '../editor/editor.dart';
import '../keyboard_listener.dart';
import '../link.dart';
import '../proxy.dart';

@ -8,7 +8,7 @@ import '../../models/documents/nodes/embeddable.dart';
import '../../models/documents/nodes/leaf.dart';
import '../../models/documents/style.dart';
import '../../utils/delta.dart';
import '../editor.dart';
import '../editor/editor.dart';
mixin RawEditorStateSelectionDelegateMixin on EditorState
implements TextSelectionDelegate {

@ -7,7 +7,7 @@ import 'package:flutter/services.dart';
import '../../models/documents/document.dart';
import '../../utils/delta.dart';
import '../editor.dart';
import '../editor/editor.dart';
mixin RawEditorStateTextInputClientMixin on EditorState
implements TextInputClient {

@ -11,7 +11,7 @@ import 'controller.dart';
import 'cursor.dart';
import 'default_styles.dart';
import 'delegate.dart';
import 'editor.dart';
import 'editor/editor.dart';
import 'link.dart';
import 'style_widgets/bullet_point.dart';
import 'style_widgets/checkbox_point.dart';

@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import '../models/documents/nodes/node.dart';
import 'editor.dart';
import 'editor/editor.dart';
TextSelection localSelection(Node node, TextSelection selection, fromParent) {
final base = fromParent ? node.offset : node.documentOffset;

@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import '../../../models/documents/attribute.dart';
import '../../../models/themes/quill_icon_theme.dart';
import '../../controller.dart';
import '../../toolbar.dart';
import '../toolbar.dart';
class ClearFormatButton extends StatefulWidget {
const ClearFormatButton({

@ -7,7 +7,7 @@ import '../../../models/themes/quill_icon_theme.dart';
import '../../../translations/toolbar.i18n.dart';
import '../../../utils/color.dart';
import '../../controller.dart';
import '../../toolbar.dart';
import '../toolbar.dart';
/// Controls color styles.
///

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import '../../../models/themes/quill_icon_theme.dart';
import '../../toolbar.dart';
import '../toolbar.dart';
class CustomButton extends StatelessWidget {
const CustomButton({

@ -27,8 +27,7 @@ class QuillToolbarFontFamilyButton extends StatefulWidget {
class _QuillToolbarFontFamilyButtonState
extends State<QuillToolbarFontFamilyButton> {
late String _defaultDisplayText;
String _currentValue = '';
var _currentValue = '';
QuillToolbarFontFamilyButtonOptions get options {
return widget.options;
@ -59,7 +58,7 @@ class _QuillToolbarFontFamilyButtonState
}
await Future.delayed(Duration.zero);
setState(() {
_currentValue = _defaultDisplayText = options.initialValue ?? 'Font'.i18n;
_currentValue = _defaultDisplayText;
});
controller.addListener(_didChangeEditingValue);
}
@ -76,14 +75,19 @@ class _QuillToolbarFontFamilyButtonState
super.dispose();
}
String get _defaultDisplayText {
return options.initialValue ?? 'Font'.i18n;
}
@override
void didUpdateWidget(covariant QuillToolbarFontFamilyButton oldWidget) {
super.didUpdateWidget(oldWidget);
if (controller != controller) {
controller
..removeListener(_didChangeEditingValue)
..addListener(_didChangeEditingValue);
if (controller == controller) {
return;
}
controller
..removeListener(_didChangeEditingValue)
..addListener(_didChangeEditingValue);
}
void _didChangeEditingValue() {
@ -222,7 +226,9 @@ class _QuillToolbarFontFamilyButtonState
shape: popupMenuTheme.shape,
color: popupMenuTheme.color,
);
if (!mounted) return;
if (!mounted) {
return;
}
if (newValue == null) {
return;
}
@ -231,7 +237,10 @@ class _QuillToolbarFontFamilyButtonState
_currentValue = keyName ?? _defaultDisplayText;
if (keyName != null) {
controller.formatSelection(
Attribute.fromKeyValue('font', newValue == 'Clear' ? null : newValue),
Attribute.fromKeyValue(
'font',
newValue == 'Clear' ? null : newValue,
),
);
options.onSelected?.call(newValue);
}

@ -5,7 +5,7 @@ import '../../../../translations.dart';
import '../../../utils/extensions/build_context.dart';
import '../../../utils/extensions/quill_controller.dart';
import '../../controller.dart';
import '../../toolbar.dart';
import '../toolbar.dart';
class QuillToolbarHistoryButton extends StatefulWidget {
const QuillToolbarHistoryButton({

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import '../../../models/themes/quill_icon_theme.dart';
import '../../controller.dart';
import '../../toolbar.dart';
import '../toolbar.dart';
class IndentButton extends StatefulWidget {
const IndentButton({

@ -8,7 +8,7 @@ import '../../../models/themes/quill_icon_theme.dart';
import '../../../translations/toolbar.i18n.dart';
import '../../controller.dart';
import '../../link.dart';
import '../../toolbar.dart';
import '../toolbar.dart';
class LinkStyleButton extends StatefulWidget {
const LinkStyleButton({

@ -10,7 +10,7 @@ import '../../../models/themes/quill_dialog_theme.dart';
import '../../../models/themes/quill_icon_theme.dart';
import '../../controller.dart';
import '../../link.dart';
import '../../toolbar.dart';
import '../toolbar.dart';
/// Alternative version of [LinkStyleButton]. This widget has more customization
/// and uses dialog similar to one which is used on [http://quilljs.com].

@ -8,8 +8,8 @@ import '../../../utils/font.dart';
import '../../../utils/widgets.dart';
import '../../controller.dart';
class QuillFontSizeButton extends StatefulWidget {
const QuillFontSizeButton({
class QuillToolbarFontSizeButton extends StatefulWidget {
const QuillToolbarFontSizeButton({
required this.rawItemsMap,
required this.attribute,
required this.controller,
@ -58,10 +58,12 @@ class QuillFontSizeButton extends StatefulWidget {
final Color? defaultItemColor;
@override
_QuillFontSizeButtonState createState() => _QuillFontSizeButtonState();
_QuillToolbarFontSizeButtonState createState() =>
_QuillToolbarFontSizeButtonState();
}
class _QuillFontSizeButtonState extends State<QuillFontSizeButton> {
class _QuillToolbarFontSizeButtonState
extends State<QuillToolbarFontSizeButton> {
late String _defaultDisplayText;
late String _currentValue;
Style get _selectionStyle => widget.controller.getSelectionStyle();
@ -80,7 +82,7 @@ class _QuillFontSizeButtonState extends State<QuillFontSizeButton> {
}
@override
void didUpdateWidget(covariant QuillFontSizeButton oldWidget) {
void didUpdateWidget(covariant QuillToolbarFontSizeButton oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.controller != widget.controller) {
oldWidget.controller.removeListener(_didChangeEditingValue);
@ -119,8 +121,9 @@ class _QuillFontSizeButtonState extends State<QuillFontSizeButton> {
child: RawMaterialButton(
visualDensity: VisualDensity.compact,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(widget.iconTheme?.borderRadius ?? 2)),
borderRadius:
BorderRadius.circular(widget.iconTheme?.borderRadius ?? 2),
),
fillColor: widget.fillColor,
elevation: 0,
hoverElevation: widget.hoverElevation,
@ -135,7 +138,7 @@ class _QuillFontSizeButtonState extends State<QuillFontSizeButton> {
);
}
void _showMenu() {
Future<void> _showMenu() async {
final popupMenuTheme = PopupMenuTheme.of(context);
final button = context.findRenderObject() as RenderBox;
final overlay = Overlay.of(context).context.findRenderObject() as RenderBox;
@ -147,7 +150,7 @@ class _QuillFontSizeButtonState extends State<QuillFontSizeButton> {
),
Offset.zero & overlay.size,
);
showMenu<String>(
final newValue = await showMenu<String>(
context: context,
elevation: 4,
items: [
@ -169,20 +172,19 @@ class _QuillFontSizeButtonState extends State<QuillFontSizeButton> {
position: position,
shape: popupMenuTheme.shape,
color: popupMenuTheme.color,
).then((newValue) {
if (!mounted) return;
if (newValue == null) {
return;
);
if (!mounted) return;
if (newValue == null) {
return;
}
final keyName = _getKeyName(newValue);
setState(() {
_currentValue = keyName ?? _defaultDisplayText;
if (keyName != null) {
widget.controller.formatSelection(Attribute.fromKeyValue(
'size', newValue == '0' ? null : getFontSize(newValue)));
widget.onSelected?.call(newValue);
}
final keyName = _getKeyName(newValue);
setState(() {
_currentValue = keyName ?? _defaultDisplayText;
if (keyName != null) {
widget.controller.formatSelection(Attribute.fromKeyValue(
'size', newValue == '0' ? null : getFontSize(newValue)));
widget.onSelected?.call(newValue);
}
});
});
}
@ -198,19 +200,24 @@ class _QuillFontSizeButtonState extends State<QuillFontSizeButton> {
UtilityWidgets.maybeWidget(
enabled: hasFinalWidth,
wrapper: (child) => Expanded(child: child),
child: Text(_currentValue,
overflow: widget.labelOverflow,
style: widget.style ??
TextStyle(
fontSize: widget.iconSize / 1.15,
color: widget.iconTheme?.iconUnselectedColor ??
theme.iconTheme.color)),
child: Text(
_currentValue,
overflow: widget.labelOverflow,
style: widget.style ??
TextStyle(
fontSize: widget.iconSize / 1.15,
color: widget.iconTheme?.iconUnselectedColor ??
theme.iconTheme.color,
),
),
),
const SizedBox(width: 3),
Icon(Icons.arrow_drop_down,
size: widget.iconSize / 1.15,
color: widget.iconTheme?.iconUnselectedColor ??
theme.iconTheme.color)
Icon(
Icons.arrow_drop_down,
size: widget.iconSize / 1.15,
color:
widget.iconTheme?.iconUnselectedColor ?? theme.iconTheme.color,
)
],
),
);

@ -3,8 +3,8 @@ import 'package:flutter/material.dart';
import '../../../models/themes/quill_dialog_theme.dart';
import '../../../models/themes/quill_icon_theme.dart';
import '../../controller.dart';
import '../../toolbar.dart';
import '../search_dialog.dart';
import '../toolbar.dart';
class SearchButton extends StatelessWidget {
const SearchButton({

@ -6,8 +6,8 @@ import '../../../models/documents/style.dart';
import '../../../models/themes/quill_icon_theme.dart';
import '../../../utils/widgets.dart';
import '../../controller.dart';
import '../../toolbar.dart';
import '../enum.dart';
import '../toolbar.dart';
class SelectAlignmentButton extends StatefulWidget {
const SelectAlignmentButton({

@ -6,7 +6,7 @@ import '../../../models/documents/style.dart';
import '../../../models/themes/quill_icon_theme.dart';
import '../../../utils/widgets.dart';
import '../../controller.dart';
import '../../toolbar.dart';
import '../toolbar.dart';
class SelectHeaderStyleButton extends StatefulWidget {
const SelectHeaderStyleButton({

@ -5,7 +5,7 @@ import '../../../models/documents/style.dart';
import '../../../models/themes/quill_icon_theme.dart';
import '../../../utils/widgets.dart';
import '../../controller.dart';
import '../../toolbar.dart';
import '../toolbar.dart';
class ToggleCheckListButton extends StatefulWidget {
const ToggleCheckListButton({

@ -5,7 +5,7 @@ import '../../../models/documents/style.dart';
import '../../../models/themes/quill_icon_theme.dart';
import '../../../utils/widgets.dart';
import '../../controller.dart';
import '../../toolbar.dart';
import '../toolbar.dart';
typedef ToggleStyleButtonBuilder = Widget Function(
BuildContext context,

@ -1,28 +1,28 @@
import 'package:flutter/material.dart';
import 'package:i18n_extension/i18n_widget.dart';
import '../../flutter_quill.dart';
import '../translations/toolbar.i18n.dart';
import '../utils/extensions/build_context.dart';
import 'toolbar/buttons/arrow_indicated_list.dart';
export '../models/config/toolbar/buttons/base.dart';
export '../models/config/toolbar/configurations.dart';
export 'toolbar/buttons/clear_format.dart';
export 'toolbar/buttons/color.dart';
export 'toolbar/buttons/custom_button.dart';
export 'toolbar/buttons/font_family.dart';
export 'toolbar/buttons/history.dart';
export 'toolbar/buttons/indent.dart';
export 'toolbar/buttons/link_style.dart';
export 'toolbar/buttons/link_style2.dart';
export 'toolbar/buttons/quill_font_size.dart';
export 'toolbar/buttons/quill_icon.dart';
export 'toolbar/buttons/search.dart';
export 'toolbar/buttons/select_alignment.dart';
export 'toolbar/buttons/select_header_style.dart';
export 'toolbar/buttons/toggle_check_list.dart';
export 'toolbar/buttons/toggle_style.dart';
import '../../../flutter_quill.dart';
import '../../translations/toolbar.i18n.dart';
import '../../utils/extensions/build_context.dart';
import 'buttons/arrow_indicated_list.dart';
export '../../models/config/toolbar/buttons/base.dart';
export '../../models/config/toolbar/configurations.dart';
export 'buttons/clear_format.dart';
export 'buttons/color.dart';
export 'buttons/custom_button.dart';
export 'buttons/font_family.dart';
export 'buttons/history.dart';
export 'buttons/indent.dart';
export 'buttons/link_style.dart';
export 'buttons/link_style2.dart';
export 'buttons/quill_font_size.dart';
export 'buttons/quill_icon.dart';
export 'buttons/search.dart';
export 'buttons/select_alignment.dart';
export 'buttons/select_header_style.dart';
export 'buttons/toggle_check_list.dart';
export 'buttons/toggle_style.dart';
typedef QuillToolbarChildrenBuilder = List<Widget> Function(
BuildContext context,
@ -220,54 +220,24 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
final toolbarConfigurations = context.requireQuillToolbarConfigurations;
final toolbarIconSize = toolbarConfigurations
.buttonOptions.baseButtonOptions.globalIconSize;
final toolbarIconSize =
toolbarConfigurations.buttonOptions.base.globalIconSize;
return [
if (showUndo)
QuillToolbarHistoryButton(
options:
toolbarConfigurations.buttonOptions.undoHistoryButtonOptions,
options: toolbarConfigurations.buttonOptions.undoHistory,
),
// QuillToolbarHistoryButton(
// icon: Icons.undo_outlined,
// iconSize: toolbarIconSize,
// tooltip: buttonTooltips[ToolbarButtons.undo],
// controller: controller,
// undo: true,
// iconTheme: iconTheme,
// afterButtonPressed: afterButtonPressed,
// ),
if (showRedo)
QuillToolbarHistoryButton(
options:
toolbarConfigurations.buttonOptions.redoHistoryButtonOptions,
options: toolbarConfigurations.buttonOptions.redoHistory,
),
// QuillToolbarHistoryButton(
// icon: Icons.redo_outlined,
// iconSize: toolbarIconSize,
// tooltip: buttonTooltips[ToolbarButtons.redo],
// controller: controller,
// undo: false,
// iconTheme: iconTheme,
// afterButtonPressed: afterButtonPressed,
// ),
if (showFontFamily)
QuillToolbarFontFamilyButton(
options:
toolbarConfigurations.buttonOptions.fontFamilyButtonOptions,
options: toolbarConfigurations.buttonOptions.fontFamily,
),
// QuillFontFamilyButton(
// iconTheme: iconTheme,
// iconSize: toolbarIconSize,
// tooltip: buttonTooltips[ToolbarButtons.fontFamily],
// attribute: Attribute.font,
// controller: controller,
// rawItemsMap: {},
// afterButtonPressed: afterButtonPressed,
// ),
if (showFontSize)
QuillFontSizeButton(
QuillToolbarFontSizeButton(
iconTheme: iconTheme,
iconSize: toolbarIconSize,
tooltip: buttonTooltips[ToolbarButtons.fontSize],

@ -17,8 +17,8 @@ class QuillProvider extends InheritedWidget {
final QuillConfigurations configurations;
@override
bool updateShouldNotify(covariant InheritedWidget oldWidget) {
return true;
bool updateShouldNotify(covariant QuillProvider oldWidget) {
return oldWidget.configurations != configurations;
}
static QuillProvider? of(BuildContext context) {

@ -1,6 +1,6 @@
name: flutter_quill
description: A rich text editor built for the modern Android, iOS, web and desktop platforms. It is the WYSIWYG editor and a Quill component for Flutter.
version: 7.6.0
version: 7.6.1
homepage: https://1o24bbs.com/c/bulletjournal/108
repository: https://github.com/singerdmx/flutter-quill
platforms:
@ -30,6 +30,7 @@ dependencies:
device_info_plus: ^9.1.0
platform: ^3.1.3
pasteboard: ^0.2.0
equatable: ^2.0.5
flutter_test:
sdk: flutter

Loading…
Cancel
Save