Skip to content

Commit b7ca69b

Browse files
authored
Merge pull request #43 from splashbyte/version0.8.0
Version0.8.0
2 parents b6cf4dd + 75015ca commit b7ca69b

7 files changed

Lines changed: 352 additions & 249 deletions

File tree

CHANGELOG.md

Lines changed: 69 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,32 @@
1-
## 0.8.0-beta.6 (2023-08-22)
2-
3-
- adds parameter to `onTap` ([#41](https://github.com/splashbyte/animated_toggle_switch/issues/41))
4-
5-
## 0.8.0-beta.5 (2023-08-18)
6-
7-
- fixes `AnimationType.onHover`
8-
9-
## 0.8.0-beta.4 (2023-08-18)
10-
11-
- BREAKING: removes `IconTheme` for controlling default size of `Icon`s
12-
- BREAKING: changes default background color from `ThemeData.scaffoldBackgroundColor` to `ThemeData.colorScheme.surface`
13-
- BREAKING: renames `dif` to `spacing` in all constructors
14-
15-
## 0.8.0-beta.3 (2023-08-11)
16-
17-
- BREAKING: replaces `transitionType` with `indicatorTransition` in `AnimatedToggleSwitch.rolling()`,
18-
`AnimatedToggleSwitch.rollingByHeight()` and `AnimatedToggleSwitch.dual()`
19-
- BREAKING: replaces `iconSize` and `selectedIconSize` in `AnimatedToggleSwitch` constructors
20-
- `rolling()`, `rollingByHeight()`, `dual()`: now uses IconTheme for controlling default size of `Icon`s
21-
- `size()`, `sizeByHeight()`: new parameter `selectedIconScale` controls scaling
22-
23-
## 0.8.0-beta.2 (2023-08-01)
24-
25-
- minor fixes
26-
- updates README
27-
28-
## 0.8.0-beta.1 (2023-07-31)
29-
30-
- adds `active` to all constructors
31-
- closes [#30](https://github.com/splashbyte/animated_toggle_switch/issues/30)
32-
- minor improvements
33-
- BREAKING: changes `separatorBuilder` parameters
34-
- BREAKING: moves all cursor parameters to `cursors`
35-
36-
## 0.8.0-beta.0 (2023-07-29)
37-
1+
## 0.8.0 (2023-09-02)
382
- adds tests for all `AnimatedToggleSwitch` constructors
393
- adds `separatorBuilder`, `customSeparatorBuilder`, `style` and `styleAnimationType` to `AnimatedToggleSwitch`
404
- adds `separatorBuilder` to `CustomAnimatedToggleSwitch`
41-
- fixes initial loading
5+
- adds `active` to all constructors ([#30](https://github.com/splashbyte/animated_toggle_switch/issues/30))
6+
- adds `styleBuilder` and `styleList` to `AnimatedToggleSwitch`
7+
- adds `iconList` to `AnimatedToggleSwitch.size`, `AnimatedToggleSwitch.sizeByHeight`, `AnimatedToggleSwitch.rolling` and `AnimatedToggleSwitch.rollingByHeight`
428
- BREAKING: moves many parameters in `AnimatedToggleSwitch` to `style`:
43-
- `innerColor` (renamed to `backgroundColor`)
44-
- `innerGradient` (renamed to `backgroundGradient`)
45-
- `borderColor`
46-
- `indicatorColor`
47-
- `borderRadius`
48-
- `indicatorBorderColor`
49-
- `indicatorBorder`
50-
- `indicatorBorder`
51-
- `foregroundBoxShadow` (renamed to `indicatorBoxShadow`)
52-
- `boxShadow`
53-
- BREAKING: merges `borderColorBuilder` with `styleBuilder`
9+
- `innerColor` (renamed to `backgroundColor`)
10+
- `innerGradient` (renamed to `backgroundGradient`)
11+
- `borderColor`
12+
- `indicatorColor`
13+
- `borderRadius`
14+
- `indicatorBorderColor`
15+
- `indicatorBorder`
16+
- `indicatorBorder`
17+
- `foregroundBoxShadow` (renamed to `indicatorBoxShadow`)
18+
- `boxShadow`
19+
- BREAKING: moves all cursor parameters to `cursors`
20+
- BREAKING: removes `borderColorBuilder` in favor of the new `styleBuilder`
5421
- BREAKING: `indicatorAnimationType` handles `ToggleStyle.indicatorColor`, `ToggleStyle.indicatorBorderRadius`, `ToggleStyle.indicatorBorder` and `ToggleStyle.indicatorBoxShadow` now
22+
- BREAKING: adds parameter to `onTap` ([#41](https://github.com/splashbyte/animated_toggle_switch/issues/41))
23+
- BREAKING: changes default background color from `ThemeData.scaffoldBackgroundColor` to `ThemeData.colorScheme.surface`
24+
- BREAKING: renames `dif` to `spacing` in all constructors
25+
- BREAKING: replaces `transitionType` with `indicatorTransition` in `AnimatedToggleSwitch.rolling()`,
26+
`AnimatedToggleSwitch.rollingByHeight()` and `AnimatedToggleSwitch.dual()`
27+
- BREAKING: removes `iconSize` and `selectedIconSize` in `AnimatedToggleSwitch` constructors
28+
- `rolling()`, `rollingByHeight()`, `dual()`: new parameter `selectedIconScale` controls scaling now
29+
- `size()`, `sizeByHeight()`: new parameter `indicatorIconScale` controls scaling now
5530

5631
## 0.7.0 (2023-06-19)
5732

@@ -69,94 +44,94 @@
6944
## 0.6.0 (2022-12-22)
7045

7146
- fixes README
72-
- fixes #28
73-
- BREAKING: Increases minimum SDK to 2.17
74-
- BREAKING: Renames `value` to `current` and `previousValue` to `previous` in `DetailedGlobalToggleProperties`
75-
- BREAKING Feature: Adds loading animation to all switches. You can disable it by setting `loading` to false.
76-
- Adds `innerGradient` to `AnimatedToggleSwitch`
77-
- Adds `transitionType` to `AnimatedToggleSwitch.rolling`, `AnimatedToggleSwitch.rollingByHeight` and `AnimatedToggleSwitch.dual`
47+
- fixes ([#28](https://github.com/splashbyte/animated_toggle_switch/issues/28))
48+
- BREAKING: increases minimum SDK to 2.17
49+
- BREAKING: renames `value` to `current` and `previousValue` to `previous` in `DetailedGlobalToggleProperties`
50+
- BREAKING feature: Adds loading animation to all switches. You can disable it by setting `loading` to false.
51+
- adds `innerGradient` to `AnimatedToggleSwitch`
52+
- adds `transitionType` to `AnimatedToggleSwitch.rolling`, `AnimatedToggleSwitch.rollingByHeight` and `AnimatedToggleSwitch.dual`
7853

7954
## 0.5.2 (2022-04-22)
8055

81-
- Minor performance improvement
82-
- Minor fixes
83-
- Improves code documentation
84-
- Adds `dragCursor` and `draggingCursor` to `CustomAnimatedToggleSwitch`
85-
- Adds `iconsTappable`, `defaultCursor`, `dragCursor` and `draggingCursor` to `AnimatedToggleSwitch`
56+
- minor performance improvement
57+
- minor fixes
58+
- improves code documentation
59+
- adds `dragCursor` and `draggingCursor` to `CustomAnimatedToggleSwitch`
60+
- adds `iconsTappable`, `defaultCursor`, `dragCursor` and `draggingCursor` to `AnimatedToggleSwitch`
8661

8762
## 0.5.1 (2022-04-21)
8863

89-
- Fixes #20
64+
- fixes ([#20](https://github.com/splashbyte/animated_toggle_switch/issues/20))
9065

9166
## 0.5.0 (2022-04-20)
9267

93-
- Minor performance improvement
94-
- Fixes problems with tight constraints
95-
- BREAKING: Changes default values of `animationOffset` and `clipAnimation` in `AnimatedToggleSwitch.dual`
68+
- minor performance improvement
69+
- fixes problems with tight constraints
70+
- BREAKING: changes default values of `animationOffset` and `clipAnimation` in `AnimatedToggleSwitch.dual`
9671

9772
## 0.4.0 (2022-04-03)
9873

99-
- Minor fixes and performance improvements
100-
- Adds `indicatorBorderRadius` to `AnimatedToggleSwitch`
101-
- Adds `animationOffset`, `clipAnimation` and `opacityAnimation` to `AnimatedToggleSwitch.dual`
102-
- BREAKING: Sets default values of `animationOffset`, `clipAnimation` and `opacityAnimation` in `AnimatedToggleSwitch.dual`
103-
- BREAKING: Renames `foregroundBorder` to `indicatorBorder`
74+
- minor fixes and performance improvements
75+
- adds `indicatorBorderRadius` to `AnimatedToggleSwitch`
76+
- adds `animationOffset`, `clipAnimation` and `opacityAnimation` to `AnimatedToggleSwitch.dual`
77+
- BREAKING: sets default values of `animationOffset`, `clipAnimation` and `opacityAnimation` in `AnimatedToggleSwitch.dual`
78+
- BREAKING: renames `foregroundBorder` to `indicatorBorder`
10479

10580
## 0.3.1 (2022-03-23)
10681

107-
- Minor fixes
82+
- minor fixes
10883

10984
## 0.3.0 (2022-03-21)
11085

111-
- Introduces `CustomAnimatedToggleSwitch` for maximum customizability
112-
- Most constructors of `AnimatedToggleSwitch` have a standard and a more customizable parameter for their builders now
113-
- Full support of `TextDirection.rtl`
114-
- Adds animation when dragging the switch
115-
- Adds `minTouchTargetSize`, `dragStartDuration`, `dragStartCurve` and `textDirection` to `AnimatedToggleSwitch`
86+
- introduces `CustomAnimatedToggleSwitch` for maximum customizability
87+
- most constructors of `AnimatedToggleSwitch` have a standard and a more customizable parameter for their builders now
88+
- full support of `TextDirection.rtl`
89+
- adds animation when dragging the switch
90+
- adds `minTouchTargetSize`, `dragStartDuration`, `dragStartCurve` and `textDirection` to `AnimatedToggleSwitch`
11691
- BREAKING: `TextDirection` is taken from `BuildContext` by default now!!!
117-
- BREAKING: Changes parameters and names of some builders
118-
- BREAKING: Renames `AnimatedToggleSwitch.byHeight` to `AnimatedToggleSwitch.customByHeight`
119-
- BREAKING: Adds default `textMargin` to `AnimatedToggleSwitch.dual`
120-
- Fixes #9
92+
- BREAKING: changes parameters and names of some builders
93+
- BREAKING: renames `AnimatedToggleSwitch.byHeight` to `AnimatedToggleSwitch.customByHeight`
94+
- BREAKING: adds default `textMargin` to `AnimatedToggleSwitch.dual`
95+
- fixes ([#9](https://github.com/splashbyte/animated_toggle_switch/issues/9))
12196

12297
## 0.2.3 (2022-02-28)
12398

124-
- BREAKING: Removes `indicatorType`
125-
- BREAKING: Changes default `innerColor`
126-
- Adds `BoxShadow` parameters
99+
- BREAKING: removes `indicatorType`
100+
- BREAKING: changes default `innerColor`
101+
- adds `BoxShadow` parameters
127102

128103
## 0.2.2 (2022-01-27)
129104

130-
- Minor performance improvements
105+
- minor performance improvements
131106

132107
## 0.2.2 (2022-01-27)
133108

134-
- Minor changes/fixes
109+
- minor changes/fixes
135110

136111
## 0.2.1 (2021-10-03)
137112

138-
- Migrates to Flutter 2.5
139-
- Minor changes/fixes
113+
- migrates to Flutter 2.5
114+
- minor changes/fixes
140115

141116
## 0.2.0 (2021-05-21)
142117

143-
- Minor Changes
144-
- Fixes `FittingMode.preventHorizontalOverlapping`
145-
- Improves Web support
118+
- minor Changes
119+
- fixes `FittingMode.preventHorizontalOverlapping`
120+
- improves Web support
146121

147122
## 0.1.3 (2021-03-27)
148123

149-
- Updates README.md
124+
- updates README.md
150125

151126
## 0.1.2 (2021-03-27)
152127

153-
- Adds `AnimatedToggleSwitch.dual`
154-
- Adds some settings (`AnimationType`)
128+
- adds `AnimatedToggleSwitch.dual`
129+
- adds some settings (`AnimationType`)
155130

156131
## 0.1.1 (2021-03-26)
157132

158-
- Minor fix
133+
- minor fix
159134

160135
## 0.1.0 (2021-03-26)
161136

162-
- Initial release
137+
- initial release

README.md

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
[![buy me a coffee](https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20pizza&emoji=🍕&slug=splashbyte&button_colour=FF8838&font_colour=ffffff&font_family=Poppins&outline_colour=000000&coffee_colour=ffffff')](https://www.buymeacoffee.com/splashbyte)
1212

13-
### If you like this package, please leave a like there on [pub.dev](https://pub.dev/packages/animated_toggle_switch) and star on [GitHub](https://github.com/SplashByte/animated_toggle_switch).
13+
### If you like this package, please like it on [pub.dev](https://pub.dev/packages/animated_toggle_switch) and star it on [GitHub](https://github.com/SplashByte/animated_toggle_switch).
1414

1515
Fully customizable, draggable and animated switch with multiple choices and [smooth loading animation](#loading-animation). It has prebuilt constructors for rolling and size animations, but it also allows you to create your own switches with `CustomAnimatedToggleSwitch`.
1616
`LTR` and `RTL` are both supported.
1717
[Switches without an (initial) selection](#nullable-selection) are also possible.
18-
Most builder arguments of `AnimatedToggleSwitch` have a standard and a custom version. This ensures that you can get started easily and still customize a lot if necessary.
18+
Most builder arguments of `AnimatedToggleSwitch` have a standard and a custom version. This ensures that you can [get started easily](#simple-rolling-animation) and still customize a lot if necessary. There are several options for [styling](#styling) it.
1919

2020
For a slider with a similar look you can check out [action_slider](https://pub.dev/packages/action_slider).
2121

@@ -26,16 +26,14 @@ For a slider with a similar look you can check out [action_slider](https://pub.d
2626
`AnimatedToggleSwitch.dual()`
2727
![animated_toggle_switch_example_dual](https://user-images.githubusercontent.com/43761463/161432631-e6dd3d16-7b64-410b-a9fa-c956d3442598.gif)
2828
![animated_toggle_switch_example_borderradius_builder](https://github.com/splashbyte/animated_toggle_switch/assets/43761463/ee615f64-d897-43f1-b508-0318805195e4)
29-
![animated_toggle_switch_example_lite_rolling_gradient](https://github.com/splashbyte/animated_toggle_switch/assets/43761463/6cd5d2d3-b4bd-4020-8568-354c71221e40)
29+
![animated_toggle_switch_example_gradient](https://github.com/splashbyte/animated_toggle_switch/assets/43761463/b0d390fc-cd18-45ad-b2ce-61e453f098ad)
3030

3131
Switch inspired by [lite_rolling_switch](https://pub.dev/packages/lite_rolling_switch) (made with `AnimatedToggleSwitch.dual()`)
32-
![animated_toggle_switch_example_lite_rolling](https://github.com/splashbyte/animated_toggle_switch/assets/43761463/f1bec7cd-4885-4e8d-ac13-176d6b46245a)
33-
32+
![animated_toggle_switch_example_lite_rolling_switch](https://github.com/splashbyte/animated_toggle_switch/assets/43761463/34751d16-cbb1-42b5-a14d-6bd3340d676a)
3433

3534
Switch inspired by [toggle_switch](https://pub.dev/packages/toggle_switch) (made with `AnimatedToggleSwitch.size()`)
3635
![animated_toggle_switch_example_toggle_switch](https://github.com/splashbyte/animated_toggle_switch/assets/43761463/884c8433-3b11-4fe1-b2a8-c02599c56aee)
3736

38-
3937
Switch inspired by [crazy-switch](https://github.com/pedromassango/crazy-switch) (made with `CustomAnimatedToggleSwitch()`)
4038
![animated_toggle_switch_example_crazy_switch](https://github.com/splashbyte/animated_toggle_switch/assets/43761463/106afaf5-88a0-4d4b-ad59-2b22182d18be)
4139

@@ -58,7 +56,8 @@ You can build any other switch with `CustomAnimatedToggleSwitch()`
5856
![animated_toggle_switch_example_6](https://user-images.githubusercontent.com/43761463/161432744-f60b660d-30d9-4d1d-9b87-14b62bc54e39.gif)
5957

6058
`AnimatedToggleSwitch.rolling()` with custom `indicatorSize`, `borderRadius` and `indicatorBorderRadius`
61-
![animated_toggle_switch_example_7](https://user-images.githubusercontent.com/43761463/161432823-6cf3c855-2a9a-4f4a-9e5c-2951c4166f49.gif) ![animated_toggle_switch_example_8](https://user-images.githubusercontent.com/43761463/161432826-4b0c3e57-eed7-4567-8e7e-31b8a2ba6bee.gif)
59+
![animated_toggle_switch_example_7](https://user-images.githubusercontent.com/43761463/161432823-6cf3c855-2a9a-4f4a-9e5c-2951c4166f49.gif)
60+
![animated_toggle_switch_example_8](https://user-images.githubusercontent.com/43761463/161432826-4b0c3e57-eed7-4567-8e7e-31b8a2ba6bee.gif)
6261

6362
## Easy Usage
6463

@@ -72,13 +71,14 @@ AnimatedToggleSwitch<int>.rolling(
7271
values: [0, 1, 2, 3],
7372
onChanged: (i) => setState(() => value = i),
7473
iconBuilder: iconBuilder,
74+
// iconList: [...], you can use iconBuilder, customIconBuilder or iconList
7575
style: ToggleStyle(...), // optional style settings
7676
... // many more parameters available
7777
)
7878
```
7979

8080
### Styling
81-
`style`, `styleBuilder` and `customStyleBuilder` can be used to style the switch.
81+
`style`, `styleBuilder`, `customStyleBuilder` and `styleList` can be used to style an `AnimatedToggleSwitch`.
8282
For the general look of the switch, you can use `style`.
8383
For parameters that should change with the selection, you can use `styleBuilder`.
8484
If you need additional parameters, you can use `customStyleBuilder`.
@@ -141,29 +141,36 @@ CustomAnimatedToggleSwitch<int>(
141141
```
142142

143143
### `AnimatedToggleSwitch.size` with some settings
144-
![animated_toggle_switch_example_4](https://user-images.githubusercontent.com/43761463/161432714-435d8369-7e54-432a-8b9b-6b55a0764f4a.gif)
144+
![animated_toggle_switch_example_size](https://github.com/splashbyte/animated_toggle_switch/assets/43761463/805a0e3f-b3a2-4801-baf9-7a5509905452)
145145
```dart
146146
AnimatedToggleSwitch<int>.size(
147+
textDirection: TextDirection.rtl,
147148
current: value,
148149
values: const [0, 1, 2, 3],
149150
iconOpacity: 0.2,
150151
indicatorSize: const Size.fromWidth(100),
152+
iconBuilder: iconBuilder,
153+
borderWidth: 4.0,
151154
iconAnimationType: AnimationType.onHover,
152-
colorAnimationType: AnimationType.onHover,
153-
iconBuilder: (value, size) {
154-
IconData data = Icons.access_time_rounded;
155-
if (value.isEven) data = Icons.cancel;
156-
return Icon(data, size: min(size.width, size.height));
157-
},
158-
style: const ToggleStyle(borderColor: Colors.transparent),
159-
borderWidth: 0.0,
160-
styleBuilder: (i) => ToggleStyle(indicatorColor: i.isEven == true ? Colors.amber : Colors.red),
155+
style: ToggleStyle(
156+
borderColor: Colors.transparent,
157+
borderRadius: BorderRadius.circular(10.0),
158+
boxShadow: [
159+
BoxShadow(
160+
color: Colors.black26,
161+
spreadRadius: 1,
162+
blurRadius: 2,
163+
offset: Offset(0, 1.5),
164+
),
165+
],
166+
),
167+
styleBuilder: (i) => ToggleStyle(indicatorColor: colorBuilder(i)),
161168
onChanged: (i) => setState(() => value = i),
162169
)
163170
```
164171

165172
### Self-made rolling animation (with `foregroundIndicatorIconBuilder`)
166-
![animated_toggle_switch_example_6](https://user-images.githubusercontent.com/43761463/161432744-f60b660d-30d9-4d1d-9b87-14b62bc54e39.gif)
173+
![animated_toggle_switch_example_6](https://user-images.githubusercontent.com/43761463/161432744-f60b660d-30d9-4d1d-9b87-14b62bc54e39.gif)
167174
```dart
168175
AnimatedToggleSwitch<int>.size(
169176
current: value,

0 commit comments

Comments
 (0)