Commit 029c1654 authored by Benjamin LEROUX's avatar Benjamin LEROUX

first detailpage commit

parent 19443eda
import 'package:flutter/material.dart';
GridView createGrid(String title, String url){
const TextStyle optionStyle =
TextStyle(fontSize: 30, fontWeight: FontWeight.bold,);
return GridView.count(
padding: const EdgeInsets.all(10),
crossAxisCount: 2,
physics: new NeverScrollableScrollPhysics(),
children: <Widget>[
Image.network(url),
Align(alignment: Alignment.center,child: Text(title,style: optionStyle, textAlign: TextAlign.center, )),]
);
}
class DataBase{
static List<GridView> _mangaItem = <GridView>[];
static List<String> _mangaNames = <String>[];
static List<String> _mangaUrls = <String>[];
static List<GridView> _gameItem = <GridView>[];
static List<String> _gameNames = <String>[];
static List<String> _gameUrls = <String>[];
DataBase(){
const TextStyle optionStyle =
TextStyle(fontSize: 30, fontWeight: FontWeight.bold,);
_mangaItem.add(GridView.count(crossAxisCount: 2,physics: new NeverScrollableScrollPhysics(), children: <Widget>
[Image.network('https://www.manga-news.com/public/images/series/arte-1-komikku.jpg'), Align(alignment: Alignment.center,child: Text('Arte',style: optionStyle )),]));
_mangaItem.add(GridView.count(crossAxisCount: 2,physics: new NeverScrollableScrollPhysics(), children: <Widget>
[Image.network('https://static.fnac-static.com/multimedia/Images/FR/NR/fa/d8/17/1562874/1507-1/tsp20161130112826/Berserk.jpg'), Align(alignment: Alignment.center,child: Text('Berserk',style: optionStyle )),]));
_mangaItem.add(GridView.count(crossAxisCount: 2,physics: new NeverScrollableScrollPhysics(), children: <Widget>
[Image.network('https://upload.wikimedia.org/wikipedia/en/6/6c/Koe_no_Katachi%2C_Volume_1.jpg'), Align(alignment: Alignment.center,child: Text('Koe No Katachi',style: optionStyle )),]));
_mangaItem.add(GridView.count(crossAxisCount: 2,physics: new NeverScrollableScrollPhysics(), children: <Widget>
[Image.network('https://images-na.ssl-images-amazon.com/images/I/91N8saM4HdL.jpg'), Align(alignment: Alignment.center,child: Text('Made In Abyss',style: optionStyle )),]));
_mangaItem.add(GridView.count(crossAxisCount: 2,physics: new NeverScrollableScrollPhysics(), children: <Widget>
[Image.network('https://www.manga-news.com/public/images/vols/monster-deluxe-1-kana.jpg'), Align(alignment: Alignment.center,child: Text('Monster',style: optionStyle )),]));
_mangaItem.add(GridView.count( crossAxisCount: 2,physics: new NeverScrollableScrollPhysics(), children: <Widget>
[Image.network('https://www.manga-news.com/public/images/series/Shingekinokyojin-01-kodansha.jpg'), Align(alignment: Alignment.center,child: Text('Shingeki No Kyojin',style: optionStyle )),]));
_gameItem.add(GridView.count(crossAxisCount: 2,physics: new NeverScrollableScrollPhysics(), children: <Widget>
[Image.network('https://www.manga-news.com/public/images/series/arte-1-komikku.jpg'), Align(alignment: Alignment.center,child: Text('Dark Souls 3',style: optionStyle )),]));
_gameItem.add(GridView.count(crossAxisCount: 2,physics: new NeverScrollableScrollPhysics(), children: <Widget>
[Image.network('https://static.fnac-static.com/multimedia/Images/FR/NR/fa/d8/17/1562874/1507-1/tsp20161130112826/Berserk.jpg'), Align(alignment: Alignment.center,child: Text('Halo: The Master Chief Collection',style: optionStyle )),]));
_gameItem.add(GridView.count(crossAxisCount: 2,physics: new NeverScrollableScrollPhysics(), children: <Widget>
[Image.network('https://upload.wikimedia.org/wikipedia/en/6/6c/Koe_no_Katachi%2C_Volume_1.jpg'), Align(alignment: Alignment.center,child: Text('Hollow Knight',style: optionStyle )),]));
_gameItem.add(GridView.count(crossAxisCount: 2,physics: new NeverScrollableScrollPhysics(), children: <Widget>
[Image.network('https://images-na.ssl-images-amazon.com/images/I/91N8saM4HdL.jpg'), Align(alignment: Alignment.center,child: Text('Sekiro',style: optionStyle )),]));
_gameItem.add(GridView.count(crossAxisCount: 2,physics: new NeverScrollableScrollPhysics(), children: <Widget>
[Image.network('https://www.manga-news.com/public/images/vols/monster-deluxe-1-kana.jpg'), Align(alignment: Alignment.center,child: Text('Slay The Spire',style: optionStyle )),]));
_gameItem.add(GridView.count( crossAxisCount: 2,physics: new NeverScrollableScrollPhysics(), children: <Widget>
[Image.network('https://www.manga-news.com/public/images/series/Shingekinokyojin-01-kodansha.jpg'), Align(alignment: Alignment.center,child: Text('Temtem',style: optionStyle )),]));
//trier automatiquement ?
}
_mangaNames=['Arte','Berserk','Koe No Katachi','Made In Abyss', 'Monster', 'Shingeki No Kyojin'];
_mangaUrls.add('https://www.manga-news.com/public/images/series/arte-1-komikku.jpg');
_mangaUrls.add('https://static.fnac-static.com/multimedia/Images/FR/NR/fa/d8/17/1562874/1507-1/tsp20161130112826/Berserk.jpg');
_mangaUrls.add('https://upload.wikimedia.org/wikipedia/en/6/6c/Koe_no_Katachi%2C_Volume_1.jpg');
_mangaUrls.add('https://images-na.ssl-images-amazon.com/images/I/91N8saM4HdL.jpg');
_mangaUrls.add('https://www.manga-news.com/public/images/vols/monster-deluxe-1-kana.jpg');
_mangaUrls.add('https://www.manga-news.com/public/images/series/Shingekinokyojin-01-kodansha.jpg');
for(int i=0;i< _mangaNames.length; i++){
_mangaItem.add(createGrid(_mangaNames[i], _mangaUrls[i]));
}
_gameNames=['Dark Souls III','Halo: The Master Chief Collection','Hollow Knight','Sekiro', 'Slay The Spire', 'Temtem'];
_gameUrls.add('https://store-images.s-microsoft.com/image/apps.24212.71827372323164480.6e97c7d2-899a-404f-8660-d622a7fc9162.daea9ed5-4921-45a6-a188-637bfab7176c');
_gameUrls.add('https://media.senscritique.com/media/000006971439/source_big/Halo_The_Master_Chief_Collection.jpg');
_gameUrls.add('https://static.wikia.nocookie.net/hollowknight/images/d/dd/Hollow_Knight_%28jeu%29.png/revision/latest?cb=20201212202922&path-prefix=fr');
_gameUrls.add('https://image.jeuxvideo.com/medias/152905/1529054204-3792-jaquette-avant.jpg');
_gameUrls.add('https://media.senscritique.com/media/000017651117/source_big/Slay_the_Spire.jpg');
_gameUrls.add('https://media.senscritique.com/media/000019301418/source_big/Temtem.png');
for(int i=0;i< _gameNames.length; i++){
_gameItem.add(createGrid(_gameNames[i], _gameUrls[i]));
}
//trier automatiquement ?
// _mangaItem.add(GridView.count(crossAxisCount: 2,physics: new NeverScrollableScrollPhysics(), children: <Widget>[Image.network('https://www.manga-news.com/public/images/series/arte-1-komikku.jpg'), Align(alignment: Alignment.center,child: Text('Arte',style: optionStyle )),]));
}
List<GridView> getMangaViews(){ return _mangaItem;}
List<String> getMangaNames(){ return _mangaNames;}
List<String> getMangaUrls(){ return _mangaUrls;}
List<GridView> getGameViews(){ return _gameItem;}
List<String> getGameNames(){ return _gameNames;}
List<String> getGameUrls(){ return _gameUrls;}
}
//placer autre part ?
class Todo {
final String title;
final String description;
Todo(this.title, this.description);
}
class DetailScreen extends StatelessWidget {
// Declare a field that holds the Todo.
final Todo todo;
// In the constructor, require a Todo.
DetailScreen({Key key, @required this.todo}) : super(key: key);
@override
Widget build(BuildContext context) {
// Use the Todo to create the UI.
return Scaffold(
appBar: AppBar(
title: Text(todo.title),
),
body: Padding(
padding: EdgeInsets.all(16.0),
child: Text(todo.description),
),
);
}
}
\ No newline at end of file
......@@ -26,8 +26,6 @@ class MyStatefulWidget extends StatefulWidget {
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
int _selectedIndex = 0;
......@@ -39,6 +37,25 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
static const TextStyle titleStyle2 =
TextStyle(fontSize: 44, fontWeight: FontWeight.bold, color: Colors.blue);
static List<Todo> todosManga=new List.generate(
dataBase.getMangaViews().length,
(i) => Todo(
dataBase.getMangaNames()[i] ,
'A description of what needs to be done for Todo' + (i+1).toString(),
),
);
static List<Todo> todosGame=new List.generate(
dataBase.getMangaViews().length,
(i) => Todo(
dataBase.getGameNames()[i] ,
//db+getdescription
//db.getannee
//db.geten cours ?
'A description of what needs to be done for Todo'+ (i+1).toString(),
),
);
static final List<Widget> _widgetOptions = <Widget>[
Text(
'Accueil',
......@@ -54,8 +71,10 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
child: Text('Mes jeux-vidéos',style: titleStyle2,textAlign: TextAlign.center),
);
else return Container(
height: 150,
child: Center(child: dataBase.getGameViews()[index-1]),
height: 180,
child: InkWell( onTap: () {Navigator.push(context, MaterialPageRoute(builder: (context) => DetailScreen(todo: todosGame[index-1])),);
},
child: Center(child: dataBase.getGameViews()[index-1]),),
);
},
separatorBuilder: (BuildContext context, int index) => const Divider(thickness: 5 ,color: Colors.blue, indent: 10, endIndent: 10,),
......@@ -70,8 +89,10 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
child: Text('Mes mangas',style: titleStyle,textAlign: TextAlign.center),
);
else return Container(
height: 150,
child: Center(child: dataBase.getMangaViews()[index-1]),
height: 180,
child: InkWell( onTap: () {Navigator.push(context, MaterialPageRoute(builder: (context) => DetailScreen(todo: todosManga[index-1])),);
},
child: Center(child: dataBase.getMangaViews()[index-1]),),
);
},
separatorBuilder: (BuildContext context, int index) => const Divider(thickness: 5 ,color: Colors.blue, indent: 10, endIndent: 10,),
......@@ -132,4 +153,5 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
);
}
}
\ No newline at end of file
}
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