wrapLabeledField static method
Widget
wrapLabeledField({
- required DraftModeUIThemeData theme,
- required Widget field,
- String? label,
- 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,
);
}