Skip to content

Commit 2b9b8f3

Browse files
authored
Merge pull request #11 from Frezyx/dev
Release version 1.0.1
2 parents 8daed63 + b0a32b8 commit 2b9b8f3

File tree

14 files changed

+408
-227
lines changed

14 files changed

+408
-227
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.1 - 2021-06-06
2+
3+
* Update examples && README.md
4+
15
## 1.0.0 - 2021-03-10
26

37
* **Breaking change:** icons passed as List

README.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
# animated_icon_button
2-
3-
[![Build Status](https://travis-ci.com/Frezyx/animated_icon_button.svg?branch=master)](https://travis-ci.com/Frezyx/animated_icon_button) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ![Pub](https://img.shields.io/pub/v/animated_icon_button.svg)
4-
![Stars](https://img.shields.io/github/stars/Frezyx/animated_icon_button?style=social)
5-
6-
😊 Flutter package to create custom <strong>animated</strong> IconButton.</br>
1+
<h1 align="center">animated_icon_button </h1>
2+
<h2 align="center"> 😊 Flutter package to create custom <strong>animated</strong> IconButton.</br></h2>
3+
<p align="center">
74
😵 <strong>Includes all available icons.</strong> Based on native IconButton.
5+
</p>
6+
<br>
87

9-
## Breaking Change
10-
After `1.0.0` version you can use multiple icons.
8+
<p align="center">
9+
<img src='https://travis-ci.com/Frezyx/animated_icon_button.svg?branch=master'>
10+
<img src='https://img.shields.io/badge/License-MIT-yellow.svg'>
11+
<img src='https://img.shields.io/pub/v/animated_icon_button.svg'>
12+
<img src='https://img.shields.io/github/stars/Frezyx/animated_icon_button?style=social'>
13+
</p>
1114

15+
<p align="center">
16+
<img src="https://github.com/Frezyx/animated_icon_button/blob/master/example/rep_files/preview.gif?raw=true" width="270"></p>
1217

13-
<img src="https://github.com/Frezyx/animated_icon_button/blob/master/example/rep_files/preview.gif?raw=true" width="270">
18+
## Breaking Change
19+
After `1.0.1` version you can use multiple icons.
1420

1521
## Getting Started
1622
Follow these steps to use this library
@@ -19,7 +25,7 @@ Follow these steps to use this library
1925

2026
```yaml
2127
dependencies:
22-
animated_icon_button: ^1.0.0 #latest version
28+
animated_icon_button: ^1.0.1 #latest version
2329
```
2430
2531
### Add import package

example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
import 'package:animated_icon_button/animated_icon_button.dart';
2+
import 'package:flutter/material.dart';
3+
import 'package:simple_icons/simple_icons.dart';
4+
5+
void main() {
6+
runApp(MyApp());
7+
}
8+
9+
class MyApp extends StatelessWidget {
10+
@override
11+
Widget build(BuildContext context) {
12+
return MaterialApp(
13+
debugShowCheckedModeBanner: false,
14+
theme: ThemeData(
15+
brightness: Brightness.dark,
16+
primaryColor: Colors.greenAccent,
17+
),
18+
home: MyHomePage(),
19+
);
20+
}
21+
}
22+
23+
class MyHomePage extends StatefulWidget {
24+
@override
25+
_MyHomePageState createState() => _MyHomePageState();
26+
}
27+
28+
class _MyHomePageState extends State<MyHomePage>
29+
with SingleTickerProviderStateMixin {
30+
late AnimationController _progressBorderAc;
31+
late Animation<double> animation;
32+
var _selectedIndex = 0;
33+
var _reverse = false;
34+
35+
@override
36+
void initState() {
37+
_progressBorderAc = AnimationController(
38+
vsync: this,
39+
duration: const Duration(milliseconds: 300),
40+
);
41+
final tween = Tween<double>(
42+
begin: 25.0,
43+
end: 50.0,
44+
);
45+
animation = tween.animate(_progressBorderAc)
46+
..addStatusListener((state) => print('$state'));
47+
48+
super.initState();
49+
}
50+
51+
@override
52+
Widget build(BuildContext context) {
53+
final Size size = MediaQuery.of(context).size;
54+
return Material(
55+
color: const Color(0xFF212121),
56+
child: Center(
57+
child: AnimatedBuilder(
58+
builder: (BuildContext context, Widget? child) {
59+
return Container(
60+
decoration: BoxDecoration(
61+
borderRadius: BorderRadius.circular(100),
62+
boxShadow: [
63+
BoxShadow(
64+
color: color.withOpacity(
65+
animation.value / 100 * 2,
66+
),
67+
blurRadius: animation.value,
68+
)
69+
],
70+
),
71+
child: AnimatedIconButton(
72+
size: size.width * 0.25,
73+
onPressed: () async {
74+
setIndex();
75+
await _progressBorderAc.forward();
76+
await _progressBorderAc.reverse();
77+
},
78+
duration: const Duration(milliseconds: 300),
79+
icons: <AnimatedIconItem>[
80+
AnimatedIconItem(
81+
icon: Icon(SimpleIcons.amd, color: color),
82+
backgroundColor: Colors.white,
83+
),
84+
AnimatedIconItem(
85+
icon: Icon(SimpleIcons.nasa, color: color),
86+
backgroundColor: Colors.white,
87+
),
88+
AnimatedIconItem(
89+
icon: Icon(SimpleIcons.intel, color: color),
90+
backgroundColor: Colors.white,
91+
),
92+
AnimatedIconItem(
93+
icon: Icon(SimpleIcons.man, color: color),
94+
backgroundColor: Colors.white,
95+
),
96+
AnimatedIconItem(
97+
icon: Icon(SimpleIcons.acer, color: color),
98+
backgroundColor: Colors.white,
99+
),
100+
AnimatedIconItem(
101+
icon: Icon(SimpleIcons.travisci, color: color),
102+
backgroundColor: Colors.white,
103+
),
104+
AnimatedIconItem(
105+
icon: Icon(SimpleIcons.ea, color: color),
106+
backgroundColor: Colors.white,
107+
),
108+
AnimatedIconItem(
109+
icon: Icon(SimpleIcons.dior, color: color),
110+
backgroundColor: Colors.white,
111+
),
112+
],
113+
),
114+
);
115+
},
116+
animation: animation,
117+
),
118+
),
119+
);
120+
}
121+
122+
void setIndex() {
123+
if (_selectedIndex < 7) {
124+
setState(() => _selectedIndex += 1);
125+
}
126+
}
127+
128+
Color get color {
129+
switch (_selectedIndex) {
130+
case 0:
131+
return Colors.red;
132+
case 1:
133+
return Colors.orange;
134+
case 2:
135+
return Colors.yellow;
136+
case 3:
137+
return Colors.green;
138+
case 4:
139+
return Colors.indigo;
140+
case 5:
141+
return Colors.blue;
142+
case 6:
143+
return Colors.purple;
144+
default:
145+
return Colors.pink;
146+
}
147+
}
148+
}

0 commit comments

Comments
 (0)