getToolContainerDecoration method

  1. @override
Decoration? getToolContainerDecoration(
  1. BuildContext context
)
override

Implementation

@override
Decoration? getToolContainerDecoration(BuildContext context) {
  if (insetToolContainer) {
    final theme = Theme.of(context);

    final isDarkMode = theme.brightness == Brightness.dark;
    Color backgroundColor = isDarkMode
        ? theme.colorScheme.onSurface.withValues(alpha: 0.2)
        : theme.colorScheme.onSurface.withValues(alpha: 0.02);
    Color boxShadowColor = isDarkMode
        ? theme.colorScheme.shadow
        : theme.colorScheme.shadow.withValues(alpha: 0.4);

    return BoxDecoration(
      color: backgroundColor,
      border: Border.all(
        color: theme.colorScheme.onSurface.withValues(alpha: 0.2),
        width: 1.0,
      ),
      borderRadius: BorderRadius.circular(4),
      boxShadow: [
        BoxShadow(
          color: boxShadowColor,
        ),
        BoxShadow(
          color: theme.colorScheme.surface,
          blurRadius: 1.0,
          spreadRadius: -1.0,
          offset: const Offset(0, 1),
        ),
      ],
    );
  } else {
    return null;
  }
}