FDialogStyle.inherit constructor

FDialogStyle.inherit({
  1. required FStyle style,
  2. required FColors colors,
  3. required FTypography typography,
})

Creates a FDialogStyle that inherits its properties.

Implementation

factory FDialogStyle.inherit({required FStyle style, required FColors colors, required FTypography typography}) {
  final title = typography.lg.copyWith(fontWeight: .w600, color: colors.foreground);
  final body = typography.sm.copyWith(color: colors.mutedForeground);

  final horizontal = FDialogContentStyle(
    titleTextStyle: title,
    bodyTextStyle: body,
    padding: const .only(left: 16, right: 16, top: 8, bottom: 14),
    titleSpacing: 4,
    bodySpacing: 8,
    actionSpacing: 10,
  );

  return .new(
    decoration: ShapeDecoration(
      shape: RoundedSuperellipseBorder(
        side: BorderSide(color: colors.border, width: style.borderWidth),
        borderRadius: style.borderRadius.md,
      ),
      color: colors.card,
    ),
    slideableActions: FVariants(
      false,
      variants: {
        [.touch]: true,
      },
    ),
    contentStyle: FVariants(
      horizontal,
      variants: {
        [.horizontal]: horizontal,
        [.vertical]: FDialogContentStyle(
          titleTextStyle: title,
          bodyTextStyle: body,
          padding: const .only(left: 16, right: 16, top: 8, bottom: 14),
          titleSpacing: 4,
          bodySpacing: 6,
          actionSpacing: 8,
        ),
      },
    ),
  );
}