ReactiveSwitchListTile constructor

ReactiveSwitchListTile({
  1. Key? key,
  2. String? formControlName,
  3. FormControl<bool>? formControl,
  4. Color? tileColor,
  5. Color? activeColor,
  6. Color? activeTrackColor,
  7. Color? inactiveThumbColor,
  8. Color? inactiveTrackColor,
  9. Color? hoverColor,
  10. ImageProvider<Object>? activeThumbImage,
  11. ImageProvider<Object>? inactiveThumbImage,
  12. Widget? title,
  13. Widget? subtitle,
  14. bool isThreeLine = false,
  15. bool? dense,
  16. bool selected = false,
  17. bool autofocus = false,
  18. EdgeInsetsGeometry? contentPadding,
  19. Widget? secondary,
  20. ListTileControlAffinity controlAffinity = ListTileControlAffinity.platform,
  21. ShapeBorder? shape,
  22. Color? selectedTileColor,
  23. VisualDensity? visualDensity,
  24. bool? enableFeedback,
  25. FocusNode? focusNode,
  26. ReactiveFormFieldCallback<bool>? onChanged,
})

Create an instance of a ReactiveCheckbox.

The formControlName arguments must not be null.

See also CheckboxListTile

Implementation

ReactiveSwitchListTile({
  Key? key,
  String? formControlName,
  FormControl<bool>? formControl,
  Color? tileColor,
  Color? activeColor,
  Color? activeTrackColor,
  Color? inactiveThumbColor,
  Color? inactiveTrackColor,
  Color? hoverColor,
  ImageProvider? activeThumbImage,
  ImageProvider? inactiveThumbImage,
  Widget? title,
  Widget? subtitle,
  bool isThreeLine = false,
  bool? dense,
  bool selected = false,
  bool autofocus = false,
  EdgeInsetsGeometry? contentPadding,
  Widget? secondary,
  ListTileControlAffinity controlAffinity = ListTileControlAffinity.platform,
  ShapeBorder? shape,
  Color? selectedTileColor,
  VisualDensity? visualDensity,
  bool? enableFeedback,
  FocusNode? focusNode,
  ReactiveFormFieldCallback<bool>? onChanged,
}) : super(
        key: key,
        formControl: formControl,
        formControlName: formControlName,
        focusNode: focusNode,
        builder: (field) {
          return SwitchListTile(
            value: field.value ?? false,
            activeColor: activeColor,
            activeTrackColor: activeTrackColor,
            inactiveThumbColor: inactiveThumbColor,
            inactiveTrackColor: inactiveTrackColor,
            hoverColor: hoverColor,
            activeThumbImage: activeThumbImage,
            title: title,
            subtitle: subtitle,
            isThreeLine: isThreeLine,
            dense: dense,
            contentPadding: contentPadding,
            secondary: secondary,
            inactiveThumbImage: inactiveThumbImage,
            tileColor: tileColor,
            selected: selected,
            autofocus: autofocus,
            controlAffinity: controlAffinity,
            shape: shape,
            selectedTileColor: selectedTileColor,
            visualDensity: visualDensity,
            enableFeedback: enableFeedback,
            focusNode: field.focusNode,
            onChanged: field.control.enabled
                ? (value) {
                    field.didChange(value);
                    onChanged?.call(field.control);
                  }
                : null,
          );
        },
      );