themeData property

ThemeData get themeData

Convert TTheme to ThemeData with Correct Brightness

Implementation

ThemeData get themeData => ThemeData(
      brightness:
          this == TTheme.darkTheme ? Brightness.dark : Brightness.light,
      primaryColor: primary,
      scaffoldBackgroundColor: background,
      fontFamily: fontFamily,
      colorScheme: ColorScheme(
        brightness:
            this == TTheme.darkTheme ? Brightness.dark : Brightness.light,
        primary: primary,
        onPrimary: primaryForeground,
        secondary: secondary,
        onSecondary: secondaryForeground,
        surface: background,
        onSurface: foreground,
        error: destructive,
        onError: destructiveForeground,
      ),
      textTheme: TextTheme(
        bodyLarge: TextStyle(color: foreground),
        bodyMedium: TextStyle(color: foreground),
        bodySmall: TextStyle(color: mutedForeground),
      ),
      cardColor: card,
      dividerColor: border,
      inputDecorationTheme: InputDecorationTheme(
        fillColor: input,
        border: OutlineInputBorder(borderSide: BorderSide(color: border)),
      ),
      elevatedButtonTheme: ElevatedButtonThemeData(
        style: ButtonStyle(
          backgroundColor: WidgetStateProperty.resolveWith((states) {
            if (states.contains(WidgetState.pressed)) return primaryPressed;
            return primary;
          }),
          foregroundColor: WidgetStateProperty.all(primaryForeground),
        ),
      ),
      dialogTheme: DialogThemeData(backgroundColor: popover),
    );