Skip to content

Commit

Permalink
version 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PramodJoshi committed Apr 23, 2023
1 parent 58d97ee commit 9838215
Show file tree
Hide file tree
Showing 14 changed files with 855 additions and 499 deletions.
26 changes: 19 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
## 2.1.0
* Added cancel toggle function ([PR 77](https://github.com/PramodJoshi/toggle_switch/pull/77/files)):
- function:
- cancelToggle: (index) {} (return type - Future\<bool>)
* Added these options [PR 74](https://github.com/PramodJoshi/toggle_switch/pull/74/files)):
- center text:
- centerText (optional, type bool - default false)
- multi-line text:
- multiLineText (optional, type bool - default false)
- inherit activeFgColor and inactiveFgColor in customTextStyles
* Null safety improvements ([PR 68](https://github.com/PramodJoshi/toggle_switch/pull/68/files))

## 2.0.1
* Added vertical toggle switch option ([PR 51](https://github.com/PramodJoshi/toggle_switch/pull/51/files)):
- parameter:
- isVertical (type bool - default false)
* Added active borders option (Partial implementation from [PR 53](https://github.com/PramodJoshi/toggle_switch/pull/53/files)):
- parameter:
- activeBorders (optional, type List<Border>)
- activeBorders (optional, type List\<Border>)
- list with only one Border value will apply that Border to all the active switches
- different Border values can be provided for different switches
* Added divider margin option:
Expand All @@ -25,7 +37,7 @@
- textDirectionRTL (optional, type bool - default false)
* Added custom widths support
- parameter:
- customWidths (optional, type List<double>)
- customWidths (optional, type List\<double>)

## 1.3.0
* Added null support for initialLabelIndex ([PR 39](https://github.com/PramodJoshi/toggle_switch/pull/39/commits)).
Expand All @@ -40,13 +52,13 @@
## 1.2.0
* Added custom icons support:
- parameter:
- customIcons (optional, type List<Icon>)
- customIcons (optional, type List\<Icon>)
- customIcons will overwrite 'icons:'

## 1.1.0
* Added custom text styles support:
- parameter:
- customTextStyles (optional, type List<TextStyle>)
- customTextStyles (optional, type List\<TextStyle>)
- text style can now be configured for individual switches
* Added text or icon support:
- icons parameter now accepts null value (check examples)
Expand All @@ -58,15 +70,15 @@
* Labels parameter is now optional.
* Added border color and border width support:
- parameters:
- borderColor (optional, type List<Color> for gradient colors support)
- borderColor (optional, type List\<Color> for gradient colors support)
- borderWidth (optional, type double)
* Added divider color support:
- dividerColor (optional, type Color)
* Added gradient colors support for active backgrounds:
- activeBgColor and activeBgColors now take an array of Color instead of just Color (check examples)
- parameters:
- activeBgColor (optional, type List<Color>)
- activeBgColors (optional, type List<List<Color>>)
- activeBgColor (optional, type List\<Color>)
- activeBgColors (optional, type List\<List\<Color>>)
* Added animation support:
- parameters:
- animate (optional, type bool):
Expand Down
90 changes: 89 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In the `pubspec.yaml` of your flutter project, add the following dependency:
```yaml
dependencies:
...
toggle_switch: ^2.0.1
toggle_switch: ^2.1.0
```
Import it:
Expand Down Expand Up @@ -353,6 +353,94 @@ SingleChildScrollView(

![Custom widths greater than device width](https://media.giphy.com/media/ZkF9MlIm9y1H9baWrZ/giphy.gif)

### Multi-line text with custom text style inheriting activeFgColor and inactiveFgColor

```dart
ToggleSwitch(
initialLabelIndex: 0,
minHeight: 100.0,
minWidth: 100.0,
activeBgColor: [Colors.blueAccent.shade200],
activeFgColor: Colors.yellow,
customTextStyles: [
TextStyle(
fontSize: 15.0
)
],
multiLineText: true,
centerText: true,
totalSwitches: 2,
labels: ['This is multi-line text.', 'One line'],
onToggle: (index) {
print('switched to: $index');
},
),
```

![Multi-line text with custom text style inheriting activeFgColor and inactiveFgColor](https://media.giphy.com/media/qNg3CCKpd06rvQp6GY/giphy.gif)

### Cancel toggle

```dart
ToggleSwitch(
initialLabelIndex: 0,
inactiveBgColor: Colors.black54,
activeBgColor: [Colors.black],
totalSwitches: 3,
minHeight: 80.0,
minWidth: 80.0,
customIcons: [
Icon(
FontAwesomeIcons.bitcoin,
color: Color(0xFFF2A900),
size: 50.0,
),
Icon(
FontAwesomeIcons.ethereum,
color: Color(0xFF5ca6ce),
size: 50.0,
),
Icon(
FontAwesomeIcons.dollarSign,
color: Colors.green.shade700,
size: 50.0,
)
],
onToggle: (index) {
print('switched to: $index');
},
cancelToggle: (index) async {
String selection = index == 0
? 'Bitcoin'
: index == 1
? 'Ethereum'
: 'Fiat';
return await showDialog(
context: context,
builder: (dialogContext) => AlertDialog(
content: Text("Select $selection?"),
actions: [
TextButton(
child: Text("No",
style: TextStyle(color: Colors.red)),
onPressed: () {
Navigator.pop(dialogContext, true);
}),
TextButton(
child: Text("Yes",
style: TextStyle(color: Colors.black)),
onPressed: () {
Navigator.pop(dialogContext, false);
})
],
),
);
},
),
```

![Cancel toggle](https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExZWNhOGJhNjMzNWNjNmNmOWYwMGI0Nzc3YWEyNjdhYTIyNTRmMDQ2MSZlcD12MV9pbnRlcm5hbF9naWZzX2dpZklkJmN0PWc/qHB8oy90lXIfyQE0vi/giphy.gif)

### TextDirection.rtl and corner radius

```dart
Expand Down
90 changes: 89 additions & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In the `pubspec.yaml` of your flutter project, add the following dependency:
```yaml
dependencies:
...
toggle_switch: ^2.0.1
toggle_switch: ^2.1.0
```
Import it:
Expand Down Expand Up @@ -353,6 +353,94 @@ SingleChildScrollView(

![Custom widths greater than device width](https://media.giphy.com/media/ZkF9MlIm9y1H9baWrZ/giphy.gif)

### Multi-line text with custom text style inheriting activeFgColor and inactiveFgColor

```dart
ToggleSwitch(
initialLabelIndex: 0,
minHeight: 100.0,
minWidth: 100.0,
activeBgColor: [Colors.blueAccent.shade200],
activeFgColor: Colors.yellow,
customTextStyles: [
TextStyle(
fontSize: 15.0
)
],
multiLineText: true,
centerText: true,
totalSwitches: 2,
labels: ['This is multi-line text.', 'One line'],
onToggle: (index) {
print('switched to: $index');
},
),
```

![Multi-line text with custom text style inheriting activeFgColor and inactiveFgColor](https://media.giphy.com/media/qNg3CCKpd06rvQp6GY/giphy.gif)

### Cancel toggle

```dart
ToggleSwitch(
initialLabelIndex: 0,
inactiveBgColor: Colors.black54,
activeBgColor: [Colors.black],
totalSwitches: 3,
minHeight: 80.0,
minWidth: 80.0,
customIcons: [
Icon(
FontAwesomeIcons.bitcoin,
color: Color(0xFFF2A900),
size: 50.0,
),
Icon(
FontAwesomeIcons.ethereum,
color: Color(0xFF5ca6ce),
size: 50.0,
),
Icon(
FontAwesomeIcons.dollarSign,
color: Colors.green.shade700,
size: 50.0,
)
],
onToggle: (index) {
print('switched to: $index');
},
cancelToggle: (index) async {
String selection = index == 0
? 'Bitcoin'
: index == 1
? 'Ethereum'
: 'Fiat';
return await showDialog(
context: context,
builder: (dialogContext) => AlertDialog(
content: Text("Select $selection?"),
actions: [
TextButton(
child: Text("No",
style: TextStyle(color: Colors.red)),
onPressed: () {
Navigator.pop(dialogContext, true);
}),
TextButton(
child: Text("Yes",
style: TextStyle(color: Colors.black)),
onPressed: () {
Navigator.pop(dialogContext, false);
})
],
),
);
},
),
```

![Cancel toggle](https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExZWNhOGJhNjMzNWNjNmNmOWYwMGI0Nzc3YWEyNjdhYTIyNTRmMDQ2MSZlcD12MV9pbnRlcm5hbF9naWZzX2dpZklkJmN0PWc/qHB8oy90lXIfyQE0vi/giphy.gif)

### TextDirection.rtl and corner radius

```dart
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>
12 changes: 7 additions & 5 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -136,7 +136,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -181,6 +181,7 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -195,6 +196,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -282,7 +284,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down Expand Up @@ -363,7 +365,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -412,7 +414,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 4 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
Loading

0 comments on commit 9838215

Please sign in to comment.