Restore feel&look for font families and font sizes

pull/1633/head
Aleksei 1 year ago
parent 3cf012c2d6
commit 208c05e6b0
  1. 42
      lib/src/widgets/toolbar/buttons/font_family_button.dart
  2. 43
      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,31 +184,26 @@ 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; visualDensity: VisualDensity.compact,
if (!isMaterial3) { style: IconButton.styleFrom(
return RawMaterialButton( 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, onPressed: _onPressed,
child: _buildContent(context), 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),
);
},
),
), ),
); );
} }

@ -136,36 +136,35 @@ 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; tooltip: tooltip,
if (!isMaterial3) { visualDensity: VisualDensity.compact,
return RawMaterialButton( 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, onPressed: _onPressed,
child: _buildContent(context), 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),
);
},
),
); );
} }

Loading…
Cancel
Save