2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-13 18:55:34 +00:00

Improve rendering for checkbox fields

This commit is contained in:
Oliver
2021-07-23 12:36:03 +10:00
parent 5c2f747b93
commit 7a6457f870
3 changed files with 38 additions and 15 deletions

View File

@ -92,17 +92,23 @@ class ImagePickerField extends FormField<File> {
class CheckBoxField extends FormField<bool> {
CheckBoxField({String? label, String? hint, bool initial = false, Function(bool?)? onSaved}) :
CheckBoxField({
String? label, bool initial = false, Function(bool?)? onSaved,
TextStyle? labelStyle,
String? helperText,
TextStyle? helperStyle,
}) :
super(
onSaved: onSaved,
initialValue: initial,
builder: (FormFieldState<bool> state) {
return CheckboxListTile(
//dense: state.hasError,
title: label == null ? null : Text(label),
title: label != null ? Text(label, style: labelStyle) : null,
value: state.value,
onChanged: state.didChange,
subtitle: hint == null ? null : Text(hint),
subtitle: helperText != null ? Text(helperText, style: helperStyle) : null,
contentPadding: EdgeInsets.zero,
);
}
);