of static method

Gets the SmartSearchTheme from the current context.

Falls back to light or dark theme based on the system brightness if no theme extension is found.

Implementation

static SmartSearchTheme of(BuildContext context) {
  final theme = Theme.of(context).extension<SmartSearchTheme>();
  if (theme != null) return theme;

  // Fall back to system theme based on brightness
  final brightness = Theme.of(context).brightness;
  return brightness == Brightness.dark
      ? SmartSearchTheme.dark()
      : SmartSearchTheme.light();
}