FAlertStyles.inherit constructor

FAlertStyles.inherit({
  1. required FColors colors,
  2. required FTypography typography,
  3. required FStyle style,
  4. required bool touch,
})

Creates a FAlertStyles that inherits its properties.

Implementation

factory FAlertStyles.inherit({
  required FColors colors,
  required FTypography typography,
  required FStyle style,
  required bool touch,
}) {
  final primary = FAlertStyle(
    iconStyle: IconThemeData(color: colors.foreground, size: typography.md.fontSize),
    titleTextStyle: typography.sm.copyWith(fontWeight: .w500, color: colors.foreground, leadingDistribution: .even),
    subtitleTextStyle: (touch ? typography.xs : typography.sm).copyWith(color: colors.mutedForeground),
    decoration: ShapeDecoration(
      shape: RoundedSuperellipseBorder(
        side: BorderSide(color: colors.border, width: style.borderWidth),
        borderRadius: style.borderRadius.md,
      ),
      color: colors.card,
    ),
  );

  return FAlertStyles(
    FVariants.from(
      primary,
      variants: {
        [.primary]: const .delta(),
        [.destructive]: .delta(
          iconStyle: .delta(color: colors.destructive),
          titleTextStyle: .delta(color: colors.destructive),
          subtitleTextStyle: .delta(color: colors.destructive),
        ),
      },
    ),
  );
}