FieldGroup constructor

FieldGroup({
  1. String? title,
  2. String? description,
  3. Object? child,
  4. List<Object?> children = const [],
  5. String? className,
  6. Map<String, Object?> props = const {},
  7. Map<String, Object?> style = const {},
  8. DartStyle? dartStyle,
})

Creates a form field group.

Implementation

FieldGroup({
  String? title,
  String? description,
  Object? child,
  List<Object?> children = const [],
  String? className,
  Map<String, Object?> props = const {},
  Map<String, Object?> style = const {},
  DartStyle? dartStyle,
}) : super(
        'section',
        props: mergeComponentProps(
          props,
          className: className,
          defaultStyle: const {'display': 'grid', 'gap': '12px'},
          dartStyle: dartStyle,
          style: style,
        ),
        children: [
          if (title != null || description != null)
            FlintElement(
              'header',
              props: const {
                'style': {'display': 'grid', 'gap': '4px'},
              },
              children: [
                if (title != null)
                  FlintElement(
                    'h3',
                    props: const {
                      'style': {'margin': 0, 'font-size': '16px'},
                    },
                    children: normalizeChildren(title, const []),
                  ),
                if (description != null)
                  FlintElement(
                    'p',
                    props: const {
                      'style': {'margin': 0, 'color': '#667085'},
                    },
                    children: normalizeChildren(description, const []),
                  ),
              ],
            ),
          ...normalizeChildren(child, children),
        ],
      );