Files
Dart-Flutter/TP1/container/lib/main.dart
2025-10-14 12:29:11 +02:00

31 lines
896 B
Dart

import 'package:flutter/material.dart';
class CardWithImage extends StatelessWidget {
const CardWithImage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Card + Image de fond')),
body: Padding(
padding: const EdgeInsets.all(10),
child: Card(
elevation: 5,
clipBehavior: Clip.antiAlias,
child: SizedBox(
height: 150,
child: Stack(
fit: StackFit.expand, // l'enfant occupe toute la carte
children: [
// Image locale déclarée dans pubspec.yaml
Image.asset(
'assets/images/paris.jpg',
fit: BoxFit.cover, // couvre toute la surface, quitte à rogner
),
],
),
),
),
),
);
}
}