theme method

ThemeData theme({
  1. dynamic isDark = false,
  2. required Color color,
})

Implementation

ThemeData theme({isDark = false, required Color color}) {
  final backgroundColor = ThemeConfig.scaffoldBackgroundColor(isDark);
  return ThemeData(
    // color setup
    scaffoldBackgroundColor: backgroundColor,
    primaryColor: color,
    colorScheme:
        (isDark ? const ColorScheme.dark() : const ColorScheme.light())
            .copyWith(secondary: ThemeConfig.config.secondaryColor),

    // icon theme
    iconTheme: iconStyle(ThemeConfig.config.iconColor),
    floatingActionButtonTheme: floatingActionButtonTheme(
        ThemeConfig.config.iconColor, backgroundColor),

    // appbar styles
    appBarTheme: appBarStyle(),

    // card styles
    cardTheme: cardStyle(isDark),

    // button styles
    elevatedButtonTheme: elevatedButtonStyle(isDark, color),
    textButtonTheme: textButtonStyle(color),

    // text styles
    textTheme: textStyle(isDark),

    // input styles
    inputDecorationTheme: inputStyle(color, isDark),
    textSelectionTheme: const TextSelectionThemeData().copyWith(
      cursorColor: color,
    ),

    // bottom navigation styles
    bottomNavigationBarTheme: bottomNavStyle(isDark, color),
    navigationRailTheme: navigationRailStyle(isDark, color),
  );
}