wrapLabeledField static method

Widget wrapLabeledField({
  1. required DraftModeUIThemeData theme,
  2. required Widget field,
  3. String? label,
  4. double? bottomSpacing,
})

Implementation

static Widget wrapLabeledField({
  required DraftModeUIThemeData theme,
  required Widget field,
  String? label,
  double? bottomSpacing,
}) {
  final hasLabel = label?.trim().isNotEmpty ?? false;
  final body = hasLabel
      ? Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            Padding(
              padding: EdgeInsets.only(bottom: theme.spacingXs),
              child: Text(
                label!,
                style: labelTextStyle(theme),
              ),
            ),
            field,
          ],
        )
      : field;

  return Padding(
    padding: EdgeInsets.only(
      left: theme.rowPaddingHorizontal,
      right: theme.rowPaddingHorizontal,
      bottom: bottomSpacing ?? theme.spacingMd,
    ),
    child: body,
  );
}