Il sistema di theming di Flutter ti permette di definire uno styling visivo coerente (colori, font, stili dei componenti) a livello di app, con supporto per temi chiari/scuri. Centralizzare lo styling attraverso i temi garantisce coerenza e rende le app facili da rinominare.
Definire un tema
// define the app's theme in MaterialApp
MaterialApp(
theme: ThemeData( // LIGHT theme
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
textTheme: TextTheme(/* font styles */),
elevatedButtonTheme: /* button styling */,
useMaterial3: true,
),
darkTheme: ThemeData.dark(), // DARK theme
themeMode: ThemeMode.system, // follow the system setting (or .light/.dark)
)
