-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from PDG-NUTRI/68-ajouter-la-bar-de-navigation
68 ajouter la bar de navigation
- Loading branch information
Showing
8 changed files
with
220 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import 'package:auto_route/auto_route.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:pdg_app/router/router.gr.dart'; | ||
|
||
import '../widgets/navbar.dart'; | ||
|
||
class HomeScreen extends StatefulWidget { | ||
const HomeScreen({Key? key}) : super(key: key); | ||
|
||
@override | ||
State<HomeScreen> createState() => _HomeScreenState(); | ||
} | ||
|
||
class _HomeScreenState extends State<HomeScreen> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return AutoTabsRouter( | ||
routes: const [ | ||
ChatScreenRoute(), | ||
DiaryScreenRoute(), | ||
ProfileScreenRoute(), | ||
], | ||
builder: (context, child, animation) { | ||
return Scaffold( | ||
body: FadeTransition( | ||
opacity: animation, | ||
child: child, | ||
), | ||
bottomNavigationBar: const NavBar(), | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class ProfileScreen extends StatelessWidget { | ||
const ProfileScreen({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const Center(child: Text("Profile")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import 'package:auto_route/auto_route.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:google_nav_bar/google_nav_bar.dart'; | ||
|
||
class NavBar extends StatefulWidget { | ||
const NavBar({Key? key}) : super(key: key); | ||
|
||
@override | ||
State<NavBar> createState() => _NavBarState(); | ||
} | ||
|
||
class _NavBarState extends State<NavBar> { | ||
int _selectedIndex = 1; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final tabsRouter = AutoTabsRouter.of(context); | ||
|
||
return GNav( | ||
rippleColor: Theme.of(context).colorScheme.secondary, | ||
hoverColor: Theme.of(context).colorScheme.secondary, | ||
color: Theme.of(context).colorScheme.onSecondary, | ||
activeColor: Theme.of(context).colorScheme.onSecondary, | ||
duration: const Duration(milliseconds: 900), | ||
tabBackgroundColor: Theme.of(context).colorScheme.secondary, | ||
gap: 8, | ||
padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 15), | ||
tabMargin: const EdgeInsets.symmetric(vertical: 15, horizontal: 25), | ||
backgroundColor: Theme.of(context).colorScheme.surface, | ||
tabs: const [ | ||
GButton( | ||
icon: Icons.chat_bubble_outline, | ||
text: "Chat", | ||
), | ||
GButton( | ||
icon: Icons.calendar_month_outlined, | ||
text: "Diary", | ||
), | ||
GButton( | ||
icon: Icons.account_circle_outlined, | ||
text: "Profile", | ||
) | ||
], | ||
selectedIndex: _selectedIndex, | ||
onTabChange: (index) { | ||
setState(() { | ||
_selectedIndex = index; | ||
tabsRouter.setActiveIndex(index); | ||
}); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters