2
0
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:
Oliver Walters 2020-05-24 09:15:09 +10:00
parent e89713660b
commit c13a4d40f0

View File

@ -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}) :