mirror of
				https://github.com/inventree/inventree-app.git
				synced 2025-10-30 21:05:42 +00:00 
			
		
		
		
	Add checkbox field helper
This commit is contained in:
		| @@ -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}) : | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user