31 lines
896 B
Dart
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
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |