diff --git a/lib/src/widgets/toolbar/buttons/font_family_button.dart b/lib/src/widgets/toolbar/buttons/font_family_button.dart index 7153034d..468b714b 100644 --- a/lib/src/widgets/toolbar/buttons/font_family_button.dart +++ b/lib/src/widgets/toolbar/buttons/font_family_button.dart @@ -165,6 +165,9 @@ class QuillToolbarFontFamilyButtonState ), ); } + + final borderRadius = BorderRadius.circular(iconTheme?.borderRadius ?? 2); + return ConstrainedBox( constraints: BoxConstraints.tightFor( height: iconSize * 1.81, @@ -181,31 +184,26 @@ class QuillToolbarFontFamilyButtonState } return Tooltip(message: effectiveTooltip, child: child); }, - child: Builder( - builder: (context) { - final isMaterial3 = Theme.of(context).useMaterial3; - if (!isMaterial3) { - return RawMaterialButton( + child: Theme.of(context).useMaterial3 + ? IconButton( + visualDensity: VisualDensity.compact, + style: IconButton.styleFrom( + shape: iconTheme?.borderRadius != null + ? RoundedRectangleBorder(borderRadius: borderRadius) + : null, + ), + onPressed: _onPressed, + icon: _buildContent(context), + ) + : RawMaterialButton( + visualDensity: VisualDensity.compact, + shape: RoundedRectangleBorder(borderRadius: borderRadius), + elevation: 0, + hoverElevation: 0, + highlightElevation: 0, onPressed: _onPressed, child: _buildContent(context), - ); - } - return IconButton( - // tooltip: , // TODO: Use this here - visualDensity: VisualDensity.compact, - style: IconButton.styleFrom( - shape: iconTheme?.borderRadius != null - ? RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - iconTheme?.borderRadius ?? -1), - ) - : null, ), - onPressed: _onPressed, - icon: _buildContent(context), - ); - }, - ), ), ); } diff --git a/lib/src/widgets/toolbar/buttons/font_size_button.dart b/lib/src/widgets/toolbar/buttons/font_size_button.dart index 93062e84..6ec069c3 100644 --- a/lib/src/widgets/toolbar/buttons/font_size_button.dart +++ b/lib/src/widgets/toolbar/buttons/font_size_button.dart @@ -136,36 +136,35 @@ class QuillToolbarFontSizeButtonState ), ); } + + final borderRadius = BorderRadius.circular(iconTheme?.borderRadius ?? 2); + return ConstrainedBox( constraints: BoxConstraints.tightFor( height: iconSize * 1.81, width: options.width, ), - child: Builder( - builder: (context) { - final isMaterial3 = Theme.of(context).useMaterial3; - if (!isMaterial3) { - return RawMaterialButton( + child: Theme.of(context).useMaterial3 + ? IconButton( + tooltip: tooltip, + visualDensity: VisualDensity.compact, + style: IconButton.styleFrom( + shape: iconTheme?.borderRadius != null + ? RoundedRectangleBorder(borderRadius: borderRadius) + : null, + ), + onPressed: _onPressed, + icon: _buildContent(context), + ) + : RawMaterialButton( + visualDensity: VisualDensity.compact, + shape: RoundedRectangleBorder(borderRadius: borderRadius), + elevation: 0, + hoverElevation: 0, + highlightElevation: 0, onPressed: _onPressed, child: _buildContent(context), - ); - } - return IconButton( - tooltip: tooltip, - visualDensity: VisualDensity.compact, - style: IconButton.styleFrom( - shape: iconTheme?.borderRadius != null - ? RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(iconTheme?.borderRadius ?? -1), - ) - : null, ), - onPressed: _onPressed, - icon: _buildContent(context), - ); - }, - ), ); }