getTheme function

GbtFluentThemeData getTheme({
  1. required MaterialColor brandColor,
  2. Brightness brightness = Brightness.light,
})

Implementation

GbtFluentThemeData getTheme({
  required MaterialColor brandColor,
  Brightness brightness = Brightness.light,
}) {
  final colorMode = createColorMode(brightness);
  final fluentColors = convert(brandColor, brightness);

  return GbtFluentThemeData(
    splashColor: Colors.transparent,
    splashFactory: NoSplash.splashFactory,
    useMaterial3: true,
    fontFamily:
        defaultTargetPlatform == TargetPlatform.iOS ? 'SF Pro' : 'Roboto',
    fluentBrandColors: fluentColors,
    fluentTextTheme: MixedFluentTextTheme(
      caption2: MixedFluentTextStyle(
        fluentSize: 12,
        fluentLineHeight: 1.35,
        fluentWeight: MixedFluentFontWeight.regular,
      ),
      caption1: MixedFluentTextStyle(
        fluentSize: 13,
        fluentLineHeight: 1.4,
        fluentWeight: MixedFluentFontWeight.regular,
      ),
      caption1Strong: MixedFluentTextStyle(
        fluentSize: 13,
        fluentLineHeight: 1.4,
        fluentWeight: MixedFluentFontWeight.semibold,
      ),
      body2: MixedFluentTextStyle(
        fluentSize: 15,
        fluentLineHeight: 1.35,
        fluentWeight: MixedFluentFontWeight.regular,
      ),
      body2Strong: MixedFluentTextStyle(
        fluentSize: 15,
        fluentLineHeight: 1.35,
        fluentWeight: MixedFluentFontWeight.semibold,
      ),
      body1: MixedFluentTextStyle(
        fluentSize: 17,
        fluentLineHeight: 1.3,
        fluentWeight: MixedFluentFontWeight.regular,
      ),
      body1Strong: MixedFluentTextStyle(
        fluentSize: 17,
        fluentLineHeight: 1.3,
        fluentWeight: MixedFluentFontWeight.semibold,
      ),
      title3: MixedFluentTextStyle(
        fluentSize: 20,
        fluentLineHeight: 1.25,
        fluentWeight: MixedFluentFontWeight.regular,
      ),
      title2: MixedFluentTextStyle(
        fluentSize: 22,
        fluentLineHeight: 1.3,
        fluentWeight: MixedFluentFontWeight.semibold,
      ),
      title1: MixedFluentTextStyle(
        fluentSize: 28,
        fluentLineHeight: 1.22,
        fluentWeight: MixedFluentFontWeight.bold,
      ),
      largeTitle: MixedFluentTextStyle(
        fluentSize: 34,
        fluentLineHeight: 1.21,
        fluentWeight: MixedFluentFontWeight.bold,
      ),
      display: MixedFluentTextStyle(
        fluentSize: 60,
        fluentLineHeight: 1.17,
        fluentWeight: MixedFluentFontWeight.bold,
      ),
    ),
    fluentShadowTheme: MixedFluentShadowTheme(
      shadow2: MixedFluentShadow.lowElevation(2, brightness),
      shadow4: MixedFluentShadow.lowElevation(4, brightness),
      shadow8: MixedFluentShadow.lowElevation(8, brightness),
      shadow16: MixedFluentShadow.lowElevation(16, brightness),
      shadow28: MixedFluentShadow.hightElevation(28, brightness),
      shadow64: MixedFluentShadow.hightElevation(64, brightness),
      brandShadow2:
          MixedFluentShadow.brandColor(2, brandColor, ElevationRamp.low),
      brandShadow4:
          MixedFluentShadow.brandColor(4, brandColor, ElevationRamp.low),
      brandShadow8:
          MixedFluentShadow.brandColor(8, brandColor, ElevationRamp.low),
      brandShadow16:
          MixedFluentShadow.brandColor(16, brandColor, ElevationRamp.low),
      brandShadow28:
          MixedFluentShadow.brandColor(28, brandColor, ElevationRamp.hight),
      brandShadow64:
          MixedFluentShadow.brandColor(64, brandColor, ElevationRamp.hight),
    ),
    fluentStrokeTheme: MixedFluentStrokeTheme(
      stroke1: MixedFluentStrokeStyle(
        color: colorMode(
          FluentColors.neutralStroke1Rest,
          FluentDarkColors.neutralStroke1Rest,
        ),
        thickness: FluentStrokeThickness.strokeWidth05,
        cornerRadius: MixedFluentCornerRadius.none,
      ),
      stroke2: MixedFluentStrokeStyle(
        color: colorMode(
          FluentColors.neutralStroke2Rest,
          FluentDarkColors.neutralStroke2Rest,
        ),
        thickness: FluentStrokeThickness.strokeWidth05,
        cornerRadius: MixedFluentCornerRadius.none,
      ),
      strokeAccessible: MixedFluentStrokeStyle(
        color: colorMode(
          FluentColors.neutralStrokeAccessibleRest,
          FluentDarkColors.neutralStrokeAccessibleRest,
        ),
        thickness: FluentStrokeThickness.strokeWidth10,
        cornerRadius: MixedFluentCornerRadius.none,
      ),
      strokeDisabled: MixedFluentStrokeStyle(
        color: colorMode(
          FluentColors.neutralStrokeDisabledRest,
          FluentDarkColors.neutralStrokeDisabledRest,
        ),
        thickness: FluentStrokeThickness.strokeWidth10,
        cornerRadius: MixedFluentCornerRadius.xLarge,
      ),
    ),
    scaffoldBackgroundColor: colorMode(FluentColors.neutralBackground1Rest,
        FluentDarkColors.neutralBackground1Rest),
    dialogBackgroundColor: colorMode(FluentColors.neutralBackground1Rest,
        FluentDarkColors.neutralBackground1Rest),
    colorScheme: ColorScheme.fromSeed(
      seedColor: brandColor,
      brightness: brightness,
    ),
  );
}