build method

dynamic build()

Implementation

dynamic build() {
  brightness ??= getBrightness(context);
  if (Design.isMaterialYaru()) {
    return ThemeData(
      adaptations: adaptations,
      applyElevationOverlayColor: applyElevationOverlayColor,
      extensions: extensions,
      inputDecorationTheme: inputDecorationTheme,
      materialTapTargetSize: materialTapTargetSize,
      pageTransitionsTheme: pageTransitionsTheme,
      scrollbarTheme: scrollbarTheme,
      splashFactory: splashFactory,
      useMaterial3: useMaterial3,
      visualDensity: visualDensity,
      colorScheme: colorScheme,
      brightness: brightness,
      colorSchemeSeed: colorSchemeSeed,
      canvasColor: canvasColor,
      cardColor: cardColor,
      dialogBackgroundColor: dialogBackgroundColor,
      disabledColor: disabledColor,
      dividerColor: dividerColor,
      focusColor: focusColor,
      highlightColor: highlightColor,
      hintColor: hintColor,
      hoverColor: hoverColor,
      indicatorColor: indicatorColor,
      primaryColor: primaryColor,
      primaryColorDark: primaryColorDark,
      primaryColorLight: primaryColorLight,
      primarySwatch: primarySwatch,
      secondaryHeaderColor: secondaryHeaderColor,
      shadowColor: shadowColor,
      splashColor: splashColor,
      unselectedWidgetColor: unselectedWidgetColor,
      fontFamily: fontFamily,
      fontFamilyFallback: fontFamilyFallback,
      package: package,
      iconTheme: iconTheme,
      primaryIconTheme: primaryIconTheme,
      primaryTextTheme: primaryTextTheme?.build(context),
      textTheme: textTheme?.build(context),
      typography: typography?.build(context),
      actionIconTheme: actionIconTheme,
      appBarTheme: appBarTheme,
      badgeTheme: badgeTheme,
      bannerTheme: bannerTheme,
      bottomAppBarTheme: bottomAppBarTheme,
      bottomNavigationBarTheme: bottomNavigationBarTheme,
      bottomSheetTheme: bottomSheetTheme,
      buttonTheme: buttonTheme,
      cardTheme: cardTheme,
      checkboxTheme: checkboxTheme,
      chipTheme: chipTheme,
      dataTableTheme: dataTableTheme,
      datePickerTheme: datePickerTheme,
      dialogTheme: dialogTheme,
      dividerTheme: dividerTheme,
      drawerTheme: drawerTheme,
      dropdownMenuTheme: dropdownMenuTheme,
      elevatedButtonTheme: elevatedButtonTheme,
      expansionTileTheme: expansionTileTheme,
      filledButtonTheme: filledButtonTheme,
      floatingActionButtonTheme: floatingActionButtonTheme,
      iconButtonTheme: iconButtonTheme,
      listTileTheme: listTileTheme,
      menuBarTheme: menuBarTheme,
      menuButtonTheme: menuButtonTheme,
      menuTheme: menuTheme,
      navigationBarTheme: navigationBarTheme,
      navigationDrawerTheme: navigationDrawerTheme,
      navigationRailTheme: navigationRailTheme,
      outlinedButtonTheme: outlinedButtonTheme,
      popupMenuTheme: popupMenuTheme,
      progressIndicatorTheme: progressIndicatorTheme,
      radioTheme: radioTheme,
      searchBarTheme: searchBarTheme,
      searchViewTheme: searchViewTheme,
      segmentedButtonTheme: segmentedButtonTheme,
      sliderTheme: sliderTheme,
      snackBarTheme: snackBarTheme,
      switchTheme: switchTheme,
      tabBarTheme: tabBarTheme,
      textButtonTheme: textButtonTheme,
      textSelectionTheme: textSelectionTheme,
      timePickerTheme: timePickerTheme,
      toggleButtonsTheme: toggleButtonsTheme,
      tooltipTheme: tooltipTheme,
      buttonBarTheme: buttonBarTheme,
    );
  } else if (Design.isCupertino()) {
    return CupertinoThemeData(
      brightness: brightness,
      primaryColor: primaryColor,
      primaryContrastingColor: primaryColorDark ?? primaryColor!,
      textTheme: (primaryTextTheme ?? textTheme)?.build(context),
      applyThemeToAll: applyThemeToAll,
    );
  } else if (Design.isMacOS()) {
    return MacosThemeData(
      scrollbarTheme: scrollbarTheme,
      visualDensity: visualDensity,
      brightness: brightness,
      canvasColor: canvasColor,
      dividerColor: dividerColor,
      primaryColor: primaryColor,
      iconTheme: iconTheme,
      typography: typography?.build(context),
      datePickerTheme: datePickerTheme,
      timePickerTheme: timePickerTheme,
      tooltipTheme: tooltipTheme,
    );
  } else if (Design.isFluent()) {
    return fluent.FluentThemeData(
      extensions: extensions,
      scrollbarTheme: scrollbarTheme,
      visualDensity: visualDensity,
      brightness: brightness,
      cardColor: cardColor,
      shadowColor: shadowColor,
      fontFamily: fontFamily,
      iconTheme: iconTheme,
      typography: typography?.build(context),
      buttonTheme: buttonTheme,
      checkboxTheme: checkboxTheme,
      dialogTheme: dialogTheme,
      dividerTheme: dividerTheme,
      sliderTheme: sliderTheme,
      tooltipTheme: tooltipTheme,
    );
  }
}