Add both iconSize and iconButtonFactor in the base button options

pull/1657/head
Ellet 1 year ago
parent 4798a3f8df
commit 3c0d93bf7c
  1. 4
      example/lib/screens/quill/my_quill_editor.dart
  2. 2
      flutter_quill_extensions/lib/embeds/formula/toolbar/formula_button.dart
  3. 2
      flutter_quill_extensions/lib/embeds/image/toolbar/image_button.dart
  4. 4
      flutter_quill_extensions/lib/embeds/image/toolbar/select_image_source.dart
  5. 4
      flutter_quill_extensions/lib/embeds/others/camera_button/camera_button.dart
  6. 4
      flutter_quill_extensions/lib/embeds/video/toolbar/select_video_source.dart
  7. 2
      flutter_quill_extensions/lib/embeds/video/toolbar/video_button.dart
  8. 7
      flutter_quill_extensions/lib/models/config/camera/camera_configurations.dart
  9. 7
      flutter_quill_extensions/lib/models/config/formula/formula_configurations.dart
  10. 6
      flutter_quill_extensions/lib/models/config/image/toolbar/image_configurations.dart
  11. 3
      flutter_quill_extensions/lib/models/config/media/media_button_configurations.dart
  12. 7
      flutter_quill_extensions/lib/models/config/video/toolbar/video_configurations.dart
  13. 13
      lib/src/models/config/toolbar/base_button_configurations.dart
  14. 3
      lib/src/models/config/toolbar/buttons/clear_format_configurations.dart
  15. 7
      lib/src/models/config/toolbar/buttons/color_configurations.dart
  16. 4
      lib/src/models/config/toolbar/buttons/custom_button_configurations.dart
  17. 8
      lib/src/models/config/toolbar/buttons/font_family_configurations.dart
  18. 7
      lib/src/models/config/toolbar/buttons/font_size_configurations.dart
  19. 8
      lib/src/models/config/toolbar/buttons/history_configurations.dart
  20. 7
      lib/src/models/config/toolbar/buttons/indent_configurations.dart
  21. 6
      lib/src/models/config/toolbar/buttons/link_style2_configurations.dart
  22. 6
      lib/src/models/config/toolbar/buttons/link_style_configurations.dart
  23. 6
      lib/src/models/config/toolbar/buttons/search_configurations.dart
  24. 6
      lib/src/models/config/toolbar/buttons/select_alignment_configurations.dart
  25. 6
      lib/src/models/config/toolbar/buttons/select_header_style_buttons_configurations.dart
  26. 7
      lib/src/models/config/toolbar/buttons/select_header_style_dropdown_button_configurations.dart
  27. 7
      lib/src/models/config/toolbar/buttons/toggle_check_list_configurations.dart
  28. 6
      lib/src/models/config/toolbar/buttons/toggle_style_configurations.dart
  29. 4
      lib/src/models/config/toolbar/simple_toolbar_configurations.dart
  30. 76
      lib/src/widgets/toolbar/base_button/stateless_base_button.dart
  31. 6
      lib/src/widgets/toolbar/base_toolbar.dart
  32. 132
      lib/src/widgets/toolbar/buttons/clear_format_button.dart
  33. 13
      lib/src/widgets/toolbar/buttons/color/color_button.dart
  34. 24
      lib/src/widgets/toolbar/buttons/custom_button_button.dart
  35. 176
      lib/src/widgets/toolbar/buttons/font_family_button.dart
  36. 9
      lib/src/widgets/toolbar/buttons/font_size_button.dart
  37. 2
      lib/src/widgets/toolbar/buttons/hearder_style/select_header_style_buttons.dart
  38. 11
      lib/src/widgets/toolbar/buttons/hearder_style/select_header_style_dropdown_button.dart
  39. 11
      lib/src/widgets/toolbar/buttons/history_button.dart
  40. 11
      lib/src/widgets/toolbar/buttons/indent_button.dart
  41. 21
      lib/src/widgets/toolbar/buttons/link_style2_button.dart
  42. 15
      lib/src/widgets/toolbar/buttons/link_style_button.dart
  43. 14
      lib/src/widgets/toolbar/buttons/search/search_button.dart
  44. 11
      lib/src/widgets/toolbar/buttons/toggle_check_list_button.dart
  45. 14
      lib/src/widgets/toolbar/buttons/toggle_style_button.dart
  46. 4
      lib/src/widgets/toolbar/simple_toolbar.dart

