of static method
Implementation
static CLTheme of(BuildContext context) {
final isDark = Theme.of(context).brightness == Brightness.dark;
// 1. Cerca il provider generico (nuovo, consigliato)
// listen:false — la sostituzione del provider richiede ricostruzione del MaterialApp,
// quindi non serve sottoscrivere qui (evita rebuild a cascata su notifyListeners).
try {
final tp = Provider.of<CLThemeProvider>(context, listen: false);
return isDark ? tp.darkTheme : tp.lightTheme;
} catch (_) {}
// 3. Default built-in
return isDark ? dark : light;
}