CheckboxIconFormField constructor

CheckboxIconFormField({
  1. Key? key,
  2. BuildContext? context,
  3. FormFieldSetter<bool>? onSaved,
  4. bool initialValue = false,
  5. ValueChanged<bool>? onChanged,
  6. AutovalidateMode? autovalidateMode,
  7. bool enabled = true,
  8. IconData trueIcon = Icons.check,
  9. IconData falseIcon = Icons.check_box_outline_blank,
  10. Color? trueIconColor,
  11. Color? falseIconColor,
  12. Color? disabledColor,
  13. double padding = 24.0,
  14. double? iconSize,
})

Implementation

CheckboxIconFormField({
  Key? key,
  BuildContext? context,
  FormFieldSetter<bool>? onSaved,
  bool initialValue = false,
  ValueChanged<bool>? onChanged,
  AutovalidateMode? autovalidateMode,
  bool enabled = true,
  IconData trueIcon = Icons.check,
  IconData falseIcon = Icons.check_box_outline_blank,
  Color? trueIconColor,
  Color? falseIconColor,
  Color? disabledColor,
  double padding = 24.0,
  double? iconSize,
}) : super(
        key: key,
        onSaved: onSaved,
        initialValue: initialValue,
        autovalidateMode: autovalidateMode,
        builder: (FormFieldState<bool> state) {
          trueIconColor ??= (context == null
              ? null
              : Theme.of(context).colorScheme.secondary);

          return Padding(
              padding: EdgeInsets.all(padding),
              child: state.value!
                  ? _createTappableIcon(state, enabled, trueIcon, onChanged,
                      trueIconColor, disabledColor, iconSize)
                  : _createTappableIcon(state, enabled, falseIcon, onChanged,
                      falseIconColor, disabledColor, iconSize));
        },
      );