mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 11:36:24 +00:00
Improve rendering for checkbox fields
This commit is contained in:
parent
5c2f747b93
commit
7a6457f870
3 changed files with 38 additions and 15 deletions
|
|
@ -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,
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestRes
|
|||
),
|
||||
CheckBoxField(
|
||||
label: L10().result,
|
||||
hint: L10().testPassedOrFailed,
|
||||
helperText: L10().testPassedOrFailed,
|
||||
initial: true,
|
||||
onSaved: (value) => _result = value ?? false,
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue