auto_animated_icon

A Flutter package to simplify the process of creating an AnimatedIcon

Getting Started

The AutoAnimatedIcon will help you create an AnimatedIcon without any hussle. Just create an AutoAnimatedIcon widget with the icon which is one of the AnimatedIcons and an onPressed method to do the things you want to do when its pressed.

There is an iconState property which can be set to either IconState.first or IconState.second to specify the icon's state.

Usage

Basic

class MenuCloseIcon extends StatefulWidget {
	const MenuCloseIcon({
		Key key,
	}) : super(key: key);

	@override
	_MenuCloseIconState createState() => _MenuCloseIconState();
}

class _MenuCloseIconState extends State<MenuCloseIcon> {

	IconState _iconState = IconState.first;

	bool _isPressed = false;

	@override
	Widget build(BuildContext context) {
		return AutoAnimatedIcon(
		iconState: _iconState,
		icon: AnimatedIcons.menu_close,
		onPressed: () {
			setState(() {
			_isPressed = !_isPressed;
			if(_isPressed)
				_iconState  = IconState.second;
			else
				_iconState = IconState.first;
			});
			log("checking");
		},
		);
	}
}

With separate toolips

   AutoAnimatedIcon(
	  icon: AnimatedIcons.event_add,
	  onPressed: () {},
	  firstToolip: "Event",
	  secondToolip: "Add",
   );

In this example the widget will show the firstToolip for the first icon and the secondToolip for second icon.

For Further Customization

For more customization options consider IconButton's and AnimatedIcon's properties which are directly available to use in AutoAnimatedIcon.

Examples

Counter Which shows AutoAnimatedIcons on the AppBar.

Feel free to let me know of any issues or suggestions.

Contributions

Feel free to contribute to this project.

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue.

If you fixed a bug or implemented a new feature, please send a pull request.

Maintainers

Arjunraj Kokkadan

For help getting started with Flutter, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Libraries

auto_animated_icon