A highly customizable toggle switch with a loading state

Minimal code

bool value = false;

Future<bool> _getFuture() async {
    await Future.delayed(const Duration(seconds: 2));
    return !value;
}

LoadSwitch(
    value: value,
    future: _getFuture,
    onChange: (v) {
        value = v;
        print('Value changed to $v');
        setState(() {});
    },
    onTap: (v) {
        print('Tapping while value is $v');
    },
)

Issues / Features

Found a bug or want a new feature? Open an issue in the Github repository of the project.

GitHub

View Github