Commit 9ef07c3f authored by Lila NICKLER's avatar Lila NICKLER

Barre de navigation: 3 pages

parent 50ebe015
//import 'dart:html';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
void main() { void main() {
...@@ -32,38 +34,72 @@ class MyHomePage extends StatefulWidget { ...@@ -32,38 +34,72 @@ class MyHomePage extends StatefulWidget {
} }
class _MyHomePageState extends State<MyHomePage> { class _MyHomePageState extends State<MyHomePage> {
int _counter = 0; int _selectedIndex = 0;
static const TextStyle optionStyle =
TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
static const List<Widget> _widgetOptions = <Widget>[
Text(
'Index 0: Home',
style: optionStyle,
),
Text(
'Mes Séries et Films',
style: optionStyle,
),
Text(
'Mes Jeux Vidéo',
style: optionStyle,
),
];
void _incrementCounter() { void _onItemTapped(int index) {
setState(() { setState(() {
_counter++; _selectedIndex = index;
}); });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final series=[MediaItem(name: "Les Simpsons",description: "Les simpsons", image: "https://fr.wikipedia.org/wiki/Les_Simpson#/media/Fichier:Les_simpson_logo_France.png")];
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(widget.title), title: Text(widget.title),
), ),
body: Center( body: Center(child: _widgetOptions.elementAt(_selectedIndex),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Bienvenu dans votre médiathèque',
), ),
Text( bottomNavigationBar: BottomNavigationBar(
'$_counter', items: const <BottomNavigationBarItem>[
style: Theme.of(context).textTheme.headline4, BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Home',
), ),
], BottomNavigationBarItem(
icon: Icon(Icons.ondemand_video_rounded ),
label: 'Séries & Films',
), ),
BottomNavigationBarItem(
icon: Icon(Icons.videogame_asset_outlined),
label: 'Jeux Vidéo',
), ),
],
currentIndex: _selectedIndex,
selectedItemColor: Colors.amber[800],
onTap: _onItemTapped,),
floatingActionButton: FloatingActionButton( floatingActionButton: FloatingActionButton(
child: Icon(Icons.add), child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods. ), // This trailing comma makes auto-formatting nicer for build methods.
); );
} }
} }
class MediaItem {
String name;
String description;
String image;
MediaItem({this.name, this.description,this.image});
String getName ()
{
return this.name ;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment