projet debut
This commit is contained in:
@@ -1,12 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() {
|
||||
runApp(
|
||||
Container(
|
||||
color: Colors.red,
|
||||
alignment: Alignment.center,
|
||||
margin: const EdgeInsets.all(100),
|
||||
child: const Text("Hello world", textDirection: TextDirection.ltr),
|
||||
),
|
||||
);
|
||||
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
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user