FDialogContentStyles.inherit constructor

FDialogContentStyles.inherit({
  1. required FColors colors,
  2. required FTypography typography,
  3. required bool touch,
})

Creates a FDialogContentStyles that inherits its properties.

Implementation

factory FDialogContentStyles.inherit({
  required FColors colors,
  required FTypography typography,
  required bool touch,
}) {
  if (touch) {
    final title = typography.md.copyWith(fontWeight: .w600, color: colors.foreground, height: 1.25);
    final body = typography.xs.copyWith(color: colors.mutedForeground);

    final horizontal = FDialogContentStyle(titleTextStyle: title, bodyTextStyle: body);

    return FDialogContentStyles(
      FVariants.from(
        horizontal,
        variants: {
          [.horizontal]: horizontal,
          [.vertical]: FDialogContentStyle(titleTextStyle: title, bodyTextStyle: body),
        },
      ),
    );
  } else {
    final title = typography.md.copyWith(fontWeight: .w600, color: colors.foreground, height: 1.25);
    final body = typography.sm.copyWith(color: colors.mutedForeground);

    final horizontal = FDialogContentStyle(
      titleTextStyle: title,
      bodyTextStyle: body,
      padding: const .only(left: 16, right: 16, top: 14, bottom: 14),
      titlePadding: .zero,
      bodyPadding: .zero,
      titleSpacing: 5,
      contentSpacing: 16,
      actionSpacing: 8,
      expandActions: false,
    );

    return FDialogContentStyles(
      FVariants.from(
        horizontal,
        variants: {
          [.horizontal]: horizontal,
          [.vertical]: FDialogContentStyle(
            titleTextStyle: title,
            bodyTextStyle: body,
            padding: const .only(left: 16, right: 16, top: 14, bottom: 14),
            titleSpacing: 5,
            contentSpacing: 16,
            actionSpacing: 8,
            expandActions: false,
          ),
        },
      ),
    );
  }
}