Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.8.7 (2026-01-09)

- fixes [#69](https://github.com/splashbyte/animated_toggle_switch/issues/69)

## 0.8.6 (2026-01-09)

- fixes [#67](https://github.com/splashbyte/animated_toggle_switch/issues/67)
Expand Down
2 changes: 1 addition & 1 deletion example/lib/crazy_switch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class _CrazySwitchState extends State<CrazySwitch> {
const height = 58.0;
const innerIndicatorSize = height - 4 * borderWidth;

return CustomAnimatedToggleSwitch(
return CustomAnimatedToggleSwitch<bool>(
current: current,
spacing: 36.0,
values: const [false, true],
Expand Down
2 changes: 1 addition & 1 deletion example/lib/load_switch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class _LoadSwitchState extends State<LoadSwitch> {
Widget build(BuildContext context) {
const height = 50.0;
const borderWidth = 5.0;
return CustomAnimatedToggleSwitch(
return CustomAnimatedToggleSwitch<bool>(
height: height,
indicatorSize: const Size.square(height),
current: value,
Expand Down
36 changes: 24 additions & 12 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -836,12 +836,18 @@ class _MyHomePageState extends State<MyHomePage> {
);
}

Color colorBuilder(int value) => switch (value) {
0 => Colors.blueAccent,
1 => Colors.green,
2 => Colors.orangeAccent,
_ => Colors.red,
};
Color colorBuilder(int value) {
switch (value) {
case 0:
return Colors.blueAccent;
case 1:
return Colors.green;
case 2:
return Colors.orangeAccent;
default:
return Colors.red;
}
}

Widget coloredRollingIconBuilder(int value, bool foreground) {
final color = foreground ? colorBuilder(value) : null;
Expand All @@ -859,12 +865,18 @@ class _MyHomePageState extends State<MyHomePage> {
return Icon(iconDataByValue(value));
}

IconData iconDataByValue(int? value) => switch (value) {
0 => Icons.access_time_rounded,
1 => Icons.check_circle_outline_rounded,
2 => Icons.power_settings_new_rounded,
_ => Icons.lightbulb_outline_rounded,
};
IconData iconDataByValue(int? value) {
switch (value) {
case 0:
return Icons.access_time_rounded;
case 1:
return Icons.check_circle_outline_rounded;
case 2:
return Icons.power_settings_new_rounded;
default:
return Icons.lightbulb_outline_rounded;
}
}

Widget sizeIconBuilder(BuildContext context,
AnimatedToggleProperties<int> local, GlobalToggleProperties<int> global) {
Expand Down
16 changes: 16 additions & 0 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1"
url: "https://pub.dev"
source: hosted
version: "6.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -95,6 +103,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.2"
lints:
dependency: transitive
description:
name: lints
sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0
url: "https://pub.dev"
source: hosted
version: "6.0.0"
matcher:
dependency: transitive
description:
Expand Down
5 changes: 3 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ publish_to: 'none'
version: 1.0.0+1

environment:
sdk: '>=3.0.0 <4.0.0'
sdk: '>=2.17.0 <4.0.0'

dependencies:
flutter:
sdk: flutter

animated_toggle_switch:
path: ..
url_launcher: ^6.1.12
url_launcher: ^6.3.2

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^6.0.0

flutter:

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: Fully customizable, draggable and animated switch with multiple choices and smooth loading animation. It has prebuilt constructors for rolling and size animations.
version: 0.8.6
version: 0.8.7
repository: https://github.com/splashbyte/animated_toggle_switch
issue_tracker: https://github.com/splashbyte/animated_toggle_switch/issues

Expand Down