getMaterialYouThemeData function

Future<ThemeData> getMaterialYouThemeData()

Implementation

Future<ThemeData> getMaterialYouThemeData() async {
  var data = await getMaterialYouColours();
  final primarySwatch = data?.accent1 ?? Colors.blue;
  final accent2Swatch = data?.accent2 ?? Colors.blue;
  final accent3Swatch = data?.accent3 ?? Colors.blue;
  return ThemeData(
    useMaterial3: true,
    primarySwatch: primarySwatch,
    checkboxTheme: CheckboxThemeData(
      fillColor: MaterialStateProperty.resolveWith((states) => accent2Swatch),
    ),
    elevatedButtonTheme: ElevatedButtonThemeData(
      style: ButtonStyle(
        backgroundColor:
            MaterialStateProperty.resolveWith((states) => accent3Swatch),
      ),
    ),
    floatingActionButtonTheme: FloatingActionButtonThemeData(
      backgroundColor: accent3Swatch.shade300,
    ),
    bottomNavigationBarTheme: BottomNavigationBarThemeData(
      backgroundColor: accent2Swatch.shade100,
      selectedIconTheme: IconThemeData(
        color: accent2Swatch.shade900,
      ),
      unselectedIconTheme: IconThemeData(
        color: accent2Swatch.shade300,
      ),
      selectedItemColor: Colors.black,
      unselectedItemColor: Colors.black,
    ),
  );
}