Skip to content

Commit 80eb312

Browse files
committed
Botton NavBar and Description
1 parent 88e73de commit 80eb312

File tree

1 file changed

+79
-30
lines changed

1 file changed

+79
-30
lines changed

lib/pages/homePage.dart

Lines changed: 79 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,57 +5,106 @@ import 'package:my_coin2/pages/guidePage.dart';
55
import 'package:my_coin2/pages/searchPage.dart';
66
import 'package:google_nav_bar/google_nav_bar.dart';
77

8-
98
class HomePage extends StatefulWidget {
10-
const HomePage({super.key});
9+
const HomePage({Key? key}) : super(key: key);
1110

1211
@override
1312
State<HomePage> createState() => _HomePageState();
1413
}
1514

1615
class _HomePageState extends State<HomePage> {
1716

18-
PageController pc = PageController(
19-
initialPage: 0,
20-
);
17+
int paginaAtual = 0;
18+
late PageController pc;
19+
20+
@override
21+
void initState() {
22+
super.initState();
23+
pc = PageController(initialPage: paginaAtual);
24+
}
2125

2226
@override
2327
Widget build(BuildContext context) {
2428
return Scaffold(
25-
bottomNavigationBar: const GNav(
26-
tabs: [
27-
GButton(
28-
icon: Icons.home,
29-
text: 'Home',
30-
),
31-
GButton(
32-
icon: Icons.info,
33-
text: 'informações',
34-
),
35-
GButton(
36-
icon: Icons.home
37-
),
38-
GButton(
39-
icon: Icons.home
40-
),
41-
]
29+
bottomNavigationBar: SizedBox(
30+
height: 73,
31+
child: GNav(
32+
backgroundColor: Colors.red,
33+
tabBackgroundColor: Color.fromARGB(255, 248, 93, 82),
34+
activeColor: Colors.white,
35+
padding: EdgeInsets.all(16),
36+
color: Colors.black,
37+
gap: 8,
38+
tabs: [
39+
GButton(
40+
icon: Icons.home,
41+
text: 'Home',
42+
onPressed: () {
43+
setState(() {
44+
paginaAtual = 0;
45+
pc.animateToPage(paginaAtual, duration: const Duration(milliseconds: 200), curve: Curves.linear);
46+
});
47+
},
48+
),
49+
GButton(
50+
icon: Icons.book,
51+
text: 'Guia',
52+
onPressed: () {
53+
setState(() {
54+
paginaAtual = 1;
55+
pc.animateToPage(paginaAtual, duration: const Duration(milliseconds: 200), curve: Curves.linear);
56+
});
57+
},
58+
),
59+
GButton(
60+
icon: Icons.calculate,
61+
text: 'Calculadora',
62+
onPressed: () {
63+
setState(() {
64+
paginaAtual = 2;
65+
pc.animateToPage(paginaAtual, duration: const Duration(milliseconds: 200), curve: Curves.linear);
66+
});
67+
},
68+
),
69+
GButton(
70+
icon: Icons.lightbulb,
71+
text: 'Dicas',
72+
onPressed: () {
73+
setState(() {
74+
paginaAtual = 3;
75+
pc.animateToPage(paginaAtual, duration: const Duration(milliseconds: 200), curve: Curves.linear);
76+
});
77+
},
78+
),
79+
GButton(
80+
icon: Icons.info,
81+
text: 'info',
82+
onPressed: () {
83+
setState(() {
84+
paginaAtual = 3;
85+
pc.animateToPage(paginaAtual, duration: const Duration(milliseconds: 200), curve: Curves.linear);
86+
});
87+
},
88+
),
89+
],
90+
),
4291
),
4392
appBar: AppBar(
44-
centerTitle: true,
45-
title: Image.asset(
46-
"assets/img/MyCoinPNG.png",
47-
width: 120,
48-
),
49-
backgroundColor: Colors.red,
93+
centerTitle: true,
94+
title: Image.asset(
95+
"assets/img/MyCoinPNG.png",
96+
width: 120,
5097
),
98+
backgroundColor: Colors.red,
99+
),
51100
body: PageView(
52101
controller: pc,
53102
children: const [
54103
GuidePage(),
55104
CalcPage(),
56105
SearchPage()
57-
],
106+
],
58107
),
59108
);
60109
}
61-
}
110+
}

0 commit comments

Comments
 (0)