@ -37,9 +37,7 @@ class MyQuillEditor extends StatelessWidget {
codeBlock: QuillEditorCodeBlockElementOptions( codeBlock: QuillEditorCodeBlockElementOptions(
enableLineNumbers: true, enableLineNumbers: true,
), ),
orderedList: QuillEditorOrderedListElementOptions( orderedList: QuillEditorOrderedListElementOptions(),
customWidget: Icon(Icons.add),
),
unorderedList: QuillEditorUnOrderedListElementOptions( unorderedList: QuillEditorUnOrderedListElementOptions(
useTextColorForDot: true, useTextColorForDot: true,
), ),

@ -23,7 +23,7 @@ class QuillToolbarFormulaButton extends StatelessWidget {
final baseIconFactor = final baseIconFactor =
baseButtonExtraOptions(context)?.globalIconButtonFactor; baseButtonExtraOptions(context)?.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor; final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor; return iconButtonFactor ?? baseIconFactor ?? kDefaultIconButtonFactor;
} }
VoidCallback? _afterButtonPressed(BuildContext context) { VoidCallback? _afterButtonPressed(BuildContext context) {

@ -32,7 +32,7 @@ class QuillToolbarImageButton extends StatelessWidget {
final baseIconFactor = final baseIconFactor =
baseButtonExtraOptions(context)?.globalIconButtonFactor; baseButtonExtraOptions(context)?.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor; final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor; return iconButtonFactor ?? baseIconFactor ?? kDefaultIconButtonFactor;
} }
VoidCallback? _afterButtonPressed(BuildContext context) { VoidCallback? _afterButtonPressed(BuildContext context) {

@ -9,8 +9,8 @@ class SelectImageSourceDialog extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( return Container(
height: 230, constraints: const BoxConstraints(minHeight: 200),
width: double.infinity, width: double.infinity,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(

@ -7,7 +7,7 @@ import 'package:flutter_quill/flutter_quill.dart'
QuillToolbarBaseButtonOptions, QuillToolbarBaseButtonOptions,
QuillToolbarIconButton, QuillToolbarIconButton,
kDefaultIconSize, kDefaultIconSize,
kIconButtonFactor; kDefaultIconButtonFactor;
import 'package:flutter_quill/translations.dart'; import 'package:flutter_quill/translations.dart';
import '../../../models/config/camera/camera_configurations.dart'; import '../../../models/config/camera/camera_configurations.dart';
@ -36,7 +36,7 @@ class QuillToolbarCameraButton extends StatelessWidget {
final baseIconFactor = final baseIconFactor =
baseButtonExtraOptions(context)?.globalIconButtonFactor; baseButtonExtraOptions(context)?.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor; final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor; return iconButtonFactor ?? baseIconFactor ?? kDefaultIconButtonFactor;
} }
VoidCallback? _afterButtonPressed(BuildContext context) { VoidCallback? _afterButtonPressed(BuildContext context) {

@ -9,8 +9,8 @@ class SelectVideoSourceDialog extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( return Container(
height: 230, constraints: const BoxConstraints(minHeight: 200),
width: double.infinity, width: double.infinity,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(

@ -30,7 +30,7 @@ class QuillToolbarVideoButton extends StatelessWidget {
final baseIconFactor = final baseIconFactor =
baseButtonExtraOptions(context)?.globalIconButtonFactor; baseButtonExtraOptions(context)?.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor; final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor; return iconButtonFactor ?? baseIconFactor ?? kDefaultIconButtonFactor;
} }
VoidCallback? _afterButtonPressed(BuildContext context) { VoidCallback? _afterButtonPressed(BuildContext context) {

@ -16,8 +16,8 @@ class QuillToolbarCameraButtonOptions extends QuillToolbarBaseButtonOptions<
QuillToolbarCameraButtonOptions, QuillToolbarCameraButtonExtraOptions> { QuillToolbarCameraButtonOptions, QuillToolbarCameraButtonExtraOptions> {
const QuillToolbarCameraButtonOptions({ const QuillToolbarCameraButtonOptions({
this.cameraConfigurations = const QuillToolbarCameraConfigurations(), this.cameraConfigurations = const QuillToolbarCameraConfigurations(),
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
this.fillColor, this.fillColor,
super.iconData, super.iconData,
super.afterButtonPressed, super.afterButtonPressed,
@ -26,9 +26,6 @@ class QuillToolbarCameraButtonOptions extends QuillToolbarBaseButtonOptions<
super.childBuilder, super.childBuilder,
}); });
final double? iconSize;
final double? iconButtonFactor;
final Color? fillColor; final Color? fillColor;
final QuillToolbarCameraConfigurations cameraConfigurations; final QuillToolbarCameraConfigurations cameraConfigurations;

@ -19,12 +19,9 @@ class QuillToolbarFormulaButtonOptions extends QuillToolbarBaseButtonOptions<
super.afterButtonPressed, super.afterButtonPressed,
super.childBuilder, super.childBuilder,
this.fillColor, this.fillColor,
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
}); });
final Color? fillColor; final Color? fillColor;
final double? iconSize;
final double? iconButtonFactor;
} }

@ -18,8 +18,8 @@ class QuillToolbarImageButtonOptions extends QuillToolbarBaseButtonOptions<
QuillToolbarImageButtonOptions, QuillToolbarImageButtonExtraOptions> { QuillToolbarImageButtonOptions, QuillToolbarImageButtonExtraOptions> {
const QuillToolbarImageButtonOptions({ const QuillToolbarImageButtonOptions({
super.iconData, super.iconData,
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
/// specifies the tooltip text for the image button. /// specifies the tooltip text for the image button.
super.tooltip, super.tooltip,
@ -32,8 +32,6 @@ class QuillToolbarImageButtonOptions extends QuillToolbarBaseButtonOptions<
this.imageButtonConfigurations = const QuillToolbarImageConfigurations(), this.imageButtonConfigurations = const QuillToolbarImageConfigurations(),
}); });
final double? iconSize;
final double? iconButtonFactor;
final Color? fillColor; final Color? fillColor;
final QuillDialogTheme? dialogTheme; final QuillDialogTheme? dialogTheme;

@ -23,7 +23,7 @@ class QuillToolbarMediaButtonOptions extends QuillToolbarBaseButtonOptions<
this.mediaFilePicker, this.mediaFilePicker,
this.childrenSpacing = 16.0, this.childrenSpacing = 16.0,
this.autovalidateMode = AutovalidateMode.disabled, this.autovalidateMode = AutovalidateMode.disabled,
this.iconSize, super.iconSize,
this.fillColor, this.fillColor,
this.dialogTheme, this.dialogTheme,
this.labelText, this.labelText,
@ -40,7 +40,6 @@ class QuillToolbarMediaButtonOptions extends QuillToolbarBaseButtonOptions<
super.childBuilder, super.childBuilder,
}); });
final double? iconSize;
final Color? fillColor; final Color? fillColor;
final QuillMediaType type; final QuillMediaType type;
final QuillDialogTheme? dialogTheme; final QuillDialogTheme? dialogTheme;

@ -18,8 +18,8 @@ class QuillToolbarVideoButtonOptions extends QuillToolbarBaseButtonOptions<
this.linkRegExp, this.linkRegExp,
this.dialogTheme, this.dialogTheme,
this.fillColor, this.fillColor,
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
super.iconData, super.iconData,
super.afterButtonPressed, super.afterButtonPressed,
super.tooltip, super.tooltip,
@ -33,7 +33,4 @@ class QuillToolbarVideoButtonOptions extends QuillToolbarBaseButtonOptions<
final QuillToolbarVideoConfigurations videoConfigurations; final QuillToolbarVideoConfigurations videoConfigurations;
final Color? fillColor; final Color? fillColor;
final double? iconSize;
final double? iconButtonFactor;
} }

@ -4,7 +4,8 @@ import 'package:flutter/widgets.dart' show BuildContext, IconData, Widget;
import '../../../../flutter_quill.dart' show QuillController; import '../../../../flutter_quill.dart' show QuillController;
import '../../themes/quill_icon_theme.dart' show QuillIconTheme; import '../../themes/quill_icon_theme.dart' show QuillIconTheme;
import '../quill_configurations.dart' show kDefaultIconSize, kIconButtonFactor; import '../quill_configurations.dart'
show kDefaultIconSize, kDefaultIconButtonFactor;
class QuillToolbarBaseButtonExtraOptionsIsToggled extends Equatable { class QuillToolbarBaseButtonExtraOptionsIsToggled extends Equatable {
const QuillToolbarBaseButtonExtraOptionsIsToggled(this.isToggled); const QuillToolbarBaseButtonExtraOptionsIsToggled(this.isToggled);
@ -44,7 +45,9 @@ class QuillToolbarBaseButtonOptions<T, I> extends Equatable {
const QuillToolbarBaseButtonOptions({ const QuillToolbarBaseButtonOptions({
this.iconData, this.iconData,
this.globalIconSize = kDefaultIconSize, this.globalIconSize = kDefaultIconSize,
this.globalIconButtonFactor = kIconButtonFactor, this.iconSize,
this.iconButtonFactor,
this.globalIconButtonFactor = kDefaultIconButtonFactor,
this.afterButtonPressed, this.afterButtonPressed,
this.tooltip, this.tooltip,
this.iconTheme, this.iconTheme,
@ -61,10 +64,14 @@ class QuillToolbarBaseButtonOptions<T, I> extends Equatable {
/// this will be used for all the buttons but you can override this /// this will be used for all the buttons but you can override this
final double globalIconSize; final double globalIconSize;
final double? iconSize;
/// The factor of how much larger the button is in relation to the icon, /// The factor of how much larger the button is in relation to the icon,
/// by default it will be [kIconButtonFactor]. /// by default it will be [kDefaultIconButtonFactor].
final double globalIconButtonFactor; final double globalIconButtonFactor;
final double? iconButtonFactor;
/// To do extra logic after pressing the button /// To do extra logic after pressing the button
final VoidCallback? afterButtonPressed; final VoidCallback? afterButtonPressed;

@ -18,10 +18,9 @@ class QuillToolbarClearFormatButtonOptions
super.childBuilder, super.childBuilder,
super.iconTheme, super.iconTheme,
super.tooltip, super.tooltip,
this.iconSize, super.iconSize,
this.iconButtonFactor, this.iconButtonFactor,
}); });
final double? iconSize;
final double? iconButtonFactor; final double? iconButtonFactor;
} }

@ -26,8 +26,8 @@ class QuillToolbarColorButtonOptions extends QuillToolbarBaseButtonOptions<
QuillToolbarColorButtonOptions, QuillToolbarColorButtonExtraOptions> { QuillToolbarColorButtonOptions, QuillToolbarColorButtonExtraOptions> {
const QuillToolbarColorButtonOptions({ const QuillToolbarColorButtonOptions({
this.dialogBarrierColor, this.dialogBarrierColor,
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
super.iconData, super.iconData,
super.afterButtonPressed, super.afterButtonPressed,
super.childBuilder, super.childBuilder,
@ -36,9 +36,6 @@ class QuillToolbarColorButtonOptions extends QuillToolbarBaseButtonOptions<
this.customOnPressedCallback, this.customOnPressedCallback,
}); });
final double? iconSize;
final double? iconButtonFactor;
/// By default will use the default `dialogBarrierColor` from /// By default will use the default `dialogBarrierColor` from
/// [QuillSharedConfigurations] /// [QuillSharedConfigurations]
final Color? dialogBarrierColor; final Color? dialogBarrierColor;

@ -15,8 +15,6 @@ class QuillToolbarCustomButtonOptions extends QuillToolbarBaseButtonOptions<
QuillToolbarBaseButtonOptions, QuillToolbarCustomButtonExtraOptions> { QuillToolbarBaseButtonOptions, QuillToolbarCustomButtonExtraOptions> {
const QuillToolbarCustomButtonOptions({ const QuillToolbarCustomButtonOptions({
this.icon, this.icon,
this.iconButtonFactor,
this.iconSize,
super.afterButtonPressed, super.afterButtonPressed,
super.tooltip, super.tooltip,
super.iconTheme, super.iconTheme,
@ -24,8 +22,6 @@ class QuillToolbarCustomButtonOptions extends QuillToolbarBaseButtonOptions<
this.onPressed, this.onPressed,
}); });
final double? iconButtonFactor;
final double? iconSize;
final VoidCallback? onPressed; final VoidCallback? onPressed;
final Widget? icon; final Widget? icon;
} }

@ -49,8 +49,8 @@ class QuillToolbarFontFamilyButtonOptions extends QuillToolbarBaseButtonOptions<
this.itemPadding, this.itemPadding,
this.defaultItemColor = Colors.red, this.defaultItemColor = Colors.red,
this.renderFontFamilies = true, this.renderFontFamilies = true,
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
this.defaultDisplayText, this.defaultDisplayText,
}); });
@ -72,10 +72,6 @@ class QuillToolbarFontFamilyButtonOptions extends QuillToolbarBaseButtonOptions<
final Color? defaultItemColor; final Color? defaultItemColor;
final String? defaultDisplayText; final String? defaultDisplayText;
/// By default will use [globalIconSize]
final double? iconSize;
final double? iconButtonFactor;
QuillToolbarFontFamilyButtonOptions copyWith({ QuillToolbarFontFamilyButtonOptions copyWith({
List<PopupMenuEntry<String>>? items, List<PopupMenuEntry<String>>? items,
Map<String, String>? rawItemsMap, Map<String, String>? rawItemsMap,

@ -33,8 +33,8 @@ class QuillToolbarFontSizeButtonExtraOptions
class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions< class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions<
QuillToolbarFontSizeButtonOptions, QuillToolbarFontSizeButtonExtraOptions> { QuillToolbarFontSizeButtonOptions, QuillToolbarFontSizeButtonExtraOptions> {
const QuillToolbarFontSizeButtonOptions({ const QuillToolbarFontSizeButtonOptions({
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
this.rawItemsMap, this.rawItemsMap,
this.onSelected, this.onSelected,
this.attribute = Attribute.size, this.attribute = Attribute.size,
@ -53,9 +53,6 @@ class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions<
this.defaultDisplayText, this.defaultDisplayText,
}); });
final double? iconSize;
final double? iconButtonFactor;
final ButtonStyle? shape; final ButtonStyle? shape;
/// By default it will be [fontSizesValues] from [QuillSimpleToolbarConfigurations] /// By default it will be [fontSizesValues] from [QuillSimpleToolbarConfigurations]

@ -25,11 +25,7 @@ class QuillToolbarHistoryButtonOptions extends QuillToolbarBaseButtonOptions<
super.afterButtonPressed, super.afterButtonPressed,
super.tooltip, super.tooltip,
super.childBuilder, super.childBuilder,
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
}); });
/// By default will use [globalIconSize]
final double? iconSize;
final double? iconButtonFactor;
} }

@ -20,10 +20,7 @@ class QuillToolbarIndentButtonOptions extends QuillToolbarBaseButtonOptions<
super.childBuilder, super.childBuilder,
super.iconTheme, super.iconTheme,
super.tooltip, super.tooltip,
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
}); });
final double? iconSize;
final double? iconButtonFactor;
} }

