mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 13:36:50 +00:00
Add checkbox field helper
This commit is contained in:
parent
e89713660b
commit
c13a4d40f0
@ -2,6 +2,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class CheckBoxField extends FormField<bool> {
|
||||
CheckBoxField({String label, String hint, bool initial = false, Function onSaved}) :
|
||||
super(
|
||||
onSaved: onSaved,
|
||||
initialValue: initial,
|
||||
builder: (FormFieldState<bool> state) {
|
||||
return CheckboxListTile(
|
||||
//dense: state.hasError,
|
||||
title: label == null ? null : Text(label),
|
||||
value: state.value,
|
||||
onChanged: state.didChange,
|
||||
subtitle: hint == null ? null : Text(hint),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
class StringField extends TextFormField {
|
||||
|
||||
StringField({String label, String hint, String initial, Function onSaved, Function validator, bool allowEmpty = false}) :
|
||||
|
Loading…
x
Reference in New Issue
Block a user