Add the IconToggle description

master
lmy 5 years ago
parent f78293c6ff
commit 3641a22795

@ -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 |

@ -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,
@ -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;
@ -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),

Loading…
Cancel
Save