Step 1 / 4
One seed, a whole palette
ColorScheme.fromSeed generates a coordinated set of roles (primary, secondary, surface, error and their containers) from a single color.
Generate a full color scheme from one seed color, support dark mode, and style widgets from the theme.
1MaterialApp(2 theme: ThemeData(3 colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),4 ),5 darkTheme: ThemeData(6 colorScheme: ColorScheme.fromSeed(7 seedColor: Colors.indigo,8 brightness: Brightness.dark,9 ),10 ),11 themeMode: ThemeMode.system,12 home: const HomePage(),13)1415// Anywhere below MaterialApp:16final colors = Theme.of(context).colorScheme;17final text = Theme.of(context).textTheme;18Text('Hi', style: text.titleLarge?.copyWith(color: colors.primary));
ColorScheme.fromSeed(seedColor: Color(0xFF6750A4))ColorScheme.fromSeed generates a coordinated set of roles (primary, secondary, surface, error and their containers) from a single color.