Commit 0c7efbee authored by m-spi's avatar m-spi

TP2 exo4

parent d5754654
......@@ -170,7 +170,7 @@
"languageVersion": "3.4"
}
],
"generated": "2024-02-14T08:31:20.629771Z",
"generated": "2024-02-14T09:30:03.769996Z",
"generator": "pub",
"generatorVersion": "3.4.0-131.0.dev"
}
import 'package:flutter/material.dart';
class Tile {
String imageURL;
Alignment alignment;
Tile({required this.imageURL, required this.alignment});
Widget croppedImageTile() {
return FittedBox(
fit: BoxFit.fill,
child: ClipRect(
child: Container(
child: Align(
alignment: this.alignment,
widthFactor: 0.3,
heightFactor: 0.3,
child: Image.network(this.imageURL),
),
),
),
);
}
}
Tile tile = new Tile(
imageURL: 'https://picsum.photos/512', alignment: Alignment(0, 0));
class Exo3 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Display a Tile as a Cropped Image'),
centerTitle: true,
),
body: Center(
child: Column(children: [
SizedBox(
width: 150.0,
height: 150.0,
child: Container(
margin: EdgeInsets.all(20.0),
child: this.createTileWidgetFrom(tile))),
Container(
height: 200,
child: Image.network('https://picsum.photos/512',
fit: BoxFit.cover))
])),
);
}
Widget createTileWidgetFrom(Tile tile) {
return InkWell(
child: tile.croppedImageTile(),
onTap: () {
print("tapped on tile");
},
);
}
}
import 'package:flutter/material.dart';
import 'package:tp2/exo1.dart';
import 'package:tp2/exo2.dart';
import 'exo1.dart';
import 'package:tp2/exo3.dart';
class Exos {
......@@ -28,6 +29,11 @@ void main() {
'A description of what needs to be done for Todo ',
Exo2()
),
Exos(
'Exercice 3',
'desc',
Exo3()
)
// Next exo
],
),
......
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