Adding Bottom Navigation bar

This commit is contained in:
2021-03-18 00:44:33 +02:00
parent caa7f5e2f9
commit 6bf2b46059
19 changed files with 454 additions and 63 deletions
+104
View File
@@ -0,0 +1,104 @@
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
class MainView extends StatefulWidget {
@override
_MainViewState createState() => _MainViewState();
}
class _MainViewState extends State<MainView> {
int _selectedIndex = 0;
void _onItemTapped(int index) {
setState(() {
_selectedIndex = index;
});
}
void _showSearchView(BuildContext context) {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => Scaffold(),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Le Kiosque By GC&S",
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"),
);
},
),
elevation: 4,
actions: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFFF1F1F1),
),
child: TextButton(
onPressed: () => _showSearchView(context),
child: Icon(
Icons.search,
color: Colors.grey,
),
),
),
)
],
backgroundColor: Colors.white,
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: _selectedIndex,
type: BottomNavigationBarType.fixed,
onTap: _onItemTapped,
selectedItemColor: Colors.grey,
items: [
BottomNavigationBarItem(
icon: Icon(
Icons.home_rounded,
color: Colors.grey,
),
label: 'Accueil',
),
BottomNavigationBarItem(
icon: Icon(
Icons.subscriptions_rounded,
color: Colors.grey,
),
label: 'A la une',
),
BottomNavigationBarItem(
icon: Icon(
Icons.amp_stories_rounded,
color: Colors.grey,
),
label: 'Abonnement',
),
BottomNavigationBarItem(
icon: Icon(
Icons.people_rounded,
color: Colors.grey,
),
label: 'Mon profil',
),
],
),
);
}
}