Commit 21a291b9 authored by Benjamin LEROUX's avatar Benjamin LEROUX

exo5 commit

parent 5dfaca3c
......@@ -5,35 +5,26 @@ import 'Tile.dart';
class Plateau{
List<Tile> listTile;
double size;
Plateau({this.listTile});
Plateau({this.listTile,this.size});
List<Tile> getListTile(){
return listTile;
}
}
Tile tile = new Tile(
imageURL: 'https://picsum.photos/512/1024', alignment: Alignment(-1, -1));
Tile tile2 = new Tile(
imageURL: 'https://picsum.photos/512/1024', alignment: Alignment(0, -1));
Tile tile3 = new Tile(
imageURL: 'https://picsum.photos/512/1024', alignment: Alignment(1, -1));
Tile tile4 = new Tile(
imageURL: 'https://picsum.photos/512/1024', alignment: Alignment(-1, 0));
Tile tile5 = new Tile(
imageURL: 'https://picsum.photos/512/1024', alignment: Alignment(0, 0));
Tile tile6 = new Tile(
imageURL: 'https://picsum.photos/512/1024', alignment: Alignment(1, 0));
Tile tile7 = new Tile(
imageURL: 'https://picsum.photos/512/1024', alignment: Alignment(-1, 1));
Tile tile8 = new Tile(
imageURL: 'https://picsum.photos/512/1024', alignment: Alignment(0, 1));
Tile tile9 = new Tile(
imageURL: 'https://picsum.photos/512/1024', alignment: Alignment(1, 1));
int size=5;
class DisplayPlateauWidget extends StatefulWidget {
@override
_DisplayPlateauWidgetState createState() => _DisplayPlateauWidgetState();
}
class _DisplayPlateauWidgetState extends State<DisplayPlateauWidget> {
double _currentSliderValue=4;
TextStyle textStyle = TextStyle(fontSize: 16, fontWeight: FontWeight.bold,);
class DisplayPlateauWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
......@@ -49,6 +40,20 @@ class DisplayPlateauWidget extends StatelessWidget {
child: Container(
margin: EdgeInsets.all(20.0),
child: createGridView())),
Row(mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(width: 90,child:Text('Taille:', style: textStyle,textAlign: TextAlign.center,),padding: EdgeInsets.fromLTRB(8, 0, 0, 0),),
Container(width: MediaQuery.of(context).size.width-90,child: Slider(
value: _currentSliderValue,
min: 1, max: 10, divisions: 9,
label: _currentSliderValue.round().toString(),
onChanged: (double value) {
setState(() {_currentSliderValue = value;});
}
),
),
]
),
])),
);
}
......@@ -58,8 +63,8 @@ class DisplayPlateauWidget extends StatelessWidget {
padding: const EdgeInsets.all(10),
mainAxisSpacing: 5,
crossAxisSpacing: 5,
crossAxisCount: 3,
children: getAllCroppedImage(createListTile()),
crossAxisCount: _currentSliderValue.toInt(),
children: getAllCroppedImage(createListTile(_currentSliderValue)),
);
}
......@@ -71,17 +76,16 @@ class DisplayPlateauWidget extends StatelessWidget {
return res;
}
List<Tile> createListTile(){
List<Tile> createListTile(double size){
List<Tile> res=<Tile>[];
res.add(tile);
res.add(tile2);
res.add(tile3);
res.add(tile4);
res.add(tile5);
res.add(tile6);
res.add(tile7);
res.add(tile8);
res.add(tile9);
for(double i=-1.0;i<=1.0;){
for(double j=-1.0;j<=1.0;){
res.add(new Tile(imageURL: 'https://picsum.photos/512/1024', alignment: Alignment(j, i),size: size));
j+=(1/((size-1)/2));
}
i+=(1/((size-1)/2));
}
return res;
}
}
......
......@@ -3,8 +3,9 @@ import 'package:flutter/material.dart';
class Tile {
String imageURL;
Alignment alignment;
double size;
Tile({this.imageURL, this.alignment});
Tile({this.imageURL, this.alignment,this.size});
Widget croppedImageTile() {
return FittedBox(
......@@ -13,8 +14,8 @@ class Tile {
child: Container(
child: Align(
alignment: this.alignment,
widthFactor: 0.3333,
heightFactor: 0.3333,
widthFactor: 1/size,
heightFactor: 1/size,
child: Image.network(this.imageURL),
),
),
......@@ -24,7 +25,7 @@ class Tile {
}
Tile tile = new Tile(
imageURL: 'https://picsum.photos/512/1024', alignment: Alignment(0, 0));
imageURL: 'https://picsum.photos/512/1024', alignment: Alignment(0, 0),size: 3);
class DisplayTileWidget extends StatelessWidget {
@override
......
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