Skip to content

Commit 8309be2

Browse files
Elvis-AguilarAvaibleUser
authored andcommitted
feature: smooth animation for wind direction
1 parent 2691d97 commit 8309be2

File tree

2 files changed

+39
-9
lines changed

2 files changed

+39
-9
lines changed

.vscode/launch.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "morazan",
9+
"request": "launch",
10+
"type": "dart"
11+
},
12+
{
13+
"name": "morazan (profile mode)",
14+
"request": "launch",
15+
"type": "dart",
16+
"flutterMode": "profile"
17+
},
18+
{
19+
"name": "morazan (release mode)",
20+
"request": "launch",
21+
"type": "dart",
22+
"flutterMode": "release"
23+
}
24+
]
25+
}

lib/components/wind_widget.dart

+14-9
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,20 @@ class Wind extends StatelessWidget {
4141
fontWeight: FontWeight.w900,
4242
fontSize: 10,
4343
),
44-
),
45-
Transform.rotate(
46-
angle: _direction * math.pi / 180,
47-
child: Icon(
48-
Symbols.assistant_navigation,
49-
size: 45,
50-
color: Colors.green.shade400,
51-
fill: 1,
52-
),
44+
),TweenAnimationBuilder(
45+
tween: Tween<double>(begin: 0, end: _direction+0.0),
46+
duration: const Duration(milliseconds: 500), // Duración de la animación
47+
builder: (context, double angle, child) {
48+
return Transform.rotate(
49+
angle: angle * math.pi / 180,
50+
child: Icon(
51+
Symbols.assistant_navigation,
52+
size: 45,
53+
color: Colors.green.shade400,
54+
fill: 1,
55+
),
56+
);
57+
},
5358
),
5459
],
5560
),

0 commit comments

Comments
 (0)