File tree Expand file tree Collapse file tree 1 file changed +22
-18
lines changed
Expand file tree Collapse file tree 1 file changed +22
-18
lines changed Original file line number Diff line number Diff line change @@ -13,19 +13,37 @@ class HomePage extends StatefulWidget {
1313}
1414
1515class _HomePageState extends State <HomePage > {
16-
16+ // Variável para controlar a página atual exibida
1717 int paginaAtual = 0 ;
1818 late PageController pc;
1919
2020 @override
2121 void initState () {
2222 super .initState ();
23+ // Inicializa o controlador da página com a página atual
2324 pc = PageController (initialPage: paginaAtual);
2425 }
2526
2627 @override
2728 Widget build (BuildContext context) {
2829 return Scaffold (
30+ appBar: AppBar (
31+ centerTitle: true ,
32+ title: Image .asset (
33+ "assets/img/MyCoinPNG.png" ,
34+ width: 120 ,
35+ ),
36+ backgroundColor: Colors .red,
37+ ),
38+ body: PageView (
39+ physics: const NeverScrollableScrollPhysics (),
40+ controller: pc,
41+ children: const [
42+ GuidePage (),
43+ CalcPage (),
44+ SearchPage ()
45+ ],
46+ ),
2947 bottomNavigationBar: SizedBox (
3048 height: 73 ,
3149 child: GNav (
@@ -36,12 +54,14 @@ class _HomePageState extends State<HomePage> {
3654 color: Colors .black,
3755 gap: 8 ,
3856 tabs: [
57+ // Botões de navegação na parte inferior
3958 GButton (
4059 icon: Icons .home,
4160 text: 'Home' ,
4261 onPressed: () {
4362 setState (() {
4463 paginaAtual = 0 ;
64+ // Anima a transição para a página atual
4565 pc.animateToPage (paginaAtual, duration: const Duration (milliseconds: 200 ), curve: Curves .linear);
4666 });
4767 },
@@ -89,22 +109,6 @@ class _HomePageState extends State<HomePage> {
89109 ],
90110 ),
91111 ),
92- appBar: AppBar (
93- centerTitle: true ,
94- title: Image .asset (
95- "assets/img/MyCoinPNG.png" ,
96- width: 120 ,
97- ),
98- backgroundColor: Colors .red,
99- ),
100- body: PageView (
101- controller: pc,
102- children: const [
103- GuidePage (),
104- CalcPage (),
105- SearchPage ()
106- ],
107- ),
108112 );
109113 }
110- }
114+ }
You can’t perform that action at this time.
0 commit comments