theme static method

ThemeData theme(
  1. AppType isAppType
)

Implementation

static ThemeData theme(AppType isAppType) {
  final primaryColor =
      isAppType == AppType.appSocial ? brandColor : blueColor;
  final scaffoldColor = backgroundColor;

  var colabTheme = ThemeData(
    useMaterial3: true,
    primaryColor: primaryColor,
    fontFamily: 'Poppins',
    brightness: Brightness.light,
    appBarTheme: const AppBarTheme(
      surfaceTintColor: whiteColor,
      elevation: 2,
    ),
    scaffoldBackgroundColor: scaffoldColor,
    bottomNavigationBarTheme: BottomNavigationBarThemeData(
      selectedItemColor: primaryColor,
      backgroundColor: Colors.white,
      selectedLabelStyle: smallMutedText.copyWith(color: primaryColor),
      unselectedLabelStyle: smallMutedText,
      selectedIconTheme: IconThemeData(color: primaryColor),
    ),
    floatingActionButtonTheme: FloatingActionButtonThemeData(
      backgroundColor: primaryColor,
      shape: CircleBorder(),
    ),
    iconTheme: const IconThemeData(color: darkGreyColor),
    expansionTileTheme: const ExpansionTileThemeData(
      collapsedShape: Border(
        bottom: BorderSide(width: 0.5, color: greyColor),
      ),
    ),
    inputDecorationTheme: InputDecorationTheme(
      alignLabelWithHint: true,
      filled: true,
      fillColor: Colors.transparent,
      hintStyle: extraSmallText.copyWith(fontSize: 14),
      errorStyle: errorSmallText,
      labelStyle: baseText,
      prefixIconColor: darkGreyColor,
      focusColor: primaryColor,
      iconColor: primaryColor,
      hoverColor: primaryColor,
      prefixStyle: baseText,
      helperStyle: smallGreyText,
      enabledBorder: const OutlineInputBorder(
        borderSide: BorderSide(color: baseInputColor),
      ),
      focusedErrorBorder: const OutlineInputBorder(
        borderSide: BorderSide(color: errorInputColor, width: 1),
      ),
      contentPadding: const EdgeInsets.symmetric(vertical: 4, horizontal: 12),
      focusedBorder: OutlineInputBorder(
        borderSide: BorderSide(color: primaryColor, width: 1),
      ),
      disabledBorder: const OutlineInputBorder(
        borderSide: BorderSide(color: disableInputColor, width: 1),
      ),
      errorBorder: const OutlineInputBorder(
        borderSide: BorderSide(color: errorInputColor, width: 1),
      ),
    ),
    colorScheme: ColorScheme(
      surfaceTint: Colors.transparent,
      brightness: Brightness.light,
      primary: primaryColor,
      onPrimary: whiteColor,
      secondary: brandSecondaryColor,
      onSecondary: backgroundColor,
      error: errorColor,
      onError: errorColor,
      surface: backgroundColor,
      onSurface: darkGreyColor,
      outline: midleDarkGreyColor,
    ),
    textTheme: const TextTheme(
      displayMedium: TextStyle(color: darkGreyColor),
      bodyMedium: TextStyle(color: darkGreyColor),
      labelMedium: TextStyle(color: darkGreyColor),
      titleMedium: TextStyle(color: darkGreyColor),
      headlineMedium: TextStyle(color: darkGreyColor),
      displayLarge: TextStyle(color: darkGreyColor),
      bodyLarge: TextStyle(color: darkGreyColor),
      labelLarge: TextStyle(color: darkGreyColor),
      titleLarge: TextStyle(color: darkGreyColor),
      headlineLarge: TextStyle(color: darkGreyColor),
      displaySmall: TextStyle(color: darkGreyColor),
      bodySmall: TextStyle(color: darkGreyColor),
      labelSmall: TextStyle(color: darkGreyColor),
      titleSmall: TextStyle(color: darkGreyColor),
      headlineSmall: TextStyle(color: darkGreyColor),
    ),
    checkboxTheme: CheckboxThemeData(
      side: const BorderSide(color: midleDarkGreyColor, width: 2),
      fillColor: WidgetStateProperty.resolveWith<Color>((
        Set<WidgetState> states,
      ) {
        if (states.contains(WidgetState.selected)) {
          return primaryColor;
        }
        return Colors.transparent;
      }),
    ),
    switchTheme: SwitchThemeData(
      thumbColor: WidgetStateProperty.resolveWith<Color>((
        Set<WidgetState> states,
      ) {
        if (states.contains(WidgetState.selected)) {
          return Colors.white;
        }
        return darkGreyColor;
      }),
      trackColor: WidgetStateProperty.resolveWith<Color>((
        Set<WidgetState> states,
      ) {
        if (states.contains(WidgetState.selected)) {
          return primaryColor;
        }
        return greyColor.withValues(alpha: .4);
      }),
    ),
    radioTheme: RadioThemeData(
      fillColor: WidgetStateProperty.resolveWith<Color>((
        Set<WidgetState> states,
      ) {
        if (states.contains(WidgetState.selected)) {
          return primaryColor;
        }
        return greyColor;
      }),
    ),
    popupMenuTheme: PopupMenuThemeData(
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(borderRadius),
        side: const BorderSide(color: midleLightGreyColor, width: .5),
      ),
      color: whiteColor,
      surfaceTintColor: whiteColor,
      enableFeedback: true,
    ),
    elevatedButtonTheme: ElevatedButtonThemeData(
      style: ElevatedButton.styleFrom(
        minimumSize: Size(0, 0),
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(borderRadius),
        ),
        side: BorderSide(color: Colors.transparent),
        elevation: 2,
        foregroundColor: whiteColor,
        iconColor: whiteColor,
        backgroundColor: primaryColor,
        textStyle: baseBlackText,
        padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
      ),
    ),
    outlinedButtonTheme: OutlinedButtonThemeData(
      style: OutlinedButton.styleFrom(
        minimumSize: Size(0, 0),
        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
        side: BorderSide(color: primaryColor),
        elevation: 0,
        foregroundColor: primaryColor,
        iconColor: primaryColor,
        backgroundColor: Colors.transparent,
        textStyle: baseBlackText,
        padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
      ),
    ),
    progressIndicatorTheme: ProgressIndicatorThemeData(
      color: primaryColor,
      circularTrackColor: Colors.grey.shade200,
    ),

    listTileTheme: const ListTileThemeData(
      textColor: darkGreyColor,
      iconColor: darkGreyColor,
    ),
  );
  return colabTheme;
}