Flutter's theming systeem laat je consistent visuele styling (kleuren, lettertypen, componentstijlen) app-breed definiëren, met ondersteuning voor light/dark themes. Het centraliseren van styling via themes zorgt voor consistentie en maakt apps makkelijk om opnieuw in te kleuren.
Een theme definiëren
// 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)
)
