window_manager icon indicating copy to clipboard operation
window_manager copied to clipboard

Can't set a custom Icon for WindowCaptionButton

Open WinXaito opened this issue 1 year ago • 0 comments

This parameter is never used: https://github.com/leanflutter/window_manager/blob/main/lib/src/widgets/window_caption_button.dart#L30

And if iconName is null, we throw an error: https://github.com/leanflutter/window_manager/blob/main/lib/src/widgets/window_caption_button.dart#L174

I want to add custom button with custom icon, like this:

image

And if we give a Widget, le color can't be changed on hover, so I propose something like that:

Add a parameter iconData instead icon of type IconData, and do something like that

widget.iconData != null
? Icon(
    color: iconColor,
    widget.iconData,
    size: 16,
  )
: WindowCaptionButtonIcon(
    name: widget.iconName!,
    color: iconColor,
  ),

Edit: and add a verification like this assert(iconData != null || iconName != null)

WinXaito avatar Sep 05 '22 12:09 WinXaito