Skip to content

Commit 6c670d1

Browse files
committed
Add icon switcher in about section
1 parent 741de4f commit 6c670d1

File tree

2 files changed

+69
-17
lines changed

2 files changed

+69
-17
lines changed

lib/pages/about/about_widget.dart

+61-16
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,88 @@
1+
import 'dart:async';
2+
13
import 'package:flutter/material.dart';
4+
import 'package:material_symbols_icons/symbols.dart';
25

3-
class AboutPage extends StatelessWidget {
6+
class AboutPage extends StatefulWidget {
47
const AboutPage({super.key});
58

9+
@override
10+
State<AboutPage> createState() => _AboutPageState();
11+
}
12+
13+
class _AboutPageState extends State<AboutPage> {
14+
late Timer _timer;
15+
int _currIndex = 0;
16+
17+
@override
18+
void initState() {
19+
super.initState();
20+
_timer = Timer.periodic(
21+
const Duration(seconds: 2),
22+
(timer) => setState(() => _currIndex += _currIndex < 3 ? 1 : -_currIndex),
23+
);
24+
}
25+
26+
@override
27+
void dispose() {
28+
_timer.cancel();
29+
super.dispose();
30+
}
31+
632
@override
733
Widget build(BuildContext context) {
8-
return const Expanded(
34+
return Expanded(
935
child: SingleChildScrollView(
1036
child: Column(
1137
mainAxisAlignment: MainAxisAlignment.center,
1238
children: [
1339
Padding(
14-
padding: EdgeInsets.all(20.0),
40+
padding: const EdgeInsets.all(20.0),
1541
child: Column(
1642
mainAxisAlignment: MainAxisAlignment.center,
1743
children: [
18-
Icon(
19-
Icons.wb_sunny, // Icono del clima
20-
size: 50,
44+
AnimatedSwitcher(
45+
duration: const Duration(milliseconds: 300),
46+
transitionBuilder: (child, anim) {
47+
double begin = _currIndex % 2 == 0 ? 2 : 0;
48+
49+
return RotationTransition(
50+
turns:
51+
Tween<double>(begin: begin, end: 1).animate(anim),
52+
child: ScaleTransition(scale: anim, child: child),
53+
);
54+
},
55+
child: Icon(
56+
switch (_currIndex) {
57+
0 => Icons.sunny,
58+
1 => Icons.water_drop,
59+
2 => Symbols.cloud,
60+
_ => Icons.thermostat
61+
},
62+
size: 50,
63+
fill: 1,
64+
key: ValueKey(_currIndex),
65+
),
2166
),
22-
SizedBox(height: 20),
23-
Text(
67+
const SizedBox(height: 20),
68+
const Text(
2469
"Aplicación del clima desarrollada por el Grupo 5 de prácticas intermedias del 7mo semestre usando los sensores de CyT",
2570
textAlign: TextAlign.center,
2671
),
27-
SizedBox(height: 20),
28-
Text(
72+
const SizedBox(height: 20),
73+
const Text(
2974
"Integrantes:",
3075
style: TextStyle(
3176
fontWeight: FontWeight.bold,
3277
fontSize: 18,
3378
),
3479
),
35-
SizedBox(height: 10),
36-
Text("Elvis Lizandro Aguilar Tax 201930304"),
37-
Text("Rudy Adolfo Pacheco Pacheco 201930220"),
38-
Text("David Enrique Lux Barrera 201931344"),
39-
Text("Dylan Antonio Elías Vásquez 201931369"),
40-
Text("Brayan Alexander Alonzo Quijivix 201931078"),
80+
const SizedBox(height: 10),
81+
const Text("Elvis Lizandro Aguilar Tax 201930304"),
82+
const Text("Rudy Adolfo Pacheco Pacheco 201930220"),
83+
const Text("David Enrique Lux Barrera 201931344"),
84+
const Text("Dylan Antonio Elías Vásquez 201931369"),
85+
const Text("Brayan Alexander Alonzo Quijivix 201931078"),
4186
],
4287
),
4388
),

lib/pages/satelites/satelites_widget.dart

+8-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ class _SatelitesPageState extends State<SatelitesPage> {
4646
updateSateliteInfo();
4747
}
4848

49+
@override
50+
void dispose() {
51+
_timer.cancel();
52+
super.dispose();
53+
}
54+
4955
@override
5056
Widget build(BuildContext context) {
5157
return FutureBuilder(
@@ -70,7 +76,8 @@ class _SatelitesPageState extends State<SatelitesPage> {
7076
children: [
7177
Padding(
7278
padding: const EdgeInsets.all(2.0),
73-
child: Text("Ultima Actualizacion ${dateFormat.format(dateTime)}"),
79+
child:
80+
Text("Ultima Actualizacion ${dateFormat.format(dateTime)}"),
7481
),
7582
Expanded(
7683
child: GridView.extent(

0 commit comments

Comments
 (0)