Bottom Navigation Destination
This commit is contained in:
+35
-9
@@ -1,6 +1,7 @@
|
|||||||
import 'package:firebase_auth/firebase_auth.dart';
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:le_kiosque_by_gcs/ui/profile.dart';
|
||||||
|
|
||||||
class MainView extends StatefulWidget {
|
class MainView extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
@@ -10,6 +11,15 @@ class MainView extends StatefulWidget {
|
|||||||
class _MainViewState extends State<MainView> {
|
class _MainViewState extends State<MainView> {
|
||||||
int _selectedIndex = 0;
|
int _selectedIndex = 0;
|
||||||
|
|
||||||
|
List<Widget> _widgetOptions = [
|
||||||
|
Text('Index 0: Home'),
|
||||||
|
Text('Index 1: Business'),
|
||||||
|
Text('Index 2: School'),
|
||||||
|
ProfileView()
|
||||||
|
];
|
||||||
|
|
||||||
|
List<String> _labels = ["Accueil", "A la une", "Abonnement", "Mon profil"];
|
||||||
|
|
||||||
void _onItemTapped(int index) {
|
void _onItemTapped(int index) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedIndex = index;
|
_selectedIndex = index;
|
||||||
@@ -29,7 +39,7 @@ class _MainViewState extends State<MainView> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(
|
title: Text(
|
||||||
"Le Kiosque By GC&S",
|
_labels[_selectedIndex],
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
@@ -46,24 +56,39 @@ class _MainViewState extends State<MainView> {
|
|||||||
actions: [
|
actions: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Opacity(
|
||||||
|
opacity: _selectedIndex == 2 ? 0 : 1,
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: Color(0xFFF1F1F1),
|
color: Color(0xFFF1F1F1),
|
||||||
),
|
),
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: () => _showSearchView(context),
|
onPressed: () {
|
||||||
|
if (_selectedIndex == 3) {
|
||||||
|
_showSettingView(context);
|
||||||
|
} else {
|
||||||
|
_showSearchView(context);
|
||||||
|
}
|
||||||
|
},
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.search,
|
_selectedIndex == 3 ? Icons.settings : Icons.search,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
),
|
),
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
body: _widgetOptions[_selectedIndex],
|
||||||
|
bottomNavigationBar: _buildBottomNavigationBar(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
BottomNavigationBar _buildBottomNavigationBar() {
|
||||||
|
return BottomNavigationBar(
|
||||||
currentIndex: _selectedIndex,
|
currentIndex: _selectedIndex,
|
||||||
type: BottomNavigationBarType.fixed,
|
type: BottomNavigationBarType.fixed,
|
||||||
onTap: _onItemTapped,
|
onTap: _onItemTapped,
|
||||||
@@ -74,31 +99,32 @@ class _MainViewState extends State<MainView> {
|
|||||||
Icons.home_rounded,
|
Icons.home_rounded,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
label: 'Accueil',
|
label: _labels[0],
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.subscriptions_rounded,
|
Icons.subscriptions_rounded,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
label: 'A la une',
|
label: _labels[1],
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.amp_stories_rounded,
|
Icons.amp_stories_rounded,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
label: 'Abonnement',
|
label: _labels[2],
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.people_rounded,
|
Icons.people_rounded,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
label: 'Mon profil',
|
label: _labels[3],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_showSettingView(BuildContext context) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class ProfileView extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_ProfileViewState createState() => _ProfileViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ProfileViewState extends State<ProfileView> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(
|
||||||
|
"Mon Profil",
|
||||||
|
style: TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
leading: Builder(builder: (BuildContext context) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 16),
|
||||||
|
child: Image.asset("assets/images/kiosque_logo.png"),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
body: Container(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user