@ -16,8 +16,8 @@ class QuillToolbarLinkStyleButton2Options extends QuillToolbarBaseButtonOptions<
QuillToolbarLinkStyleButton2Options, QuillToolbarLinkStyleButton2Options,
QuillToolbarLinkStyleButton2ExtraOptions> { QuillToolbarLinkStyleButton2ExtraOptions> {
const QuillToolbarLinkStyleButton2Options({ const QuillToolbarLinkStyleButton2Options({
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
this.dialogTheme, this.dialogTheme,
this.constraints, this.constraints,
this.addLinkLabel, this.addLinkLabel,
@ -35,8 +35,6 @@ class QuillToolbarLinkStyleButton2Options extends QuillToolbarBaseButtonOptions<
super.childBuilder, super.childBuilder,
}); });
final double? iconSize;
final double? iconButtonFactor;
final QuillDialogTheme? dialogTheme; final QuillDialogTheme? dialogTheme;
/// The constrains for dialog. /// The constrains for dialog.

@ -21,8 +21,8 @@ class QuillToolbarLinkStyleButtonOptions extends QuillToolbarBaseButtonOptions<
this.linkRegExp, this.linkRegExp,
this.linkDialogAction, this.linkDialogAction,
this.dialogBarrierColor, this.dialogBarrierColor,
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
super.iconData, super.iconData,
super.globalIconSize, super.globalIconSize,
super.afterButtonPressed, super.afterButtonPressed,
@ -31,8 +31,6 @@ class QuillToolbarLinkStyleButtonOptions extends QuillToolbarBaseButtonOptions<
super.childBuilder, super.childBuilder,
}); });
final double? iconSize;
final double? iconButtonFactor;
final QuillDialogTheme? dialogTheme; final QuillDialogTheme? dialogTheme;
final RegExp? linkRegExp; final RegExp? linkRegExp;
final LinkDialogAction? linkDialogAction; final LinkDialogAction? linkDialogAction;

