mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 11:36:24 +00:00
Add checkbox field helper
This commit is contained in:
parent
e89713660b
commit
c13a4d40f0
1 changed files with 18 additions and 0 deletions
|
|
@ -2,6 +2,24 @@
|
||||||
import 'package:flutter/material.dart';
|
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 {
|
class StringField extends TextFormField {
|
||||||
|
|
||||||
StringField({String label, String hint, String initial, Function onSaved, Function validator, bool allowEmpty = false}) :
|
StringField({String label, String hint, String initial, Function onSaved, Function validator, bool allowEmpty = false}) :
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue