From 5eda9d8663bca919c8bafc51b702d295fa5692ea Mon Sep 17 00:00:00 2001 From: mark8044 <87546778+mark8044@users.noreply.github.com> Date: Fri, 6 May 2022 21:34:18 -0700 Subject: [PATCH] Font size widget now respects iconTheme color and iconSize (#797) --- lib/src/widgets/toolbar.dart | 2 +- .../widgets/toolbar/quill_dropdown_button.dart | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/src/widgets/toolbar.dart b/lib/src/widgets/toolbar.dart index 8d82718f..773c01c7 100644 --- a/lib/src/widgets/toolbar.dart +++ b/lib/src/widgets/toolbar.dart @@ -193,7 +193,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { if (showFontSize) QuillDropdownButton( iconTheme: iconTheme, - height: (toolbarIconSize * 2) - (toolbarIconSize / 3), + iconSize: toolbarIconSize, items: [ for (MapEntry fontSize in fontSizes.entries) PopupMenuItem( diff --git a/lib/src/widgets/toolbar/quill_dropdown_button.dart b/lib/src/widgets/toolbar/quill_dropdown_button.dart index cf2c652e..772f71e2 100644 --- a/lib/src/widgets/toolbar/quill_dropdown_button.dart +++ b/lib/src/widgets/toolbar/quill_dropdown_button.dart @@ -7,7 +7,7 @@ class QuillDropdownButton extends StatefulWidget { required this.items, required this.rawitemsmap, required this.onSelected, - this.height = 40, + this.iconSize = 40, this.fillColor, this.hoverElevation = 1, this.highlightElevation = 1, @@ -15,7 +15,7 @@ class QuillDropdownButton extends StatefulWidget { Key? key, }) : super(key: key); - final double height; + final double iconSize; final Color? fillColor; final double hoverElevation; final double highlightElevation; @@ -43,7 +43,7 @@ class _QuillDropdownButtonState extends State> { @override Widget build(BuildContext context) { return ConstrainedBox( - constraints: BoxConstraints.tightFor(height: widget.height), + constraints: BoxConstraints.tightFor(height: (widget.iconSize * 1.81)), child: RawMaterialButton( visualDensity: VisualDensity.compact, shape: RoundedRectangleBorder( @@ -100,14 +100,15 @@ class _QuillDropdownButtonState extends State> { } Widget _buildContent(BuildContext context) { + final theme = Theme.of(context); return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10), + padding: const EdgeInsets.fromLTRB(10,0,0,0), child: Row( mainAxisSize: MainAxisSize.min, children: [ - Text(_currentValue.toString()), - SizedBox(width: 6), - const Icon(Icons.arrow_drop_down, size: 17) + Text(_currentValue.toString(), style: TextStyle(fontSize: widget.iconSize / 1.15, color: widget.iconTheme?.iconUnselectedColor ?? theme.iconTheme.color)), + SizedBox(width: widget.iconSize / 3.83), + Icon(Icons.arrow_drop_down, size: widget.iconSize / 1.15, color: widget.iconTheme?.iconUnselectedColor ?? theme.iconTheme.color) ], ), );