Field.chips constructor
Field.chips(
- String key, {
- dynamic value,
- FormValidator? validate,
- bool autofocus = false,
- String? dummyData,
- Widget? header,
- TextStyle? titleStyle,
- dynamic style,
- Map<
String, NyTextField Function(NyTextField nyTextField)> ? metaData = const {}, - required List options,
- Color? backgroundColor,
- Color? selectedColor,
- double headerSpacing = 5,
- OutlinedBorder shape = const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(8))),
- BorderSide unselectedSide = const BorderSide(color: Colors.grey, width: 1),
- BorderSide selectedSide = const BorderSide(color: Colors.grey, width: 1),
- TextStyle labelStyle = const TextStyle(fontWeight: FontWeight.bold, color: Colors.black),
- TextStyle unselectedTextStyle = const TextStyle(fontWeight: FontWeight.bold, color: Colors.black),
- TextStyle selectedTextStyle = const TextStyle(fontWeight: FontWeight.bold, color: Colors.white),
- EdgeInsets padding = const EdgeInsets.all(8.0),
- double runSpacing = 8.0,
- double spacing = 8.0,
- Color checkmarkColor = Colors.white,
Field.chips is a constructor that helps in managing chips fields
Implementation
Field.chips(
this.key, {
this.value,
this.validate,
this.autofocus = false,
this.dummyData,
this.header,
this.footer,
this.titleStyle,
this.style,
this.metaData = const {},
this.hidden = false,
required List<dynamic> options,
Color? backgroundColor,
Color? selectedColor,
double headerSpacing = 5,
double footerSpacing = 5,
OutlinedBorder shape = const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(8))),
BorderSide unselectedSide = const BorderSide(color: Colors.grey, width: 1),
BorderSide selectedSide = const BorderSide(color: Colors.grey, width: 1),
TextStyle labelStyle =
const TextStyle(fontWeight: FontWeight.bold, color: Colors.black),
TextStyle unselectedTextStyle =
const TextStyle(fontWeight: FontWeight.bold, color: Colors.black),
TextStyle selectedTextStyle =
const TextStyle(fontWeight: FontWeight.bold, color: Colors.white),
EdgeInsets padding = const EdgeInsets.all(8.0),
double runSpacing = 8.0,
double spacing = 8.0,
Color checkmarkColor = Colors.white,
}) : cast = FormCast.chips(
options: options,
backgroundColor: backgroundColor,
selectedColor: selectedColor,
headerSpacing: headerSpacing,
footerSpacing: footerSpacing,
shape: shape,
unselectedSide: unselectedSide,
selectedSide: selectedSide,
labelStyle: labelStyle,
unselectedTextStyle: unselectedTextStyle,
selectedTextStyle: selectedTextStyle,
padding: padding,
runSpacing: runSpacing,
spacing: spacing,
checkmarkColor: checkmarkColor) {
if (style == null) return;
metaData = {};
if (style is String) {
style = style;
return;
}
if (style is Map) {
style as Map<String, dynamic>;
metaData!["decoration_style"] =
(style as Map<String, dynamic>).entries.first.value;
style = (style as Map<String, dynamic>).entries.first.key;
}
}