diff --git a/lib/src/models/config/toolbar/buttons/font_family_configurations.dart b/lib/src/models/config/toolbar/buttons/font_family_configurations.dart index 5674232c..74b9f35b 100644 --- a/lib/src/models/config/toolbar/buttons/font_family_configurations.dart +++ b/lib/src/models/config/toolbar/buttons/font_family_configurations.dart @@ -50,17 +50,10 @@ class QuillToolbarFontFamilyButtonOptions extends QuillToolbarBaseButtonOptions< this.itemPadding, this.defaultItemColor = Colors.red, this.renderFontFamilies = true, - this.highlightElevation = 1, - this.hoverElevation = 1, - this.fillColor, this.iconSize, this.iconButtonFactor, }); - final Color? fillColor; - final double hoverElevation; - final double highlightElevation; - /// By default it will be [fontFamilyValues] from [QuillSimpleToolbarConfigurations] /// You can override this if you want final Map? rawItemsMap; @@ -83,9 +76,6 @@ class QuillToolbarFontFamilyButtonOptions extends QuillToolbarBaseButtonOptions< final double? iconButtonFactor; QuillToolbarFontFamilyButtonOptions copyWith({ - Color? fillColor, - double? hoverElevation, - double? highlightElevation, List>? items, Map? rawItemsMap, ValueChanged? onSelected, @@ -131,9 +121,6 @@ class QuillToolbarFontFamilyButtonOptions extends QuillToolbarBaseButtonOptions< defaultItemColor: defaultItemColor ?? this.defaultItemColor, iconSize: iconSize ?? this.iconSize, iconButtonFactor: iconButtonFactor ?? this.iconButtonFactor, - fillColor: fillColor ?? this.fillColor, - hoverElevation: hoverElevation ?? this.hoverElevation, - highlightElevation: highlightElevation ?? this.highlightElevation, ); } } diff --git a/lib/src/widgets/quill/quill_controller.dart b/lib/src/widgets/quill/quill_controller.dart index fd340300..f9f89f6a 100644 --- a/lib/src/widgets/quill/quill_controller.dart +++ b/lib/src/widgets/quill/quill_controller.dart @@ -59,6 +59,14 @@ class QuillController extends ChangeNotifier { notifyListeners(); } + /// The current font family, null to use the default one + String? _selectedFontFamily; + String? get selectedFontFamily => _selectedFontFamily; + + void selectFontFamily(String newFontFamily) { + _selectedFontFamily = selectedFontFamily; + } + /// Tells whether to keep or reset the [toggledStyle] /// when user adds a new line. final bool _keepStyleOnNewLine; diff --git a/lib/src/widgets/toolbar/buttons/font_family_button.dart b/lib/src/widgets/toolbar/buttons/font_family_button.dart index 8714d6fa..edc115d2 100644 --- a/lib/src/widgets/toolbar/buttons/font_family_button.dart +++ b/lib/src/widgets/toolbar/buttons/font_family_button.dart @@ -184,17 +184,19 @@ class QuillToolbarFontFamilyButtonState } return Tooltip(message: effectiveTooltip, child: child); }, - child: RawMaterialButton( + child: IconButton( + // tooltip: '', // TODO: Use this here visualDensity: VisualDensity.compact, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(iconTheme?.borderRadius ?? 2), + style: IconButton.styleFrom( + shape: iconTheme?.borderRadius != null + ? RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(iconTheme?.borderRadius ?? -1), + ) + : null, ), - fillColor: options.fillColor, - elevation: 0, - hoverElevation: options.hoverElevation, - highlightElevation: options.hoverElevation, onPressed: _onPressed, - child: _buildContent(context), + icon: _buildContent(context), ), ), ); @@ -222,6 +224,9 @@ class QuillToolbarFontFamilyButtonState value: fontFamily.value, height: options.itemHeight ?? kMinInteractiveDimension, padding: options.itemPadding, + onTap: () { + controller.selectFontFamily(fontFamily.value); + }, child: Text( fontFamily.key.toString(), style: TextStyle(