Commit 1a719333 authored by m-spi's avatar m-spi

TP2 exo5

parent 62667a66
......@@ -47,7 +47,7 @@
"name": "flutter",
"rootUri": "file:///home/spinelli/IMT/M1/AMSE/flutter/packages/flutter",
"packageUri": "lib/",
"languageVersion": "3.2"
"languageVersion": "3.3"
},
{
"name": "flutter_lints",
......@@ -170,7 +170,7 @@
"languageVersion": "3.4"
}
],
"generated": "2024-02-14T09:30:03.769996Z",
"generated": "2024-02-19T13:16:14.727949Z",
"generator": "pub",
"generatorVersion": "3.4.0-131.0.dev"
"generatorVersion": "3.4.0-154.0.dev"
}
......@@ -103,7 +103,7 @@ sky_engine
file:///home/spinelli/IMT/M1/AMSE/flutter/bin/cache/pkg/sky_engine/
file:///home/spinelli/IMT/M1/AMSE/flutter/bin/cache/pkg/sky_engine/lib/
flutter
3.2
3.3
file:///home/spinelli/IMT/M1/AMSE/flutter/packages/flutter/
file:///home/spinelli/IMT/M1/AMSE/flutter/packages/flutter/lib/
flutter_test
......
3.20.0-4.0.pre.92
\ No newline at end of file
3.20.0-10.0.pre.44
\ No newline at end of file
{"inputs":[],"outputs":[]}
\ No newline at end of file
{"inputs":[],"outputs":[]}
\ No newline at end of file
{"inputs":[],"outputs":[]}
\ No newline at end of file
This diff is collapsed.
......@@ -8,7 +8,6 @@ class Tile {
Tile({required this.image, required this.alignment});
Widget croppedImageTile(double widthFactor) {
print("creating single tile");
return FittedBox(
fit: BoxFit.fill,
......@@ -42,31 +41,68 @@ class _Exo5 extends State<Exo5> {
Widget build(BuildContext context) {
print("building state");
int i = 0;
int j = 0;
return Scaffold(
appBar: AppBar(
title: const Text('Display a Tile as a Cropped Image'),
centerTitle: true,
),
body:
Column(
children: [
Text("col"),
Container(
margin: const EdgeInsets.all(20.0),
child: GridView.count(
primary: false,
padding: const EdgeInsets.all(1),
crossAxisSpacing: 1,
mainAxisSpacing: 1,
crossAxisCount: colNb, // Nombre de colonnes
children: [Text("aaaa"), Text("bbb"), Text("ccc")] // createTilesFromImage(colNb)
)),
],
))
;
}
body: Column(children: [
Container(
margin: const EdgeInsets.all(10.0),
child: SizedBox(
height: MediaQuery.of(context).size.height * 0.7,
width: MediaQuery.of(context).size.height * 0.7,
child: GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: colNb,
),
itemCount: colNb * colNb,
itemBuilder: (BuildContext context, int index) {
Tile tile;
tile = Tile(image: image, alignment:
Alignment(-1 + 2 * j.toDouble() / (colNb.toDouble() - 1),
-1 + 2 * i.toDouble() / (colNb.toDouble() - 1))
);
int ii = i;
int jj = j;
j++;
if(j == colNb){
i++;
j = 0;
}
return Flexible(child: Container(
margin: EdgeInsets.all(10.0 / colNb),
child: InkWell(
child: tile.croppedImageTile(1 / colNb),
onTap: () {
print("tapped on " + ii.toString() + " " + jj.toString());
}
)
));
}
)
)
),
Slider(
value: colNb.toDouble(),
min: 2,
max: 6,
onChanged: (double value) {
setState(() {
colNb = value.toInt();
});
}
),
]),
);
}
List<Widget> createTilesFromImage(int colNb) {
print("creating tiles");
......@@ -74,13 +110,13 @@ class _Exo5 extends State<Exo5> {
List<Widget> res = <Widget>[];
for(int i=0; i<colNb; i++){
for(int j=0; j<colNb; j++){
tile = Tile(image: image, alignment: Alignment(-1 + 2 * j.toDouble() / colNb.toDouble(), -1 + 2 * i.toDouble() / colNb.toDouble()));
tile = Tile(image: image, alignment:
Alignment(-1 + 2 * j.toDouble() / (colNb.toDouble() - 1),
-1 + 2 * i.toDouble() / (colNb.toDouble() - 1))
);
res.add(InkWell(
child: tile.croppedImageTile(1 / colNb),
onTap: () {
print("tapped on tile $i $j");
},
));
}
}
......
......@@ -79,26 +79,26 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: cdd14e3836065a1f6302a236ec8b5f700695c803c57ae11a1c84df31e6bcf831
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.3"
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "9b2ef90589911d665277464e0482b209d39882dffaaf4ef69a3561a3354b2ebc"
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: fd3cd66cb2bcd7b50dcd3b413af49d78051f809c8b3f6e047962765c15a0d23d
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.0"
version: "3.0.1"
lints:
dependency: transitive
description:
......@@ -127,10 +127,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.12.0"
path:
dependency: transitive
description:
......
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