Figure constructor

Figure({
  1. required Object image,
  2. Object? caption,
  3. String? className,
  4. Map<String, Object?> props = const {},
  5. Map<String, Object?> style = const {},
  6. DartStyle? dartStyle,
  7. DartStyle? captionStyle,
  8. Map<String, Object?> captionProps = const {},
})

Creates a figure from image and optional caption.

Implementation

Figure({
  required Object image,
  Object? caption,
  String? className,
  Map<String, Object?> props = const {},
  Map<String, Object?> style = const {},
  DartStyle? dartStyle,
  DartStyle? captionStyle,
  Map<String, Object?> captionProps = const {},
}) : super(
        'figure',
        props: mergeComponentProps(
          props,
          className: className,
          defaultStyle: const {
            'display': 'grid',
            'gap': '8px',
            'margin': '0'
          },
          dartStyle: dartStyle,
          style: style,
        ),
        children: [
          toFlintNode(image),
          if (caption != null)
            FlintElement(
              'figcaption',
              props: mergeComponentProps(
                captionProps,
                defaultStyle: const {
                  'color': '#667085',
                  'font-size': '14px',
                  'line-height': '1.5',
                },
                dartStyle: captionStyle,
              ),
              children: normalizeChildren(caption, const []),
            ),
        ],
      );