main.dart 3.23 KB
Newer Older
1

2
import 'package:flutter/cupertino.dart';
Lila NICKLER's avatar
Lila NICKLER committed
3
import 'package:flutter/material.dart';
4
import 'package:google_fonts/google_fonts.dart';
5 6
import 'package:mediateque_tp1/Widget3000.dart';
import 'package:mediateque_tp1/Media.dart';
Lila NICKLER's avatar
Lila NICKLER committed
7

8 9
import 'Widget3000.dart';

10 11
const Color myColor = Color(0xFFCE93D8);

Lila NICKLER's avatar
Lila NICKLER committed
12 13 14 15 16 17 18 19 20 21
void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
Lila NICKLER's avatar
Lila NICKLER committed
22

23
        primaryColor: Colors.deepPurple[200],
24 25 26 27
        accentColor: Colors.deepPurple[100],



Lila NICKLER's avatar
Lila NICKLER committed
28 29
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
30
      home: MyHomePage(title: 'Mediathèque',),
Lila NICKLER's avatar
Lila NICKLER committed
31 32 33 34 35 36 37 38 39 40 41 42
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
43
  int _selectedIndex = 0;
44

45 46
  static DataBase db = new DataBase();

Lila NICKLER's avatar
Lila NICKLER committed
47 48 49 50
  static AffichageList affichageSeries = new AffichageList(list: db.getlistSeries(),listFav: db.getlistSaved());
  static AffichageList affichageGames = new AffichageList(list: db.getlistGames(),listFav: db.getlistSaved());
  static AffichageList affichageFav = new AffichageList(list: db.getlistSaved(),listFav: db.getlistSaved());
  static AffichageList affichafeFilms = new AffichageList(list: db.getlistFilms(), listFav: db.getlistSaved());
51

52 53

  static  List<Widget> _widgetOptions = <Widget>[
54
    Text("Bienvenue dans votre Médiathèque",textAlign: TextAlign.center, style: GoogleFonts.montserrat(textStyle: TextStyle(fontSize: 40,color: Colors.deepPurple[400]))),
55
    affichageSeries,
56
    affichafeFilms,
57
    affichageGames,
58 59
    affichageFav,

60
  ];
Lila NICKLER's avatar
Lila NICKLER committed
61

62
  void _onItemTapped(int index) {
Lila NICKLER's avatar
Lila NICKLER committed
63
    setState(() {
64
      _selectedIndex = index;
Lila NICKLER's avatar
Lila NICKLER committed
65 66
    });
  }
67

Lila NICKLER's avatar
Lila NICKLER committed
68 69
  @override
  Widget build(BuildContext context) {
70

Lila NICKLER's avatar
Lila NICKLER committed
71 72
    return Scaffold(
      appBar: AppBar(
73
        title: Text(widget.title, style: GoogleFonts.montserrat(color: Colors.white)),
Lila NICKLER's avatar
Lila NICKLER committed
74
      ),
75
      body: Center(child: _widgetOptions.elementAt(_selectedIndex),
Lila NICKLER's avatar
Lila NICKLER committed
76
      ),
77 78
      bottomNavigationBar: BottomNavigationBar  (

79
        items:  <BottomNavigationBarItem>[
80 81 82
          BottomNavigationBarItem(
            icon: Icon(Icons.home),
            label: 'Home',
83
            backgroundColor: Colors.deepPurple[200]
84

85 86 87
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.ondemand_video_rounded ),
88
            label: 'Séries',
89
            backgroundColor: Colors.deepPurple[200]
90

91
          ),
92 93 94 95 96
          BottomNavigationBarItem(
              icon: Icon(Icons.camera_roll_outlined),
              label: 'Films',
              backgroundColor: Colors.deepPurple[200]
          ),
97 98 99
          BottomNavigationBarItem(
            icon: Icon(Icons.videogame_asset_outlined),
            label: 'Jeux Vidéo',
100
            backgroundColor: Colors.deepPurple[200]
101 102 103

          ),
          BottomNavigationBarItem(
104
              icon: Icon(Icons.star_outline_outlined),
105
              label: 'Mes favoris',
106
              backgroundColor: Colors.deepPurple[200]
107
          ),
108

109 110
        ],
        currentIndex: _selectedIndex,
111
        selectedItemColor: Colors.white,
112
        onTap: _onItemTapped,),
Lila NICKLER's avatar
Lila NICKLER committed
113 114
    );
  }
115 116 117 118


}

119 120 121 122 123