Skip to content

Commit

Permalink
adds code example for loading animation to README
Browse files Browse the repository at this point in the history
  • Loading branch information
maeddin committed Dec 22, 2022
1 parent 6845a38 commit 2d56a24
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.6.1 (2022-12-22)
- adds examples for loading animation to README

## 0.6.0 (2022-12-22)
- fixes README
- fixes #28
Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Modified `AnimatedToggleSwitch.size()`

Easy to use and highly customizable.

### Simple Rolling Animation
### Simple rolling animation

```dart
AnimatedToggleSwitch<int>.rolling(
Expand All @@ -70,6 +70,25 @@ AnimatedToggleSwitch<int>.rolling(
)
```

### Simple rolling animation with loading
To use the loading animation, you simply have to return a future in `onChanged` or `onTap`.
You can alternatively control the loading manually with the `loading` parameter.
Hence, to disable the loading animation, `loading: false` must be set.

```dart
AnimatedToggleSwitch<int>.rolling(
current: value,
values: [0, 1, 2, 3],
onChanged: (i) {
setState(() => value = i);
return Future.delayed(Duration(seconds: 3));
},
loading: false, // for deactivating loading animation
iconBuilder: iconBuilder,
... // many more parameters available
)
```

### Fully customizable toggle switch with `CustomAnimatedToggleSwitch`

```dart
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: animated_toggle_switch
description: Simple and animated toggle switch for multiple choices and loading animation. It's a good alternative if you don't want to use something like a dropdown menu.
version: 0.6.0
version: 0.6.1
repository: https://github.com/SplashByte/animated_toggle_switch

environment:
Expand Down

0 comments on commit 2d56a24

Please sign in to comment.