fix: pass iconButtonFactor to childBuilder

pull/1515/head
Adil Hanney 1 year ago
parent 33afa7060a
commit 05836c8aa8
  1. 1
      flutter_quill_extensions/lib/presentation/embeds/toolbar/camera_button/camera_button.dart
  2. 9
      flutter_quill_extensions/lib/presentation/embeds/toolbar/formula_button.dart
  3. 9
      flutter_quill_extensions/lib/presentation/embeds/toolbar/image_button/image_button.dart
  4. 1
      flutter_quill_extensions/lib/presentation/embeds/toolbar/media_button/media_button.dart
  5. 1
      flutter_quill_extensions/lib/presentation/embeds/toolbar/video_button/video_button.dart
  6. 2
      flutter_quill_extensions/lib/presentation/models/config/toolbar/buttons/camera.dart
  7. 2
      flutter_quill_extensions/lib/presentation/models/config/toolbar/buttons/formula.dart
  8. 2
      flutter_quill_extensions/lib/presentation/models/config/toolbar/buttons/image.dart
  9. 2
      flutter_quill_extensions/lib/presentation/models/config/toolbar/buttons/video.dart
  10. 2
      flutter_quill_extensions/pubspec.yaml
  11. 4
      lib/src/models/config/toolbar/buttons/font_family.dart
  12. 4
      lib/src/models/config/toolbar/buttons/font_size.dart
  13. 1
      lib/src/widgets/toolbar/buttons/clear_format.dart
  14. 8
      lib/src/widgets/toolbar/buttons/font_size.dart
  15. 1
      lib/src/widgets/toolbar/buttons/history.dart
  16. 1
      lib/src/widgets/toolbar/buttons/indent.dart
  17. 1
      lib/src/widgets/toolbar/buttons/link_style.dart
  18. 1
      lib/src/widgets/toolbar/buttons/link_style2.dart
  19. 9
      lib/src/widgets/toolbar/buttons/search/search.dart
  20. 1
      lib/src/widgets/toolbar/buttons/select_alignment.dart
  21. 1
      lib/src/widgets/toolbar/buttons/select_header_style.dart
  22. 1
      lib/src/widgets/toolbar/buttons/toggle_check_list.dart

