From 8f097466cd22dd2a34d6410769a7b19824027d7b Mon Sep 17 00:00:00 2001 From: CodeDoctorDE Date: Tue, 31 Dec 2024 15:33:52 +0100 Subject: [PATCH] Fix icon for toggleable tools --- app/lib/views/edit.dart | 17 +++++++++++------ app/lib/widgets/option_button.dart | 3 ++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/lib/views/edit.dart b/app/lib/views/edit.dart index d0b1ee267b76..2c1c2a6fcd5d 100644 --- a/app/lib/views/edit.dart +++ b/app/lib/views/edit.dart @@ -280,10 +280,7 @@ class _EditToolbarState extends State { ToolStatus.disabled ? Theme.of(context).disabledColor : null; - var icon = handler.getIcon(bloc) ?? - tool.icon(selected - ? PhosphorIconsStyle.fill - : PhosphorIconsStyle.light); + var handlerIcon = handler.getIcon(bloc); final toolWidget = Padding( padding: const EdgeInsets.symmetric(horizontal: 4.0), child: OptionButton( @@ -318,8 +315,16 @@ class _EditToolbarState extends State { PhosphorIconsLight.caretLeft, }) : null, - selectedIcon: _buildIcon(icon, size, color), - icon: _buildIcon(icon, size, color), + selectedIcon: _buildIcon( + handlerIcon ?? + tool.icon(PhosphorIconsStyle.fill), + size, + color), + icon: _buildIcon( + handlerIcon ?? + tool.icon(PhosphorIconsStyle.light), + size, + color), onPressed: () { if (_mouseState == _MouseState.multi) { context diff --git a/app/lib/widgets/option_button.dart b/app/lib/widgets/option_button.dart index ec3f2cf22600..b6fa89e6ec17 100644 --- a/app/lib/widgets/option_button.dart +++ b/app/lib/widgets/option_button.dart @@ -60,7 +60,8 @@ class _OptionButtonState extends State void didUpdateWidget(covariant OptionButton oldWidget) { super.didUpdateWidget(oldWidget); if (widget.selected != oldWidget.selected || - widget.highlighted != oldWidget.highlighted) { + widget.highlighted != oldWidget.highlighted || + widget.showBottom != oldWidget.showBottom) { setState(() {}); _animationController.animateTo(_nextValue); }