@ -20,16 +20,14 @@ class QuillToolbarSearchButtonOptions extends QuillToolbarBaseButtonOptions<
super.afterButtonPressed, super.afterButtonPressed,
super.iconTheme, super.iconTheme,
this.dialogTheme, this.dialogTheme,
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
this.dialogBarrierColor, this.dialogBarrierColor,
this.fillColor, this.fillColor,
this.customOnPressedCallback, this.customOnPressedCallback,
}); });
final QuillDialogTheme? dialogTheme; final QuillDialogTheme? dialogTheme;
final double? iconSize;
final double? iconButtonFactor;
/// By default will be [dialogBarrierColor] from [QuillSharedConfigurations] /// By default will be [dialogBarrierColor] from [QuillSharedConfigurations]
final Color? dialogBarrierColor; final Color? dialogBarrierColor;

@ -17,16 +17,14 @@ class QuillToolbarSelectAlignmentButtonOptions
const QuillToolbarSelectAlignmentButtonOptions({ const QuillToolbarSelectAlignmentButtonOptions({
this.iconsData, this.iconsData,
this.tooltips, this.tooltips,
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
super.afterButtonPressed, super.afterButtonPressed,
/// This will called on every select alignment button /// This will called on every select alignment button
super.childBuilder, super.childBuilder,
super.iconTheme, super.iconTheme,
}); });
final double? iconSize;
final double? iconButtonFactor;
/// Default to /// Default to
/// const QuillToolbarSelectAlignmentValues( /// const QuillToolbarSelectAlignmentValues(

@ -23,8 +23,8 @@ class QuillToolbarSelectHeaderStyleButtonsOptions
super.tooltip, super.tooltip,
this.axis, this.axis,
this.attributes, this.attributes,
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
}); });
/// Default value: /// Default value:
@ -41,6 +41,4 @@ class QuillToolbarSelectHeaderStyleButtonsOptions
/// By default we will the toolbar axis from [QuillSimpleToolbarConfigurations] /// By default we will the toolbar axis from [QuillSimpleToolbarConfigurations]
final Axis? axis; final Axis? axis;
final double? iconSize;
final double? iconButtonFactor;
} }

@ -25,8 +25,8 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions
super.childBuilder, super.childBuilder,
super.iconTheme, super.iconTheme,
super.tooltip, super.tooltip,
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
this.textStyle, this.textStyle,
super.iconData, super.iconData,
this.attributes, this.attributes,
@ -34,9 +34,6 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions
this.width, this.width,
}); });
/// By default we will the toolbar axis from [QuillSimpleToolbarConfigurations]
final double? iconSize;
final double? iconButtonFactor;
final TextStyle? textStyle; final TextStyle? textStyle;
/// Header attributes, defaults to: /// Header attributes, defaults to:

