checkbox static method

ArcaneField checkbox({
  1. String? name,
  2. String? description,
  3. IconData? icon,
  4. bool defaultValue = false,
  5. required Future<bool> getter(),
  6. required Future setter(
    1. bool
    ),
})

Creates a boolean checkbox input field for toggling true/false values. This simple toggle widget is ideal for binary options in forms, integrating seamlessly with FieldWrapper and Form in the Arcane UI ecosystem for consistent boolean input handling.

Parameters:

  • name: Optional name.
  • description: Optional description.
  • icon: Optional icon.
  • defaultValue: Initial boolean state (default: false).
  • getter: Async boolean getter.
  • setter: Async boolean setter.

Returns: An ArcaneField<bool> using ArcaneBoolField builder.

Implementation

static ArcaneField checkbox(
        {String? name,
        String? description,
        IconData? icon,
        bool defaultValue = false,
        required Future<bool> Function() getter,
        required Future Function(bool) setter}) =>
    ArcaneField<bool>(
        meta: ArcaneFieldMetadata(
          name: name,
          description: description,
          icon: icon,
        ),
        provider: ArcaneFieldDirectProvider(
            defaultValue: defaultValue,
            getter: (_) => getter(),
            setter: (_, v) => setter(v)),
        builder: (context) => ArcaneBoolField());