SwitchInputField constructor

SwitchInputField({
  1. AutovalidateMode autovalidateMode = AutovalidateMode.onUserInteraction,
  2. bool enabled = true,
  3. Key? key,
  4. required FieldModel<bool, bool> field,
  5. required String title,
  6. String? helperText,
  7. int helperMaxLines = 1,
  8. Color? activeColor,
  9. Color? tileColor,
  10. Color? selectedTileColor,
  11. Color? inactiveTrackColor,
  12. Color? inactiveThumbColor,
  13. Color? activeTrackColor,
  14. Icon? icon,
  15. bool isThreeLine = false,
  16. EdgeInsetsGeometry? padding,
  17. ShapeBorder? shape,
  18. bool dense = false,
  19. bool autoFocus = false,
  20. bool selected = false,
  21. ImageProvider<Object>? inactiveThumbImage,
  22. ImageProvider<Object>? activeThumbImage,
  23. ListTileControlAffinity controlAffinity = ListTileControlAffinity.platform,
})

Implementation

SwitchInputField(
    {AutovalidateMode autovalidateMode = AutovalidateMode.onUserInteraction,
    bool enabled = true,
    Key? key,
    required FieldModel<bool, bool> field,
    required String title,
    String? helperText,
    int helperMaxLines = 1,
    Color? activeColor,
    Color? tileColor,
    Color? selectedTileColor,
    Color? inactiveTrackColor,
    Color? inactiveThumbColor,
    Color? activeTrackColor,
    Icon? icon,
    bool isThreeLine = false,
    EdgeInsetsGeometry? padding,
    ShapeBorder? shape,
    bool dense = false,
    bool autoFocus = false,
    bool selected = false,
    ImageProvider<Object>? inactiveThumbImage,
    ImageProvider<Object>? activeThumbImage,
    ListTileControlAffinity controlAffinity =
        ListTileControlAffinity.platform})
    : super(
        autovalidateMode: autovalidateMode,
        enabled: enabled,
        initialValue: field.value,
        key: key,
        onSaved: (newValue) => field.post(value: newValue ?? false),
        validator: field.validator,
        builder: (state) => SwitchListTile.adaptive(
          value: field.value,
          onChanged: (newValue) {
            field.post(value: newValue);
            state.didChange(newValue);
          },
          title: Text(title),
          activeColor: activeColor,
          secondary: icon,
          isThreeLine: isThreeLine,
          subtitle: helperText == null
              ? null
              : Text(
                  helperText,
                  maxLines: helperMaxLines,
                ),
          tileColor: tileColor,
          contentPadding: padding,
          selectedTileColor: selectedTileColor,
          key: key,
          shape: shape,
          dense: dense,
          autofocus: autoFocus,
          selected: selected,
          inactiveTrackColor: inactiveTrackColor,
          inactiveThumbColor: inactiveThumbColor,
          inactiveThumbImage: inactiveThumbImage,
          activeThumbImage: activeThumbImage,
          controlAffinity: controlAffinity,
          activeTrackColor: activeTrackColor,
        ),
      );