FCardStyle.inherit constructor

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

Creates a FCardStyle that inherits its properties.

Implementation

factory FCardStyle.inherit({
  required FColors colors,
  required FTypography typography,
  required FStyle style,
  required bool touch,
}) {
  TextStyle titleTextStyle;
  double titleSpacing;
  double subtitleSpacing;
  if (touch) {
    titleTextStyle = typography.lg.copyWith(fontWeight: .w500, color: colors.foreground);
    titleSpacing = 4;
    subtitleSpacing = 8;
  } else {
    titleTextStyle = typography.md.copyWith(fontWeight: .w500, color: colors.foreground);
    titleSpacing = 2;
    subtitleSpacing = 6;
  }

  return FCardStyle(
    decoration: ShapeDecoration(
      shape: RoundedSuperellipseBorder(
        side: BorderSide(color: colors.border, width: style.borderWidth),
        borderRadius: style.borderRadius.lg,
      ),
      color: colors.card,
    ),
    contentStyle: FCardContentStyle(
      titleTextStyle: titleTextStyle,
      subtitleTextStyle: typography.sm.copyWith(color: colors.mutedForeground),
      titleSpacing: titleSpacing,
      subtitleSpacing: subtitleSpacing,
    ),
  );
}