buildGsMaterialTheme function

ThemeData buildGsMaterialTheme(
  1. Map<String, dynamic> tp
)

Implementation

ThemeData buildGsMaterialTheme(Map<String, dynamic> tp) {
  Map<String, dynamic> newTp = getNewThemeParams(tp);
  return ThemeData(
    useMaterial3: true,
    colorScheme:
        ColorScheme.fromSeed(
          seedColor: newTp['accentColor'],
          brightness: Brightness.light,
        ).copyWith(
          surface: newTp['scaffoldBackgroundColor'],
          error: newTp['errorBackgroundColor'],
        ),
    scaffoldBackgroundColor: newTp['scaffoldBackgroundColor'],
    textTheme: newTp['baseTextTheme'],
    appBarTheme: AppBarTheme(
      backgroundColor: newTp['appBarBackgroundColor'],
      foregroundColor: newTp['appBarForegroundColor'],
      elevation: 0,
      surfaceTintColor: Colors.transparent,
      centerTitle: true,
    ),
    inputDecorationTheme: InputDecorationTheme(
      border: OutlineInputBorder(
        borderRadius: newTp['corners'],
        borderSide: BorderSide(
          color: newTp['separatorColor'],
          width: newTp['separatorWidth'],
        ),
      ),
      enabledBorder: OutlineInputBorder(
        borderRadius: newTp['corners'],
        borderSide: BorderSide(
          color: newTp['separatorColor'],
          width: newTp['separatorWidth'],
        ),
      ),
      focusedBorder: OutlineInputBorder(
        borderRadius: newTp['corners'],
        borderSide: BorderSide(
          color: newTp['accentColor'],
          width: newTp['focusedBorderWidth'],
        ),
      ),
      contentPadding: EdgeInsets.symmetric(
        horizontal: newTp['contentPaddingHorizontal'],
        vertical: newTp['contentPaddingVertical'],
      ),
    ),
    elevatedButtonTheme: ElevatedButtonThemeData(
      style: ElevatedButton.styleFrom(
        backgroundColor: newTp['accentColor'],
        foregroundColor: newTp['accentForegroundColor'],
        elevation: 0,
        minimumSize: const Size(88, 44),
        shape: RoundedRectangleBorder(borderRadius: newTp['corners']),
      ),
    ),
    cardTheme: CardThemeData(
      color: newTp['accentForegroundColor'],
      elevation: 0,
      shape: RoundedRectangleBorder(
        borderRadius: newTp['corners'],
        side: BorderSide(
          color: newTp['separatorColor'],
          width: newTp['separatorWidth'],
        ),
      ),
      margin: const EdgeInsets.symmetric(vertical: 4),
    ),
    dividerTheme: DividerThemeData(
      color: newTp['separatorColor'],
      thickness: newTp['separatorWidth'],
    ),
    listTileTheme: ListTileThemeData(iconColor: newTp['secondaryTextColor']),
    floatingActionButtonTheme: FloatingActionButtonThemeData(
      backgroundColor: newTp['accentColor'],
      foregroundColor: newTp['accentForegroundColor'],
      elevation: 0,
    ),
    drawerTheme: DrawerThemeData(
      backgroundColor: newTp['drawerBackgroundColor'],
      surfaceTintColor: newTp['drawerForegroundColor'],
    ),
  );
}