singerdmx / flutter-quill

Rich text editor for Flutter
https://pub.dev/packages/flutter_quill
MIT License
2.6k stars 840 forks source link

How to change color of disabled icons in toolbar menu ? #2091

Closed Mmisiek closed 3 months ago

Mmisiek commented 3 months ago

Is there an existing issue for this?

The question

How to change color of disabled icons in toolbar menu ? I found way to change active icon color but disabled stay grey or oposite of active ?

In Light Theme I see all.

image

In Dark Theme disabled icons and separators are gone.

image
AtlasAutocode commented 3 months ago

Many of the toolbar buttons are derived from QuillToolbarIconButton which creates the icon buttons on the toolbar. One of the members is:

disabledColor: iconTheme?.iconButtonUnselectedData?.disabledColor,

iconTheme can be set from the button options (but that is a pain since there does not appear to be a global setting). In the absence of setting a value, the code will use the default.

QuillToolbarIconButton creates the button by calling IconButton and the comments on disabledColor may provide you a way to set your disabled buttons color.

/// The color to use for the icon inside the button, if the icon is disabled. /// Defaults to the [ThemeData.disabledColor] of the current [Theme]. /// /// The icon is disabled if [onPressed] is null. final Color? disabledColor;

I don't know if this will work for the dividers, but you can see if you can set your global theme

Mmisiek commented 3 months ago

Thanks for suggestion. Somehow disabledColor was not working for me instead disabledForgoundColor in style worked: iconButtonUnselectedData: quill.IconButtonData( style: IconButton.styleFrom( foregroundColor: Config().darkMode() ? Colors.white : Colors.black, disabledForegroundColor: Config().darkMode() ? Colors.red : Colors.yellow, ),

Mmisiek commented 3 months ago

For dividers use: sectionDividerColor: Config().darkMode() ? Colors.white : Colors.black,