GBThemeData constructor

GBThemeData({
  1. Color accentColor = DefaultColors.accent_accent_blue,
  2. Color accentError = DefaultColors.accent_error_red,
  3. Color accentErrorLight = DefaultColors.accent_error_red_light,
  4. Color backgroundBase = DefaultColors.background_base,
  5. Color backgroundContrast = DefaultColors.background_contrast,
  6. Color backgroundDisabled = DefaultColors.background_disabled,
  7. Color backgroundFocus = DefaultColors.background_focus,
  8. Color primaryColor = DefaultColors.primaryPrimaryYellow,
  9. Color textBase = DefaultColors.text_gray_base,
  10. Color textBlack = DefaultColors.text_text_black,
  11. Color textDisabled = DefaultColors.text_gray_disabled,
  12. Color textWhite = DefaultColors.text_text_white,
  13. TextTheme? textTheme,
  14. BorderRadius? textFieldRadius,
  15. double? textFieldBorderWidth,
  16. BorderRadius? buttonsRadius,
  17. GBInputDecorationTheme? inputDecorationTheme,
  18. ContainedButtonThemeData? containedButtonThemeData,
  19. bool? useMaterial3,
})

Implementation

factory GBThemeData({
  // @required this.primary,
  // @required this.accent,
  // @required this.accentError,
  // @required this.textGreyDisabled,
  // @required this.textWhite,
  // @required this.backgroundBase,
  // @required this.accentErrorLight,
  // @required this.backgroundContrast,
  // @required this.backgroundFocus,
  // @required this.backgroundDisabled,
  // @required this.textGreyBase,
  // @required this.textBlack,
  Color accentColor = DefaultColors.accent_accent_blue,
  Color accentError = DefaultColors.accent_error_red,
  Color accentErrorLight = DefaultColors.accent_error_red_light,
  Color backgroundBase = DefaultColors.background_base,
  Color backgroundContrast = DefaultColors.background_contrast,
  Color backgroundDisabled = DefaultColors.background_disabled,
  Color backgroundFocus = DefaultColors.background_focus,
  Color primaryColor = DefaultColors.primaryPrimaryYellow,
  Color textBase = DefaultColors.text_gray_base,
  Color textBlack = DefaultColors.text_text_black,
  Color textDisabled = DefaultColors.text_gray_disabled,
  Color textWhite = DefaultColors.text_text_white,
  TextTheme? textTheme,
  BorderRadius? textFieldRadius,
  double? textFieldBorderWidth,
  BorderRadius? buttonsRadius,
  GBInputDecorationTheme? inputDecorationTheme,
  ContainedButtonThemeData? containedButtonThemeData,
  //
  bool? useMaterial3,
}) {
  accentColor = accentColor;
  accentError = accentError;
  accentErrorLight = accentErrorLight;
  backgroundBase = backgroundBase;
  backgroundContrast = backgroundContrast;
  backgroundDisabled = backgroundDisabled;
  backgroundFocus = backgroundFocus;
  primaryColor = primaryColor;
  textBase = textBase;
  textBlack = textBlack;
  textDisabled = textDisabled;
  textWhite = textWhite;
  textFieldRadius = textFieldRadius;
  buttonsRadius = buttonsRadius;
  textFieldBorderWidth = textFieldBorderWidth;
  inputDecorationTheme = inputDecorationTheme;

  final theme = ThemeData(
    primaryColor: primaryColor,
    colorScheme: ColorScheme.fromSwatch().copyWith(
      secondary: accentColor,
      error: accentError,
    ),
    disabledColor: backgroundDisabled,
    useMaterial3: useMaterial3,
    // inputDecorationTheme: fInputDecorationTheme,
  );

  return GBThemeData.raw(
    accentColor: theme.colorScheme.secondary,
    accentError: accentError,
    accentErrorLight: accentErrorLight,
    backgroundBase: backgroundBase,
    backgroundContrast: backgroundContrast,
    backgroundDisabled: backgroundDisabled,
    backgroundFocus: backgroundFocus,
    textBase: textBase,
    textBlack: textBlack,
    textDisabled: textDisabled,
    textWhite: textWhite,
    textFieldRadius: textFieldRadius,
    textFieldBorderWidth: textFieldBorderWidth,
    buttonsRadius: buttonsRadius,
    containedButtonTheme: _containedButtonTheme(
      containedButtonThemeData,
      accentColor: accentColor,
      accentError: accentError,
      accentErrorLight: accentErrorLight,
      backgroundBase: backgroundBase,
      backgroundContrast: backgroundContrast,
      backgroundDisabled: backgroundDisabled,
      backgroundFocus: backgroundFocus,
      primaryColor: primaryColor,
      textBase: textBase,
      textBlack: textBlack,
      textDisabled: textDisabled,
      buttonsRadius: buttonsRadius,
    ),
    /* Default Theme */
    // GENERAL CONFIGURATION
    adaptationMap: theme.adaptationMap,
    applyElevationOverlayColor: theme.applyElevationOverlayColor,
    cupertinoOverrideTheme: theme.cupertinoOverrideTheme,
    extensions: theme.extensions,
    inputDecorationTheme: _getInputDecorationTheme(
      inputDecorationTheme,
      accentColor: accentColor,
      accentError: accentError,
      accentErrorLight: accentErrorLight,
      backgroundBase: backgroundBase,
      backgroundContrast: backgroundContrast,
      backgroundDisabled: backgroundDisabled,
      backgroundFocus: backgroundFocus,
      primaryColor: primaryColor,
      textBase: textBase,
      textBlack: textBlack,
      textDisabled: textDisabled,
      textWhite: textWhite,
      textFieldRadius: textFieldRadius,
    ),
    materialTapTargetSize: theme.materialTapTargetSize,
    pageTransitionsTheme: theme.pageTransitionsTheme,
    platform: theme.platform,
    scrollbarTheme: theme.scrollbarTheme,
    splashFactory: theme.splashFactory,
    useMaterial3: theme.useMaterial3,
    visualDensity: theme.visualDensity,
    // COLOR
    // [colorScheme] is the preferred way to configure colors. The other color
    // properties will gradually be phased out, see
    // https://github.com/flutter/flutter/issues/91772.
    canvasColor: theme.canvasColor,
    cardColor: theme.cardColor,
    colorScheme: theme.colorScheme,
    dialogBackgroundColor: theme.dialogBackgroundColor,
    disabledColor: theme.disabledColor,
    dividerColor: theme.dividerColor,
    focusColor: theme.focusColor,
    highlightColor: theme.highlightColor,
    hintColor: theme.hintColor,
    hoverColor: theme.hoverColor,
    indicatorColor: theme.indicatorColor,
    primaryColor: theme.primaryColor,
    primaryColorDark: theme.primaryColorDark,
    primaryColorLight: theme.primaryColorLight,
    scaffoldBackgroundColor: theme.scaffoldBackgroundColor,
    secondaryHeaderColor: theme.secondaryHeaderColor,
    shadowColor: theme.shadowColor,
    splashColor: theme.splashColor,
    unselectedWidgetColor: theme.unselectedWidgetColor,
    // TYPOGRAPHY & ICONOGRAPHY
    iconTheme: theme.iconTheme,
    primaryIconTheme: theme.primaryIconTheme,
    primaryTextTheme: theme.primaryTextTheme,
    textTheme: _getTextTheme(
      theme,
      textTheme,
    ),
    typography: theme.typography,
    // COMPONENT THEMES
    appBarTheme: theme.appBarTheme,
    badgeTheme: theme.badgeTheme,
    bannerTheme: theme.bannerTheme,
    bottomAppBarTheme: theme.bottomAppBarTheme,
    bottomNavigationBarTheme: theme.bottomNavigationBarTheme,
    bottomSheetTheme: theme.bottomSheetTheme,
    buttonBarTheme: theme.buttonBarTheme,
    buttonTheme: theme.buttonTheme,
    cardTheme: theme.cardTheme,
    checkboxTheme: theme.checkboxTheme,
    chipTheme: theme.chipTheme,
    dataTableTheme: theme.dataTableTheme,
    dialogTheme: theme.dialogTheme,
    dividerTheme: theme.dividerTheme,
    drawerTheme: theme.drawerTheme,
    dropdownMenuTheme: theme.dropdownMenuTheme,
    elevatedButtonTheme: theme.elevatedButtonTheme,
    expansionTileTheme: theme.expansionTileTheme,
    filledButtonTheme: theme.filledButtonTheme,
    floatingActionButtonTheme: theme.floatingActionButtonTheme,
    iconButtonTheme: theme.iconButtonTheme,
    listTileTheme: theme.listTileTheme,
    menuBarTheme: theme.menuBarTheme,
    menuButtonTheme: theme.menuButtonTheme,
    menuTheme: theme.menuTheme,
    navigationBarTheme: theme.navigationBarTheme,
    navigationDrawerTheme: theme.navigationDrawerTheme,
    navigationRailTheme: theme.navigationRailTheme,
    outlinedButtonTheme: theme.outlinedButtonTheme,
    popupMenuTheme: theme.popupMenuTheme,
    progressIndicatorTheme: theme.progressIndicatorTheme,
    radioTheme: theme.radioTheme,
    segmentedButtonTheme: theme.segmentedButtonTheme,
    sliderTheme: theme.sliderTheme,
    snackBarTheme: theme.snackBarTheme,
    switchTheme: theme.switchTheme,
    tabBarTheme: theme.tabBarTheme,
    textButtonTheme: theme.textButtonTheme,
    textSelectionTheme: theme.textSelectionTheme,
    timePickerTheme: theme.timePickerTheme,
    toggleButtonsTheme: theme.toggleButtonsTheme,
    tooltipTheme: theme.tooltipTheme,
    actionIconTheme: theme.actionIconTheme,
    datePickerTheme: theme.datePickerTheme,
    searchBarTheme: theme.searchBarTheme,
    searchViewTheme: theme.searchViewTheme,
  );
}