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:google_fonts/google_fonts.dart';
......@@ -10,6 +11,8 @@ class MediaItem {
String description;
String image;
final _saved = Set<MediaItem>();
String getName() {
......@@ -30,12 +33,18 @@ class MediaItem {
{
const TextStyle titleStyle = TextStyle(fontSize: 30,fontWeight: FontWeight.bold, color: Colors.blue);
const TextStyle bodyStyle = TextStyle(fontSize: 11);
final alreadySaved = _saved.contains(MediaItem);
return ListView(
shrinkWrap: true,
physics: new NeverScrollableScrollPhysics(),
children: [
Align( alignment: Alignment.center,
child: Text(item.name, style: GoogleFonts.montserrat(textStyle: titleStyle),textAlign: TextAlign.center,)),
ListTile(
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(
crossAxisCount: 2,
physics: new NeverScrollableScrollPhysics(),
......@@ -44,7 +53,7 @@ class MediaItem {
Image.asset(item.image),
Align( alignment: Alignment.center,
child:Text(item.description, style:GoogleFonts.montserrat(textStyle: bodyStyle), textAlign: TextAlign.justify, )),
])
]),
],
);
}
......
......@@ -6,8 +6,9 @@ class Widget3000{
Widget view;
MediaItem mediaItem ;
Widget3000(List <ListView> list){
Widget3000(List <ListView> list){
view= Column(
children: [Expanded(
child:ListView.builder(
......@@ -18,7 +19,7 @@ class Widget3000{
itemBuilder: (BuildContext context, int index)
{
return Container(
height: 250,
height: 300,
child: Center(child: list[index]));
})
)
......@@ -28,4 +29,25 @@ class Widget3000{
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> {
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>[
Text("Bienvenue dans votre Médiathèque",textAlign: TextAlign.center, style: GoogleFonts.montserrat(textStyle: TextStyle(fontSize: 40,color: Colors.blue))),
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