Skip to content

Commit

Permalink
Add the IconToggle description
Browse files Browse the repository at this point in the history
  • Loading branch information
2534290808 committed Sep 9, 2019
1 parent f78293c commit 3641a22
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,24 @@ Customizable Icons for Flutter,Inspired by [react-native-vector-icons](https://g
## Usage
To use this plugin, add `flutter_icons` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).

## Widget

### IconToggle

| Prop | Description |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| selectedIconData | Icon is displayed when value is true |
| unselectedIconData | Icon is displayed when value is false |
| activeColor | When value is true, the icon color is displayed |
| inactiveColor | When value is false, the icon color is displayed |
| value| Whether this IconToggle is selected. |
| onChanged | Called when the value of the IconToggle should change. |
| duration| The duration of the transition from selected Icon to unselected Icon |
| reverseDuration | he duration of the transition from unselected Icon to selected Icon |
| transitionBuilder | Transition animation function between the selected Icon and the unselected Icon |



## Static Methods

| Prop | Description |
Expand Down
10 changes: 5 additions & 5 deletions lib/icon_toggle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Widget _defaultTransitionBuilder(Widget child, Animation<double> animation) =>

class IconToggle extends StatefulWidget {
IconToggle({
this.uncheckedIconData = Icons.radio_button_unchecked,
this.checkedIconData = Icons.radio_button_checked,
this.unselectedIconData = Icons.radio_button_unchecked,
this.selectedIconData = Icons.radio_button_checked,
this.activeColor = Colors.blue,
this.inactiveColor = Colors.grey,
this.value = false,
Expand All @@ -24,8 +24,8 @@ class IconToggle extends StatefulWidget {
this.duration = const Duration(milliseconds: 100),
this.reverseDuration,
});
final IconData checkedIconData;
final IconData uncheckedIconData;
final IconData selectedIconData;
final IconData unselectedIconData;
final Color activeColor;
final Color inactiveColor;
final bool value;
Expand Down Expand Up @@ -92,7 +92,7 @@ class _IconToggleState extends State<IconToggle>
reverseDuration: widget.reverseDuration,
transitionBuilder: widget.transitionBuilder,
child: Icon(
widget.value ? widget.checkedIconData : widget.uncheckedIconData,
widget.value ? widget.selectedIconData : widget.unselectedIconData,
color: widget.value ? widget.activeColor : widget.inactiveColor,
size: 22,
key: ValueKey<bool>(widget.value),
Expand Down

0 comments on commit 3641a22

Please sign in to comment.