Restore feel&look for font families and font sizes

pull/1633/head
Aleksei 1 year ago
parent 3cf012c2d6
commit 208c05e6b0
  1. 32
      lib/src/widgets/toolbar/buttons/font_family_button.dart
  2. 31
      lib/src/widgets/toolbar/buttons/font_size_button.dart

@ -165,6 +165,9 @@ class QuillToolbarFontFamilyButtonState
), ),
); );
} }
final borderRadius = BorderRadius.circular(iconTheme?.borderRadius ?? 2);
return ConstrainedBox( return ConstrainedBox(
constraints: BoxConstraints.tightFor( constraints: BoxConstraints.tightFor(
height: iconSize * 1.81, height: iconSize * 1.81,
@ -181,30 +184,25 @@ class QuillToolbarFontFamilyButtonState
} }
return Tooltip(message: effectiveTooltip, child: child); return Tooltip(message: effectiveTooltip, child: child);
}, },
child: Builder( child: Theme.of(context).useMaterial3
builder: (context) { ? IconButton(
final isMaterial3 = Theme.of(context).useMaterial3;
if (!isMaterial3) {
return RawMaterialButton(
onPressed: _onPressed,
child: _buildContent(context),
);
}
return IconButton(
// tooltip: , // TODO: Use this here
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
style: IconButton.styleFrom( style: IconButton.styleFrom(
shape: iconTheme?.borderRadius != null shape: iconTheme?.borderRadius != null
? RoundedRectangleBorder( ? RoundedRectangleBorder(borderRadius: borderRadius)
borderRadius: BorderRadius.circular(
iconTheme?.borderRadius ?? -1),
)
: null, : null,
), ),
onPressed: _onPressed, onPressed: _onPressed,
icon: _buildContent(context), icon: _buildContent(context),
); )
}, : RawMaterialButton(
visualDensity: VisualDensity.compact,
shape: RoundedRectangleBorder(borderRadius: borderRadius),
elevation: 0,
hoverElevation: 0,
highlightElevation: 0,
onPressed: _onPressed,
child: _buildContent(context),
), ),
), ),
); );

@ -136,35 +136,34 @@ class QuillToolbarFontSizeButtonState
), ),
); );
} }
final borderRadius = BorderRadius.circular(iconTheme?.borderRadius ?? 2);
return ConstrainedBox( return ConstrainedBox(
constraints: BoxConstraints.tightFor( constraints: BoxConstraints.tightFor(
height: iconSize * 1.81, height: iconSize * 1.81,
width: options.width, width: options.width,
), ),
child: Builder( child: Theme.of(context).useMaterial3
builder: (context) { ? IconButton(
final isMaterial3 = Theme.of(context).useMaterial3;
if (!isMaterial3) {
return RawMaterialButton(
onPressed: _onPressed,
child: _buildContent(context),
);
}
return IconButton(
tooltip: tooltip, tooltip: tooltip,
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
style: IconButton.styleFrom( style: IconButton.styleFrom(
shape: iconTheme?.borderRadius != null shape: iconTheme?.borderRadius != null
? RoundedRectangleBorder( ? RoundedRectangleBorder(borderRadius: borderRadius)
borderRadius:
BorderRadius.circular(iconTheme?.borderRadius ?? -1),
)
: null, : null,
), ),
onPressed: _onPressed, onPressed: _onPressed,
icon: _buildContent(context), icon: _buildContent(context),
); )
}, : RawMaterialButton(
visualDensity: VisualDensity.compact,
shape: RoundedRectangleBorder(borderRadius: borderRadius),
elevation: 0,
hoverElevation: 0,
highlightElevation: 0,
onPressed: _onPressed,
child: _buildContent(context),
), ),
); );
} }

Loading…
Cancel
Save