api_toggle

Last updated:

0 purchases

api_toggle Image
api_toggle Images
Add to Cart

Description:

api toggle

ApiToggle #


API toggle widget - it helps not to call the API multiple times when repeatedly clicking on a widget.
Usage #
Find the example wiring in the example app
Installation #
Add the following line to pubspec.yaml:
dependencies:
api_toggle: ^1.0.1
copied to clipboard
Add the following import to your Dart code:
import 'package:api_toggle/api_toggle.dart';
copied to clipboard
Api Toggle Widget #
ApiToggle(
activated: isActivated,
delay: 1000,
disabledChild: const Icon(
Icons.favorite,
color: Colors.grey,
size: 100,
),
enabledChild: const Icon(
Icons.favorite,
color: Colors.redAccent,
size: 100,
),
onTrigger: (activated) {
if (activated) {
// write functions call API
setState(() {
callApiCount = callApiCount + 1;
});
}
},
onTap: (activated) {
// write other functions that are not API calls
setState(() {
heartCount = activated ? heartCount + 1 : heartCount - 1;
isActivated = activated;
});
},
);
copied to clipboard
ScreenShots #

Android #
|
| :------------:

Issues and feedback #
Please file issues to send feedback or report a bug. Thank you!
License #
MIT License

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.