@ -77,6 +77,7 @@ class QuillToolbarCameraButton extends StatelessWidget {
iconData: options.iconData,
fillColor: options.fillColor,
iconSize: options.iconSize,
iconButtonFactor: options.iconButtonFactor,
iconTheme: options.iconTheme,
tooltip: options.tooltip,
cameraConfigurations: options.cameraConfigurations,

@ -19,6 +19,13 @@ class QuillToolbarFormulaButton extends StatelessWidget {
return iconSize ?? baseFontSize;
}
double _iconButtonFactor(BuildContext context) {
final baseIconFactor =
baseButtonExtraOptions(context).globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor;
}
VoidCallback? _afterButtonPressed(BuildContext context) {
return options.afterButtonPressed ??
baseButtonExtraOptions(context).afterButtonPressed;
@ -58,6 +65,7 @@ class QuillToolbarFormulaButton extends StatelessWidget {
final tooltip = _tooltip(context);
final iconSize = _iconSize(context);
final iconButtonFactor = _iconButtonFactor(context);
final iconData = _iconData(context);
final childBuilder =
options.childBuilder ?? baseButtonExtraOptions(context).childBuilder;
@ -73,6 +81,7 @@ class QuillToolbarFormulaButton extends StatelessWidget {
fillColor: iconFillColor,
iconData: iconData,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
iconTheme: iconTheme,
tooltip: tooltip,
),

@ -27,6 +27,13 @@ class QuillToolbarImageButton extends StatelessWidget {
return iconSize ?? baseFontSize;
}
double _iconButtonFactor(BuildContext context) {
final baseIconFactor =
baseButtonExtraOptions(context).globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor;
}
VoidCallback? _afterButtonPressed(BuildContext context) {
return options.afterButtonPressed ??
baseButtonExtraOptions(context).afterButtonPressed;
@ -62,6 +69,7 @@ class QuillToolbarImageButton extends StatelessWidget {
Widget build(BuildContext context) {
final tooltip = _tooltip(context);
final iconSize = _iconSize(context);
final iconButtonFactor = _iconButtonFactor(context);
final iconData = _iconData(context);
final childBuilder =
options.childBuilder ?? baseButtonExtraOptions(context).childBuilder;
@ -72,6 +80,7 @@ class QuillToolbarImageButton extends StatelessWidget {
afterButtonPressed: _afterButtonPressed(context),
iconData: iconData,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
dialogTheme: options.dialogTheme,
fillColor: options.fillColor,
iconTheme: options.iconTheme,

@ -102,6 +102,7 @@
// galleryButtonText: options.galleryButtonText,
// iconTheme: iconTheme,
// iconSize: iconSize,
// iconButtonFactor: iconButtonFactor,
// hintText: options.hintText,
// labelText: options.labelText,
// submitButtonSize: options.submitButtonSize,

@ -82,6 +82,7 @@ class QuillToolbarVideoButton extends StatelessWidget {
dialogTheme: options.dialogTheme,
fillColor: iconFillColor,
iconSize: options.iconSize,
iconButtonFactor: options.iconButtonFactor,
linkRegExp: options.linkRegExp,
tooltip: options.tooltip,
iconTheme: options.iconTheme,

@ -17,6 +17,7 @@ class QuillToolbarCameraButtonOptions extends QuillToolbarBaseButtonOptions<
const QuillToolbarCameraButtonOptions({
this.cameraConfigurations = const QuillToolbarCameraConfigurations(),
this.iconSize,
this.iconButtonFactor,
this.fillColor,
super.iconData,
super.afterButtonPressed,
@ -27,6 +28,7 @@ class QuillToolbarCameraButtonOptions extends QuillToolbarBaseButtonOptions<
});
final double? iconSize;
final double? iconButtonFactor;
final Color? fillColor;

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

@ -20,6 +20,7 @@ class QuillToolbarImageButtonOptions extends QuillToolbarBaseButtonOptions<
super.iconData,
super.controller,
this.iconSize,
this.iconButtonFactor,
/// specifies the tooltip text for the image button.
super.tooltip,
@ -33,6 +34,7 @@ class QuillToolbarImageButtonOptions extends QuillToolbarBaseButtonOptions<
});
final double? iconSize;
final double? iconButtonFactor;
final Color? fillColor;
final QuillDialogTheme? dialogTheme;

@ -19,6 +19,7 @@ class QuillToolbarVideoButtonOptions extends QuillToolbarBaseButtonOptions<
this.dialogTheme,
this.fillColor,
this.iconSize,
this.iconButtonFactor,
super.iconData,
super.afterButtonPressed,
super.tooltip,
@ -35,4 +36,5 @@ class QuillToolbarVideoButtonOptions extends QuillToolbarBaseButtonOptions<
final Color? fillColor;
final double? iconSize;
final double? iconButtonFactor;
}

@ -26,7 +26,7 @@ dependencies:
flutter:
sdk: flutter
flutter_quill: ^8.2.5
flutter_quill: ^8.3.0
http: ^1.1.0
photo_view: ^0.14.0

@ -55,6 +55,7 @@ class QuillToolbarFontFamilyButtonOptions extends QuillToolbarBaseButtonOptions<
this.hoverElevation = 1,
this.fillColor,
this.iconSize,
this.iconButtonFactor,
});
final Color? fillColor;
@ -82,6 +83,7 @@ class QuillToolbarFontFamilyButtonOptions extends QuillToolbarBaseButtonOptions<
/// By default will use [globalIconSize]
final double? iconSize;
final double? iconButtonFactor;
QuillToolbarFontFamilyButtonOptions copyWith({
Color? fillColor,
@ -102,6 +104,7 @@ class QuillToolbarFontFamilyButtonOptions extends QuillToolbarBaseButtonOptions<
EdgeInsets? itemPadding,
Color? defaultItemColor,
double? iconSize,
double? iconButtonFactor,
// Add properties to override inherited properties
QuillController? controller,
IconData? iconData,
@ -130,6 +133,7 @@ class QuillToolbarFontFamilyButtonOptions extends QuillToolbarBaseButtonOptions<
itemPadding: itemPadding ?? this.itemPadding,
defaultItemColor: defaultItemColor ?? this.defaultItemColor,
iconSize: iconSize ?? this.iconSize,
iconButtonFactor: iconButtonFactor ?? this.iconButtonFactor,
fillColor: fillColor ?? this.fillColor,
hoverElevation: hoverElevation ?? this.hoverElevation,
highlightElevation: highlightElevation ?? this.highlightElevation,

@ -30,6 +30,7 @@ class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions<
QuillToolbarFontSizeButtonOptions, QuillToolbarFontSizeButtonExtraOptions> {
const QuillToolbarFontSizeButtonOptions({
this.iconSize,
this.iconButtonFactor,
this.fillColor,
this.hoverElevation = 1,
this.highlightElevation = 1,
@ -53,6 +54,7 @@ class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions<
});
final double? iconSize;
final double? iconButtonFactor;
final Color? fillColor;
final double hoverElevation;
final double highlightElevation;
@ -75,6 +77,7 @@ class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions<
QuillToolbarFontSizeButtonOptions copyWith({
double? iconSize,
double? iconButtonFactor,
Color? fillColor,
double? hoverElevation,
double? highlightElevation,
@ -97,6 +100,7 @@ class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions<
}) {
return QuillToolbarFontSizeButtonOptions(
iconSize: iconSize ?? this.iconSize,
iconButtonFactor: iconButtonFactor ?? this.iconButtonFactor,
fillColor: fillColor ?? this.fillColor,
hoverElevation: hoverElevation ?? this.hoverElevation,
highlightElevation: highlightElevation ?? this.highlightElevation,

@ -90,6 +90,7 @@ class QuillToolbarClearFormatButton extends StatelessWidget {
controller: controller,
iconData: iconData,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
iconTheme: iconTheme,
tooltip: tooltip,
),

@ -110,6 +110,13 @@ class QuillToolbarFontSizeButtonState
return iconSize ?? baseFontSize;
}
double get iconButtonFactor {
final baseIconFactor =
context.requireQuillToolbarBaseButtonOptions.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor;
}
VoidCallback? get afterButtonPressed {
return options.afterButtonPressed ??
context.requireQuillToolbarBaseButtonOptions.afterButtonPressed;
@ -142,6 +149,7 @@ class QuillToolbarFontSizeButtonState
options.copyWith(
tooltip: tooltip,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
iconTheme: iconTheme,
afterButtonPressed: afterButtonPressed,
controller: controller,

@ -76,6 +76,7 @@ class QuillToolbarHistoryButtonState extends State<QuillToolbarHistoryButton> {
controller: controller,
iconData: iconData,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
iconTheme: iconTheme,
tooltip: tooltip,
),

@ -88,6 +88,7 @@ class QuillToolbarIndentButtonState extends State<QuillToolbarIndentButton> {
afterButtonPressed: afterButtonPressed,
iconData: iconData,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
iconTheme: iconTheme,
tooltip: tooltip,
),

@ -120,6 +120,7 @@ class QuillToolbarLinkStyleButtonState
dialogTheme: options.dialogTheme,
iconData: iconData,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
tooltip: tooltip,
linkDialogAction: options.linkDialogAction,
linkRegExp: linkRegExp,

@ -125,6 +125,7 @@ class _QuillToolbarLinkStyleButton2State
dialogBarrierColor: dialogBarrierColor,
dialogTheme: options.dialogTheme,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
constraints: options.constraints,
tooltip: tooltip,
iconTheme: iconTheme,

@ -89,10 +89,11 @@ class QuillToolbarSearchButton extends StatelessWidget {
dialogBarrierColor: _dialogBarrierColor(context),
dialogTheme: _dialogTheme(context),
fillColor: options.fillColor,
iconData: _iconData(context),
iconSize: _iconSize(context),
tooltip: _tooltip(context),
iconTheme: _iconTheme(context),
iconData: iconData,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
tooltip: tooltip,
iconTheme: iconTheme,
),
QuillToolbarSearchButtonExtraOptions(
controller: controller,

@ -214,6 +214,7 @@ class QuillToolbarSelectAlignmentButtonState
QuillToolbarSelectAlignmentButtonOptions(
afterButtonPressed: _afterButtonPressed,
iconSize: _iconSize,
iconButtonFactor: _iconButtonFactor,
iconTheme: _iconTheme,
tooltips: _tooltips,
iconsData: _iconsData,

@ -132,6 +132,7 @@ class QuillToolbarSelectHeaderStyleButtonsState
attributes: _attrbuites,
axis: axis,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
iconTheme: iconTheme,
tooltip: tooltip,
),

@ -135,6 +135,7 @@ class QuillToolbarToggleCheckListButtonState
iconTheme: iconTheme,
controller: controller,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
tooltip: tooltip,
iconData: iconData,
),

Loading…
Cancel
Save