Commit a8c2a6c2 authored by Lila NICKLER's avatar Lila NICKLER

Ajout BDD + Affichage bouton favoris

parent 0d61d8a4
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
...@@ -10,6 +11,8 @@ class MediaItem { ...@@ -10,6 +11,8 @@ class MediaItem {
String description; String description;
String image; String image;
final _saved = Set<MediaItem>();
String getName() { String getName() {
...@@ -30,12 +33,18 @@ class MediaItem { ...@@ -30,12 +33,18 @@ class MediaItem {
{ {
const TextStyle titleStyle = TextStyle(fontSize: 30,fontWeight: FontWeight.bold, color: Colors.blue); const TextStyle titleStyle = TextStyle(fontSize: 30,fontWeight: FontWeight.bold, color: Colors.blue);
const TextStyle bodyStyle = TextStyle(fontSize: 11); const TextStyle bodyStyle = TextStyle(fontSize: 11);
final alreadySaved = _saved.contains(MediaItem);
return ListView( return ListView(
shrinkWrap: true, shrinkWrap: true,
physics: new NeverScrollableScrollPhysics(), physics: new NeverScrollableScrollPhysics(),
children: [ children: [
Align( alignment: Alignment.center, ListTile(
child: Text(item.name, style: GoogleFonts.montserrat(textStyle: titleStyle),textAlign: TextAlign.center,)), title: Text(item.name, style: GoogleFonts.montserrat(textStyle: titleStyle),textAlign: TextAlign.center,),
trailing: Icon(
alreadySaved ? Icons.favorite : Icons.favorite_border,
color: alreadySaved ? Colors.red : null,
),),
GridView.count( GridView.count(
crossAxisCount: 2, crossAxisCount: 2,
physics: new NeverScrollableScrollPhysics(), physics: new NeverScrollableScrollPhysics(),
...@@ -44,7 +53,7 @@ class MediaItem { ...@@ -44,7 +53,7 @@ class MediaItem {
Image.asset(item.image), Image.asset(item.image),
Align( alignment: Alignment.center, Align( alignment: Alignment.center,
child:Text(item.description, style:GoogleFonts.montserrat(textStyle: bodyStyle), textAlign: TextAlign.justify, )), child:Text(item.description, style:GoogleFonts.montserrat(textStyle: bodyStyle), textAlign: TextAlign.justify, )),
]) ]),
], ],
); );
} }
......
...@@ -6,8 +6,9 @@ class Widget3000{ ...@@ -6,8 +6,9 @@ class Widget3000{
Widget view; Widget view;
MediaItem mediaItem ; MediaItem mediaItem ;
Widget3000(List <ListView> list){
Widget3000(List <ListView> list){
view= Column( view= Column(
children: [Expanded( children: [Expanded(
child:ListView.builder( child:ListView.builder(
...@@ -18,7 +19,7 @@ class Widget3000{ ...@@ -18,7 +19,7 @@ class Widget3000{
itemBuilder: (BuildContext context, int index) itemBuilder: (BuildContext context, int index)
{ {
return Container( return Container(
height: 250, height: 300,
child: Center(child: list[index])); child: Center(child: list[index]));
}) })
) )
...@@ -28,4 +29,25 @@ class Widget3000{ ...@@ -28,4 +29,25 @@ class Widget3000{
Widget getThisFuckingWidget(){return view;} Widget getThisFuckingWidget(){return view;}
}
class Description extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Fiche d'information"),
),
body: Center(
child: ElevatedButton(
onPressed: () {
Navigator.pop(context);
},
child: Text('Retour à la liste'),
),
),
);
}
} }
\ No newline at end of file
...@@ -47,22 +47,6 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -47,22 +47,6 @@ class _MyHomePageState extends State<MyHomePage> {
static Widget3000 affichageGames =new Widget3000(db.getlistGames()); static Widget3000 affichageGames =new Widget3000(db.getlistGames());
static Widget listViewPage()
{
return ListView.builder(
padding: const EdgeInsets.all(8),
itemCount: 1,
itemBuilder: (BuildContext context, int index) {
return Container(
child: GridView.count(
crossAxisCount: 2,
children: [
Text("Bonjour"),
Text("hdkldas")],)
);});
}
static List<Widget> _widgetOptions = <Widget>[ static List<Widget> _widgetOptions = <Widget>[
Text("Bienvenue dans votre Médiathèque",textAlign: TextAlign.center, style: GoogleFonts.montserrat(textStyle: TextStyle(fontSize: 40,color: Colors.blue))), Text("Bienvenue dans votre Médiathèque",textAlign: TextAlign.center, style: GoogleFonts.montserrat(textStyle: TextStyle(fontSize: 40,color: Colors.blue))),
affichageSeries.getThisFuckingWidget(), affichageSeries.getThisFuckingWidget(),
......
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