@ -21,8 +21,8 @@ class QuillToolbarToggleCheckListButtonOptions
QuillToolbarToggleCheckListButtonOptions, QuillToolbarToggleCheckListButtonOptions,
QuillToolbarToggleCheckListButtonExtraOptions> { QuillToolbarToggleCheckListButtonExtraOptions> {
const QuillToolbarToggleCheckListButtonOptions({ const QuillToolbarToggleCheckListButtonOptions({
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
this.fillColor, this.fillColor,
this.attribute = Attribute.unchecked, this.attribute = Attribute.unchecked,
this.isShouldRequestKeyboard = false, this.isShouldRequestKeyboard = false,
@ -33,9 +33,6 @@ class QuillToolbarToggleCheckListButtonOptions
super.childBuilder, super.childBuilder,
}); });
final double? iconSize;
final double? iconButtonFactor;
final Color? fillColor; final Color? fillColor;
final Attribute attribute; final Attribute attribute;

@ -24,8 +24,8 @@ class QuillToolbarToggleStyleButtonOptions
QuillToolbarToggleStyleButtonExtraOptions> { QuillToolbarToggleStyleButtonExtraOptions> {
const QuillToolbarToggleStyleButtonOptions({ const QuillToolbarToggleStyleButtonOptions({
super.iconData, super.iconData,
this.iconSize, super.iconSize,
this.iconButtonFactor, super.iconButtonFactor,
this.fillColor, this.fillColor,
super.tooltip, super.tooltip,
super.afterButtonPressed, super.afterButtonPressed,
@ -33,7 +33,5 @@ class QuillToolbarToggleStyleButtonOptions
super.childBuilder, super.childBuilder,
}); });
final double? iconSize;
final double? iconButtonFactor;
final Color? fillColor; final Color? fillColor;
} }

@ -32,10 +32,10 @@ export 'simple_toolbar_button_options.dart';
const double kDefaultIconSize = 15; const double kDefaultIconSize = 15;
/// The default size for the toolbar (width, height) /// The default size for the toolbar (width, height)
const double defaultToolbarSize = kDefaultIconSize * 2; const double kDefaultToolbarSize = kDefaultIconSize * 2;
/// The factor of how much larger the button is in relation to the icon. /// The factor of how much larger the button is in relation to the icon.
const double kIconButtonFactor = 1.6; const double kDefaultIconButtonFactor = 1.6;
/// The horizontal margin between the contents of each toolbar section. /// The horizontal margin between the contents of each toolbar section.
const double kToolbarSectionSpacing = 4; const double kToolbarSectionSpacing = 4;

@ -0,0 +1,76 @@
import 'package:flutter/material.dart';
import '../../../extensions/quill_configurations_ext.dart';
import '../../../models/themes/quill_icon_theme.dart';
import '../../quill/quill_controller.dart';
import '../base_toolbar.dart';
/// The [T] is the options for the button, usually should refresnce itself
/// 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
abstract class QuillToolbarBaseButton<T, I> extends StatelessWidget {
const QuillToolbarBaseButton({
required this.controller,
super.key,
this.options,
});
final QuillToolbarBaseButtonOptions<T, I>? options;
final QuillController controller;
double iconSize(BuildContext context) {
final baseFontSize = baseButtonExtraOptions(context)?.globalIconSize;
final iconSize = options?.iconSize;
return iconSize ?? baseFontSize ?? kDefaultIconSize;
}
double iconButtonFactor(BuildContext context) {
final baseIconFactor =
baseButtonExtraOptions(context)?.globalIconButtonFactor;
final iconButtonFactor = options?.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kDefaultIconButtonFactor;
}
VoidCallback? afterButtonPressed(BuildContext context) {
return options?.afterButtonPressed ??
baseButtonExtraOptions(context)?.afterButtonPressed;
}
QuillIconTheme? iconTheme(BuildContext context) {
return options?.iconTheme ?? baseButtonExtraOptions(context)?.iconTheme;
}
QuillToolbarBaseButtonOptions? baseButtonExtraOptions(BuildContext context) {
return context.quillToolbarBaseButtonOptions;
}
IconData iconData(BuildContext context) {
return options?.iconData ??
baseButtonExtraOptions(context)?.iconData ??
getDefaultIconData(context);
}
String tooltip(BuildContext context) {
return options?.tooltip ??
baseButtonExtraOptions(context)?.tooltip ??
getDefaultIconSize(context);
}
abstract final IconData Function(BuildContext context) getDefaultIconData;
abstract final String Function(BuildContext context) getDefaultIconSize;
Widget buildButton(BuildContext context);
Widget? buildCustomChildBuilder(
BuildContext context,
);
@override
Widget build(BuildContext context) {
final childBuilder = options?.childBuilder;
if (childBuilder != null) {
return buildCustomChildBuilder(context) ?? const SizedBox.shrink();
}
return buildButton(context);
}
}

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../flutter_quill.dart' import '../../../flutter_quill.dart'
show QuillToolbarProvider, defaultToolbarSize; show QuillToolbarProvider, kDefaultToolbarSize;
import '../../l10n/widgets/localizations.dart'; import '../../l10n/widgets/localizations.dart';
import '../../models/config/toolbar/simple_toolbar_configurations.dart'; import '../../models/config/toolbar/simple_toolbar_configurations.dart';
import '../../models/config/toolbar/toolbar_configurations.dart'; import '../../models/config/toolbar/toolbar_configurations.dart';
@ -53,8 +53,8 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
// default // default
@override @override
Size get preferredSize => configurations.axis == Axis.horizontal Size get preferredSize => configurations.axis == Axis.horizontal
? const Size.fromHeight(defaultToolbarSize) ? const Size.fromHeight(kDefaultToolbarSize)
: const Size.fromWidth(defaultToolbarSize); : const Size.fromWidth(kDefaultToolbarSize);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

@ -1,120 +1,64 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../extensions/quill_configurations_ext.dart';
import '../../../l10n/extensions/localizations.dart'; import '../../../l10n/extensions/localizations.dart';
import '../../../models/documents/attribute.dart'; import '../../../models/documents/attribute.dart';
import '../../../models/themes/quill_icon_theme.dart'; import '../base_button/stateless_base_button.dart';
import '../../quill/quill_controller.dart';
import '../base_toolbar.dart'; import '../base_toolbar.dart';
class QuillToolbarClearFormatButton extends StatelessWidget { class QuillToolbarClearFormatButton extends QuillToolbarBaseButton {
const QuillToolbarClearFormatButton({ const QuillToolbarClearFormatButton({
required QuillController controller, required super.controller,
this.options = const QuillToolbarClearFormatButtonOptions(), super.options,
super.key, super.key,
}) : _controller = controller; });
final QuillController _controller;
final QuillToolbarClearFormatButtonOptions options;
QuillController get controller {
return _controller;
}
double _iconSize(BuildContext context) {
final baseFontSize = baseButtonExtraOptions(context)?.globalIconSize;
final iconSize = options.iconSize;
return iconSize ?? baseFontSize ?? kDefaultIconSize;
}
double _iconButtonFactor(BuildContext context) {
final baseIconFactor =
baseButtonExtraOptions(context)?.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor;
}
VoidCallback? _afterButtonPressed(BuildContext context) {
return options.afterButtonPressed ??
baseButtonExtraOptions(context)?.afterButtonPressed;
}
QuillIconTheme? _iconTheme(BuildContext context) {
return options.iconTheme ?? baseButtonExtraOptions(context)?.iconTheme;
}
QuillToolbarBaseButtonOptions? baseButtonExtraOptions(BuildContext context) {
return context.quillToolbarBaseButtonOptions;
}
IconData _iconData(BuildContext context) {
return options.iconData ??
baseButtonExtraOptions(context)?.iconData ??
Icons.format_clear;
}
String _tooltip(BuildContext context) {
return options.tooltip ??
baseButtonExtraOptions(context)?.tooltip ??
(context.loc.clearFormat);
}
void _sharedOnPressed() { void _sharedOnPressed() {
final attrs = <Attribute>{}; final attributes = <Attribute>{};
for (final style in controller.getAllSelectionStyles()) { for (final style in controller.getAllSelectionStyles()) {
for (final attr in style.attributes.values) { for (final attr in style.attributes.values) {
attrs.add(attr); attributes.add(attr);
} }
} }
for (final attr in attrs) { for (final attribute in attributes) {
controller.formatSelection(Attribute.clone(attr, null)); controller.formatSelection(Attribute.clone(attribute, null));
} }
} }
@override @override
Widget build(BuildContext context) { Widget buildButton(BuildContext context) {
final iconTheme = _iconTheme(context);
final tooltip = _tooltip(context);
final iconSize = _iconSize(context);
final iconButtonFactor = _iconButtonFactor(context);
final iconData = _iconData(context);
final childBuilder =
options.childBuilder ?? baseButtonExtraOptions(context)?.childBuilder;
final afterButtonPressed = _afterButtonPressed(context);
if (childBuilder != null) {
return childBuilder(
QuillToolbarClearFormatButtonOptions(
afterButtonPressed: afterButtonPressed,
iconData: iconData,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
iconTheme: iconTheme,
tooltip: tooltip,
),
QuillToolbarClearFormatButtonExtraOptions(
controller: controller,
context: context,
onPressed: () {
_sharedOnPressed();
_afterButtonPressed(context)?.call();
},
),
);
}
return QuillToolbarIconButton( return QuillToolbarIconButton(
tooltip: tooltip, tooltip: tooltip(context),
icon: Icon( icon: Icon(
iconData, iconData(context),
size: iconSize * iconButtonFactor, size: iconSize(context) * iconButtonFactor(context),
// color: iconColor,
), ),
isSelected: false, isSelected: false,
onPressed: _sharedOnPressed, onPressed: _sharedOnPressed,
afterPressed: afterButtonPressed, afterPressed: afterButtonPressed(context),
iconTheme: iconTheme, iconTheme: iconTheme(context),
); );
} }
@override
Widget? buildCustomChildBuilder(BuildContext context) {
return options?.childBuilder?.call(
options,
QuillToolbarClearFormatButtonExtraOptions(
controller: controller,
context: context,
onPressed: () {
_sharedOnPressed();
afterButtonPressed(context)?.call();
},
),
);
}
@override
IconData Function(BuildContext context) get getDefaultIconData =>
(context) => Icons.format_clear;
@override
String Function(BuildContext context) get getDefaultIconSize =>
(context) => context.loc.clearFormat;
} }

@ -112,7 +112,7 @@ class QuillToolbarColorButtonState extends State<QuillToolbarColorButton> {
double get iconButtonFactor { double get iconButtonFactor {
final baseIconFactor = baseButtonExtraOptions?.globalIconButtonFactor; final baseIconFactor = baseButtonExtraOptions?.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor; final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor; return iconButtonFactor ?? baseIconFactor ?? kDefaultIconButtonFactor;
} }
VoidCallback? get afterButtonPressed { VoidCallback? get afterButtonPressed {
@ -165,16 +165,7 @@ class QuillToolbarColorButtonState extends State<QuillToolbarColorButton> {
options.childBuilder ?? baseButtonExtraOptions?.childBuilder; options.childBuilder ?? baseButtonExtraOptions?.childBuilder;
if (childBuilder != null) { if (childBuilder != null) {
return childBuilder( return childBuilder(
QuillToolbarColorButtonOptions( options,
afterButtonPressed: afterButtonPressed,
dialogBarrierColor: options.dialogBarrierColor,
tooltip: tooltip,
iconTheme: iconTheme,
iconSize: iconSize,
iconData: iconData,
iconButtonFactor: iconButtonFactor,
customOnPressedCallback: options.customOnPressedCallback,
),
QuillToolbarColorButtonExtraOptions( QuillToolbarColorButtonExtraOptions(
controller: controller, controller: controller,
context: context, context: context,

@ -15,19 +15,6 @@ class QuillToolbarCustomButton extends StatelessWidget {
final QuillController controller; final QuillController controller;
final QuillToolbarCustomButtonOptions options; final QuillToolbarCustomButtonOptions options;
double _iconSize(BuildContext context) {
final baseFontSize = baseButtonExtraOptions(context)?.globalIconSize;
final iconSize = options.iconSize;
return iconSize ?? baseFontSize ?? kDefaultIconSize;
}
double _iconButtonFactor(BuildContext context) {
final baseIconFactor =
baseButtonExtraOptions(context)?.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor;
}
VoidCallback? _afterButtonPressed(BuildContext context) { VoidCallback? _afterButtonPressed(BuildContext context) {
return options.afterButtonPressed ?? return options.afterButtonPressed ??
baseButtonExtraOptions(context)?.afterButtonPressed; baseButtonExtraOptions(context)?.afterButtonPressed;
@ -54,8 +41,6 @@ class QuillToolbarCustomButton extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final iconTheme = _iconTheme(context); final iconTheme = _iconTheme(context);
final tooltip = _tooltip(context); final tooltip = _tooltip(context);
final iconSize = _iconSize(context);
final iconButtonFactor = _iconButtonFactor(context);
final childBuilder = final childBuilder =
options.childBuilder ?? baseButtonExtraOptions(context)?.childBuilder; options.childBuilder ?? baseButtonExtraOptions(context)?.childBuilder;
@ -63,14 +48,7 @@ class QuillToolbarCustomButton extends StatelessWidget {
if (childBuilder != null) { if (childBuilder != null) {
return childBuilder( return childBuilder(
QuillToolbarCustomButtonOptions( options,
iconButtonFactor: iconButtonFactor,
iconSize: iconSize,
afterButtonPressed: afterButtonPressed,
iconTheme: iconTheme,
tooltip: tooltip,
icon: options.icon,
),
QuillToolbarCustomButtonExtraOptions( QuillToolbarCustomButtonExtraOptions(
context: context, context: context,
controller: controller, controller: controller,

@ -147,10 +147,16 @@ class QuillToolbarFontFamilyButtonState
} }
void _onPressed() { void _onPressed() {
_showMenu(); if (_menuController.isOpen) {
_menuController.close();
} else {
_menuController.open();
}
options.afterButtonPressed?.call(); options.afterButtonPressed?.call();
} }
final _menuController = MenuController();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final baseButtonConfigurations = context.quillToolbarBaseButtonOptions; final baseButtonConfigurations = context.quillToolbarBaseButtonOptions;
@ -158,13 +164,7 @@ class QuillToolbarFontFamilyButtonState
options.childBuilder ?? baseButtonConfigurations?.childBuilder; options.childBuilder ?? baseButtonConfigurations?.childBuilder;
if (childBuilder != null) { if (childBuilder != null) {
return childBuilder( return childBuilder(
options.copyWith( options,
iconSize: iconSize,
rawItemsMap: rawItemsMap,
iconTheme: iconTheme,
tooltip: tooltip,
afterButtonPressed: afterButtonPressed,
),
QuillToolbarFontFamilyButtonExtraOptions( QuillToolbarFontFamilyButtonExtraOptions(
currentValue: _currentValue, currentValue: _currentValue,
defaultDisplayText: _defaultDisplayText, defaultDisplayText: _defaultDisplayText,
@ -185,101 +185,79 @@ class QuillToolbarFontFamilyButtonState
} }
return Tooltip(message: effectiveTooltip, child: child); return Tooltip(message: effectiveTooltip, child: child);
}, },
child: Builder( child: MenuAnchor(
builder: (context) { controller: _menuController,
final isMaterial3 = Theme.of(context).useMaterial3; menuChildren: [
if (!isMaterial3) { for (final MapEntry<String, String> fontFamily in rawItemsMap.entries)
return RawMaterialButton( MenuItemButton(
onPressed: _onPressed, key: ValueKey(fontFamily.key),
child: _buildContent(context), // value: fontFamily.value,
); // height: options.itemHeight ?? kMinInteractiveDimension,
} // padding: options.itemPadding,
return QuillToolbarIconButton( onPressed: () {
isSelected: false, final newValue = fontFamily.value;
iconTheme: iconTheme?.copyWith( final keyName = _getKeyName(newValue);
iconButtonSelectedData: const IconButtonData( setState(() {
visualDensity: VisualDensity.compact, if (keyName != 'Clear') {
), _currentValue = keyName ?? _defaultDisplayText;
iconButtonUnselectedData: const IconButtonData( } else {
visualDensity: VisualDensity.compact, _currentValue = _defaultDisplayText;
), }
), if (keyName != null) {
onPressed: _onPressed, controller.formatSelection(
icon: _buildContent(context), Attribute.fromKeyValue(
); Attribute.font.key,
}, newValue == 'Clear' ? null : newValue,
), ),
); );
} options.onSelected?.call(newValue);
}
});
Future<void> _showMenu() async { if (fontFamily.value == 'Clear') {
final popupMenuTheme = PopupMenuTheme.of(context); controller.selectFontFamily(null);
final button = context.findRenderObject() as RenderBox; return;
final overlay = Overlay.of(context).context.findRenderObject() as RenderBox; }
final position = RelativeRect.fromRect( controller.selectFontFamily(fontFamily.value);
Rect.fromPoints( },
button.localToGlobal(Offset.zero, ancestor: overlay), child: Text(
button.localToGlobal(button.size.bottomLeft(Offset.zero), fontFamily.key.toString(),
ancestor: overlay), style: TextStyle(
), fontFamily:
Offset.zero & overlay.size, options.renderFontFamilies ? fontFamily.value : null,
); color: fontFamily.value == 'Clear'
final newValue = await showMenu<String>( ? options.defaultItemColor
context: context, : null,
elevation: 4, ),
items: [
for (final MapEntry<String, String> fontFamily in rawItemsMap.entries)
PopupMenuItem<String>(
key: ValueKey(fontFamily.key),
value: fontFamily.value,
height: options.itemHeight ?? kMinInteractiveDimension,
padding: options.itemPadding,
onTap: () {
if (fontFamily.value == 'Clear') {
controller.selectFontFamily(null);
return;
}
controller.selectFontFamily(fontFamily.value);
},
child: Text(
fontFamily.key.toString(),
style: TextStyle(
fontFamily:
options.renderFontFamilies ? fontFamily.value : null,
color: fontFamily.value == 'Clear'
? options.defaultItemColor
: null,
), ),
), ),
), ],
], child: Builder(
position: position, builder: (context) {
shape: popupMenuTheme.shape, final isMaterial3 = Theme.of(context).useMaterial3;
color: popupMenuTheme.color, if (!isMaterial3) {
return RawMaterialButton(
onPressed: _onPressed,
child: _buildContent(context),
);
}
return QuillToolbarIconButton(
isSelected: false,
iconTheme: iconTheme?.copyWith(
iconButtonSelectedData: const IconButtonData(
visualDensity: VisualDensity.compact,
),
iconButtonUnselectedData: const IconButtonData(
visualDensity: VisualDensity.compact,
),
),
onPressed: _onPressed,
icon: _buildContent(context),
);
},
),
),
); );
if (!mounted) {
return;
}
if (newValue == null) {
return;
}
final keyName = _getKeyName(newValue);
setState(() {
if (keyName != 'Clear') {
_currentValue = keyName ?? _defaultDisplayText;
} else {
_currentValue = _defaultDisplayText;
}
if (keyName != null) {
controller.formatSelection(
Attribute.fromKeyValue(
Attribute.font.key,
newValue == 'Clear' ? null : newValue,
),
);
options.onSelected?.call(newValue);
}
});
} }
Widget _buildContent(BuildContext context) { Widget _buildContent(BuildContext context) {

@ -106,7 +106,7 @@ class QuillToolbarFontSizeButtonState
final baseIconFactor = final baseIconFactor =
context.quillToolbarBaseButtonOptions?.globalIconButtonFactor; context.quillToolbarBaseButtonOptions?.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor; final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor; return iconButtonFactor ?? baseIconFactor ?? kDefaultIconButtonFactor;
} }
VoidCallback? get afterButtonPressed { VoidCallback? get afterButtonPressed {
@ -141,12 +141,7 @@ class QuillToolbarFontSizeButtonState
options.childBuilder ?? baseButtonConfigurations?.childBuilder; options.childBuilder ?? baseButtonConfigurations?.childBuilder;
if (childBuilder != null) { if (childBuilder != null) {
return childBuilder( return childBuilder(
options.copyWith( options,
tooltip: tooltip,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
afterButtonPressed: afterButtonPressed,
),
QuillToolbarFontSizeButtonExtraOptions( QuillToolbarFontSizeButtonExtraOptions(
controller: controller, controller: controller,
currentValue: _currentValue, currentValue: _currentValue,

@ -63,7 +63,7 @@ class QuillToolbarSelectHeaderStyleButtonsState
double get iconButtonFactor { double get iconButtonFactor {
final baseIconFactor = baseButtonExtraOptions?.globalIconButtonFactor; final baseIconFactor = baseButtonExtraOptions?.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor; final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor; return iconButtonFactor ?? baseIconFactor ?? kDefaultIconButtonFactor;
} }
VoidCallback? get afterButtonPressed { VoidCallback? get afterButtonPressed {

@ -99,7 +99,7 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState
final baseIconFactor = final baseIconFactor =
context.quillToolbarBaseButtonOptions?.globalIconButtonFactor; context.quillToolbarBaseButtonOptions?.globalIconButtonFactor;
final iconButtonFactor = widget.options.iconButtonFactor; final iconButtonFactor = widget.options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor; return iconButtonFactor ?? baseIconFactor ?? kDefaultIconButtonFactor;
} }
QuillIconTheme? get iconTheme { QuillIconTheme? get iconTheme {
@ -113,9 +113,6 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState
Attribute.h1, Attribute.h1,
Attribute.h2, Attribute.h2,
Attribute.h3, Attribute.h3,
Attribute.h4,
Attribute.h5,
Attribute.h6,
Attribute.header, Attribute.header,
]; ];
} }
@ -147,11 +144,7 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState
widget.options.childBuilder ?? baseButtonConfigurations?.childBuilder; widget.options.childBuilder ?? baseButtonConfigurations?.childBuilder;
if (childBuilder != null) { if (childBuilder != null) {
return childBuilder( return childBuilder(
widget.options.copyWith( widget.options,
iconSize: iconSize,
iconTheme: iconTheme,
afterButtonPressed: afterButtonPressed,
),
QuillToolbarSelectHeaderStyleDropdownButtonExtraOptions( QuillToolbarSelectHeaderStyleDropdownButtonExtraOptions(
currentValue: _selectedItem, currentValue: _selectedItem,
context: context, context: context,

@ -68,7 +68,7 @@ class QuillToolbarHistoryButtonState extends State<QuillToolbarHistoryButton> {
kDefaultIconSize; kDefaultIconSize;
final iconButtonFactor = options.iconButtonFactor ?? final iconButtonFactor = options.iconButtonFactor ??
baseButtonConfigurations?.globalIconButtonFactor ?? baseButtonConfigurations?.globalIconButtonFactor ??
kIconButtonFactor; kDefaultIconButtonFactor;
final iconTheme = options.iconTheme ?? baseButtonConfigurations?.iconTheme; final iconTheme = options.iconTheme ?? baseButtonConfigurations?.iconTheme;
final afterButtonPressed = options.afterButtonPressed ?? final afterButtonPressed = options.afterButtonPressed ??
@ -76,14 +76,7 @@ class QuillToolbarHistoryButtonState extends State<QuillToolbarHistoryButton> {
if (childBuilder != null) { if (childBuilder != null) {
return childBuilder( return childBuilder(
QuillToolbarHistoryButtonOptions( options,
afterButtonPressed: afterButtonPressed,
iconData: iconData,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
iconTheme: iconTheme,
tooltip: tooltip,
),
QuillToolbarHistoryButtonExtraOptions( QuillToolbarHistoryButtonExtraOptions(
onPressed: () { onPressed: () {
_updateHistory(); _updateHistory();

@ -43,7 +43,7 @@ class QuillToolbarIndentButtonState extends State<QuillToolbarIndentButton> {
double get iconButtonFactor { double get iconButtonFactor {
final baseIconFactor = baseButtonExtraOptions?.globalIconButtonFactor; final baseIconFactor = baseButtonExtraOptions?.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor; final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor; return iconButtonFactor ?? baseIconFactor ?? kDefaultIconButtonFactor;
} }
VoidCallback? get afterButtonPressed { VoidCallback? get afterButtonPressed {
@ -86,14 +86,7 @@ class QuillToolbarIndentButtonState extends State<QuillToolbarIndentButton> {
if (childBuilder != null) { if (childBuilder != null) {
return childBuilder( return childBuilder(
QuillToolbarIndentButtonOptions( options,
afterButtonPressed: afterButtonPressed,
iconData: iconData,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
iconTheme: iconTheme,
tooltip: tooltip,
),
QuillToolbarIndentButtonExtraOptions( QuillToolbarIndentButtonExtraOptions(
controller: controller, controller: controller,
context: context, context: context,

@ -78,7 +78,7 @@ class _QuillToolbarLinkStyleButton2State
double get iconButtonFactor { double get iconButtonFactor {
final baseIconFactor = baseButtonExtraOptions?.globalIconButtonFactor; final baseIconFactor = baseButtonExtraOptions?.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor; final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor; return iconButtonFactor ?? baseIconFactor ?? kDefaultIconButtonFactor;
} }
VoidCallback? get afterButtonPressed { VoidCallback? get afterButtonPressed {
@ -116,24 +116,7 @@ class _QuillToolbarLinkStyleButton2State
options.childBuilder ?? baseButtonExtraOptions?.childBuilder; options.childBuilder ?? baseButtonExtraOptions?.childBuilder;
if (childBuilder != null) { if (childBuilder != null) {
return childBuilder( return childBuilder(
QuillToolbarLinkStyleButton2Options( options,
iconData: iconData,
addLinkLabel: options.addLinkLabel,
afterButtonPressed: options.afterButtonPressed,
autovalidateMode: options.autovalidateMode,
buttonSize: options.buttonSize,
childrenSpacing: options.childrenSpacing,
dialogBarrierColor: dialogBarrierColor,
dialogTheme: options.dialogTheme,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
constraints: options.constraints,
tooltip: tooltip,
iconTheme: iconTheme,
editLinkLabel: options.editLinkLabel,
validationMessage: options.validationMessage,
linkColor: options.linkColor,
),
QuillToolbarLinkStyleButton2ExtraOptions( QuillToolbarLinkStyleButton2ExtraOptions(
controller: controller, controller: controller,
context: context, context: context,

@ -71,7 +71,7 @@ class QuillToolbarLinkStyleButtonState
double get iconButtonFactor { double get iconButtonFactor {
final baseIconFactor = baseButtonExtraOptions?.globalIconButtonFactor; final baseIconFactor = baseButtonExtraOptions?.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor; final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor; return iconButtonFactor ?? baseIconFactor ?? kDefaultIconButtonFactor;
} }
VoidCallback? get afterButtonPressed { VoidCallback? get afterButtonPressed {
@ -115,18 +115,7 @@ class QuillToolbarLinkStyleButtonState
options.childBuilder ?? baseButtonExtraOptions?.childBuilder; options.childBuilder ?? baseButtonExtraOptions?.childBuilder;
if (childBuilder != null) { if (childBuilder != null) {
return childBuilder( return childBuilder(
QuillToolbarLinkStyleButtonOptions( options,
afterButtonPressed: afterButtonPressed,
dialogBarrierColor: dialogBarrierColor,
dialogTheme: options.dialogTheme,
iconData: iconData,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
tooltip: tooltip,
linkDialogAction: options.linkDialogAction,
linkRegExp: linkRegExp,
iconTheme: iconTheme,
),
QuillToolbarLinkStyleButtonExtraOptions( QuillToolbarLinkStyleButtonExtraOptions(
context: context, context: context,
controller: controller, controller: controller,

@ -32,7 +32,7 @@ class QuillToolbarSearchButton extends StatelessWidget {
final baseIconFactor = final baseIconFactor =
baseButtonExtraOptions(context)?.globalIconButtonFactor; baseButtonExtraOptions(context)?.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor; final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor; return iconButtonFactor ?? baseIconFactor ?? kDefaultIconButtonFactor;
} }
VoidCallback? _afterButtonPressed(BuildContext context) { VoidCallback? _afterButtonPressed(BuildContext context) {
@ -85,17 +85,7 @@ class QuillToolbarSearchButton extends StatelessWidget {
if (childBuilder != null) { if (childBuilder != null) {
return childBuilder( return childBuilder(
QuillToolbarSearchButtonOptions( options,
afterButtonPressed: afterButtonPressed,
dialogBarrierColor: _dialogBarrierColor(context),
dialogTheme: _dialogTheme(context),
fillColor: options.fillColor,
iconData: iconData,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
tooltip: tooltip,
iconTheme: iconTheme,
),
QuillToolbarSearchButtonExtraOptions( QuillToolbarSearchButtonExtraOptions(
controller: controller, controller: controller,
context: context, context: context,

@ -94,7 +94,7 @@ class QuillToolbarToggleCheckListButtonState
double get iconButtonFactor { double get iconButtonFactor {
final baseIconFactor = baseButtonExtraOptions?.globalIconButtonFactor; final baseIconFactor = baseButtonExtraOptions?.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor; final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor; return iconButtonFactor ?? baseIconFactor ?? kDefaultIconButtonFactor;
} }
VoidCallback? get afterButtonPressed { VoidCallback? get afterButtonPressed {
@ -128,14 +128,7 @@ class QuillToolbarToggleCheckListButtonState
options.childBuilder ?? baseButtonExtraOptions?.childBuilder; options.childBuilder ?? baseButtonExtraOptions?.childBuilder;
if (childBuilder != null) { if (childBuilder != null) {
return childBuilder( return childBuilder(
QuillToolbarToggleCheckListButtonOptions( options,
afterButtonPressed: afterButtonPressed,
iconTheme: iconTheme,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
tooltip: tooltip,
iconData: iconData,
),
QuillToolbarToggleCheckListButtonExtraOptions( QuillToolbarToggleCheckListButtonExtraOptions(
context: context, context: context,
controller: controller, controller: controller,

@ -71,7 +71,7 @@ class QuillToolbarToggleStyleButtonState
final baseIconFactor = final baseIconFactor =
context.quillToolbarBaseButtonOptions?.globalIconButtonFactor; context.quillToolbarBaseButtonOptions?.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor; final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor ?? kIconButtonFactor; return iconButtonFactor ?? baseIconFactor ?? kDefaultIconButtonFactor;
} }
VoidCallback? get afterButtonPressed { VoidCallback? get afterButtonPressed {
@ -157,15 +157,7 @@ class QuillToolbarToggleStyleButtonState
context.quillToolbarBaseButtonOptions?.childBuilder; context.quillToolbarBaseButtonOptions?.childBuilder;
if (childBuilder != null) { if (childBuilder != null) {
return childBuilder( return childBuilder(
QuillToolbarToggleStyleButtonOptions( options,
afterButtonPressed: options.afterButtonPressed,
fillColor: options.fillColor,
iconButtonFactor: options.iconButtonFactor,
iconData: iconData,
iconSize: iconSize,
tooltip: tooltip,
iconTheme: iconTheme,
),
QuillToolbarToggleStyleButtonExtraOptions( QuillToolbarToggleStyleButtonExtraOptions(
context: context, context: context,
controller: controller, controller: controller,
@ -244,7 +236,7 @@ Widget defaultToggleStyleButtonBuilder(
VoidCallback? onPressed, VoidCallback? onPressed,
VoidCallback? afterPressed, [ VoidCallback? afterPressed, [
double iconSize = kDefaultIconSize, double iconSize = kDefaultIconSize,
double iconButtonFactor = kIconButtonFactor, double iconButtonFactor = kDefaultIconButtonFactor,
QuillIconTheme? iconTheme, QuillIconTheme? iconTheme,
]) { ]) {
final isEnabled = onPressed != null; final isEnabled = onPressed != null;

@ -365,8 +365,8 @@ class QuillSimpleToolbar extends StatelessWidget
@override @override
Size get preferredSize => configurations.axis == Axis.horizontal Size get preferredSize => configurations.axis == Axis.horizontal
? const Size.fromHeight(defaultToolbarSize) ? const Size.fromHeight(kDefaultToolbarSize)
: const Size.fromWidth(defaultToolbarSize); : const Size.fromWidth(kDefaultToolbarSize);
} }
/// The divider which is used for separation of buttons in the toolbar. /// The divider which is used for separation of buttons in the toolbar.

Loading…
Cancel
Save