Font size widget now respects iconTheme color and iconSize (#797)

pull/800/head
mark8044 3 years ago committed by GitHub
parent 31dc6c80bf
commit 5eda9d8663
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      lib/src/widgets/toolbar.dart
  2. 15
      lib/src/widgets/toolbar/quill_dropdown_button.dart

@ -193,7 +193,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
if (showFontSize) if (showFontSize)
QuillDropdownButton( QuillDropdownButton(
iconTheme: iconTheme, iconTheme: iconTheme,
height: (toolbarIconSize * 2) - (toolbarIconSize / 3), iconSize: toolbarIconSize,
items: [ items: [
for (MapEntry<String, int> fontSize in fontSizes.entries) for (MapEntry<String, int> fontSize in fontSizes.entries)
PopupMenuItem<int>( PopupMenuItem<int>(

@ -7,7 +7,7 @@ class QuillDropdownButton<T> extends StatefulWidget {
required this.items, required this.items,
required this.rawitemsmap, required this.rawitemsmap,
required this.onSelected, required this.onSelected,
this.height = 40, this.iconSize = 40,
this.fillColor, this.fillColor,
this.hoverElevation = 1, this.hoverElevation = 1,
this.highlightElevation = 1, this.highlightElevation = 1,
@ -15,7 +15,7 @@ class QuillDropdownButton<T> extends StatefulWidget {
Key? key, Key? key,
}) : super(key: key); }) : super(key: key);
final double height; final double iconSize;
final Color? fillColor; final Color? fillColor;
final double hoverElevation; final double hoverElevation;
final double highlightElevation; final double highlightElevation;
@ -43,7 +43,7 @@ class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ConstrainedBox( return ConstrainedBox(
constraints: BoxConstraints.tightFor(height: widget.height), constraints: BoxConstraints.tightFor(height: (widget.iconSize * 1.81)),
child: RawMaterialButton( child: RawMaterialButton(
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@ -100,14 +100,15 @@ class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
} }
Widget _buildContent(BuildContext context) { Widget _buildContent(BuildContext context) {
final theme = Theme.of(context);
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10), padding: const EdgeInsets.fromLTRB(10,0,0,0),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text(_currentValue.toString()), Text(_currentValue.toString(), style: TextStyle(fontSize: widget.iconSize / 1.15, color: widget.iconTheme?.iconUnselectedColor ?? theme.iconTheme.color)),
SizedBox(width: 6), SizedBox(width: widget.iconSize / 3.83),
const Icon(Icons.arrow_drop_down, size: 17) Icon(Icons.arrow_drop_down, size: widget.iconSize / 1.15, color: widget.iconTheme?.iconUnselectedColor ?? theme.iconTheme.color)
], ],
), ),
); );

Loading…
Cancel
Save