defaultToggleStyleButtonBuilder function
Widget
defaultToggleStyleButtonBuilder(
- BuildContext context,
- NotusAttribute attribute,
- IconData icon,
- bool isToggled,
- VoidCallback? onPressed,
Default builder for toggle style buttons.
Implementation
Widget defaultToggleStyleButtonBuilder(
BuildContext context,
NotusAttribute attribute,
IconData icon,
bool isToggled,
VoidCallback? onPressed,
) {
final theme = Theme.of(context);
final isEnabled = onPressed != null;
final iconColor = isEnabled
? isToggled
? theme.primaryIconTheme.color
: theme.iconTheme.color
: theme.disabledColor;
final fillColor = isToggled ? theme.toggleableActiveColor : theme.canvasColor;
return ZIconButton(
highlightElevation: 0,
hoverElevation: 0,
size: 32,
icon: Icon(icon, size: 18, color: iconColor),
fillColor: fillColor,
onPressed: onPressed,
);
}