Commit 10e5263b authored by Lila NICKLER's avatar Lila NICKLER

Affichage d'une liste de media

parent 83a1614b
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class MediaItem {
String name;
String description;
String image;
String getName() {
return this.name;
}
String getDescription() {
return this.description;
}
String getImage() {
return this.image;
}
ListView mediaDisplay (MediaItem item)
{
const TextStyle titleStyle = TextStyle(fontSize: 30,fontWeight: FontWeight.bold, color: Colors.blue);
const TextStyle bodyStyle = TextStyle(fontSize: 10);
return ListView(
shrinkWrap: true,
children: [
Text(item.name, style: GoogleFonts.breeSerif(textStyle: titleStyle)),
GridView.count(
crossAxisCount: 2,
shrinkWrap: true,
children: [
Image.network(item.getImage()),
Text(item.description, style:GoogleFonts.breeSerif(textStyle: bodyStyle) ),
])
],
);
}
MediaItem(String name, String desc, String image)
{
this.name = name;
this.description = desc;
this.image = image;
}
}
class DataBase
{
static List <ListView> _listSeries= <ListView>[];
MediaItem item;
DataBase()
{
item = new MediaItem("name","desc","image");
_listSeries.add(item.mediaDisplay(MediaItem(
"Les Simpsons",
"Les Simpson, famille américaine moyenne, vivent à Springfield. Homer, le père, a deux passions : regarder la télé et boire des bières. Mais son quotidien est rarement reposant, entre son fils Bart qui fait toutes les bêtises possibles, sa fille Lisa qui est une surdouée, ou encore sa femme Marge qui ne supporte pas de le voir se soûler à longueur de journée.",
"https://mondisneyplus.tv/wp-content/uploads/2019/08/simpsons.jpg")));
_listSeries.add(item.mediaDisplay(MediaItem(
"Dark",
"Un enfant disparu lance quatre familles dans une quête éperdue pour trouver des réponses. La chasse au coupable fait émerger les péchés et les secrets d'une petite ville.",
"https://m.media-amazon.com/images/I/B1cB5pEqr2S._SS500_.jpg")));
_listSeries.add(item.mediaDisplay(MediaItem(
"Les Simpsons",
"Les simpsons sont un famille ...",
"https://mondisneyplus.tv/wp-content/uploads/2019/08/simpsons.jpg")));
}
List <ListView> getlist()
{
return _listSeries;
}
}
import 'package:flutter/material.dart';
import 'package:mediateque_tp1/Media.dart';
class Widget3000{
Widget view;
MediaItem mediaItem ;
Widget3000(){
DataBase db = new DataBase();
view= Column(
children: [Expanded(
child:ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
padding: const EdgeInsets.all(8),
itemCount: db.getlist().length,
itemBuilder: (BuildContext context, int index)
{
return Container(
height: 250,
child: Center(child: db.getlist()[index]));
}))]);
/*
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")],)
);});
*/
}
Widget getThisFuckingWidget(){return view;}
}
\ No newline at end of file
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mediateque_tp1/Widget3000.dart';
import 'package:mediateque_tp1/Media.dart';
void main() {
runApp(MyApp());
......@@ -33,23 +36,40 @@ class _MyHomePageState extends State<MyHomePage> {
int _selectedIndex = 0;
static const TextStyle optionStyle =
TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
static const List<Widget> _widgetOptions = <Widget>[
Text(
'Home',
style: optionStyle,
),
final List<String> entries = <String>['A', 'B', 'C'];
final List<int> colorCodes = <int>[600, 500, 100];
static Widget3000 affichage=new Widget3000();
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>[
affichage.getThisFuckingWidget() ,
Text(
'Mes Séries et Films',
'Index 1: Business',
style: optionStyle,
),
Text(
'Mes Jeux Vidéo',
'Index 2: School',
style: optionStyle,
),
Text(
'Informations',
Text (
'Mes favoris',
style: optionStyle,
),
)
];
void _onItemTapped(int index) {
......@@ -57,9 +77,11 @@ class _MyHomePageState extends State<MyHomePage> {
_selectedIndex = index;
});
}
@override
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")];
final List<MediaItem> series= <MediaItem> [];
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
......@@ -87,10 +109,11 @@ class _MyHomePageState extends State<MyHomePage> {
),
BottomNavigationBarItem(
icon: Icon(Icons.info_outline_rounded ),
label: 'Informtations',
backgroundColor: Colors.blue
icon: Icon(Icons.favorite_border_rounded),
label: 'Mes favoris',
backgroundColor: Colors.blue
),
],
currentIndex: _selectedIndex,
selectedItemColor: Colors.white,
......@@ -100,17 +123,12 @@ class _MyHomePageState extends State<MyHomePage> {
), // 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 ;
}
}
......@@ -43,6 +43,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0-nullsafety.3"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.5"
cupertino_icons:
dependency: "direct main"
description:
......@@ -57,6 +71,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.1"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "5.2.1"
flutter:
dependency: "direct main"
description: flutter
......@@ -67,6 +95,34 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
google_fonts:
dependency: "direct main"
description:
name: google_fonts
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.2"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.1"
matcher:
dependency: transitive
description:
......@@ -88,6 +144,69 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.1"
path_provider:
dependency: transitive
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.27"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+2"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4+8"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4+3"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.2"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.13"
sky_engine:
dependency: transitive
description: flutter
......@@ -149,5 +268,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.3"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.4+1"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
sdks:
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.17.0 <2.0.0"
......@@ -28,6 +28,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.0
google_fonts: ^1.1.2
dev_dependencies:
flutter_test:
......
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