main.dart
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
theme: ThemeData(primarySwatch: Colors.indigo),
home: Scaffold(
appBar: AppBar(
title: const Text("Flutter - Card With Image")
),
body: bodyContent()
)
)
);
}
bodyContent(){
return SizedBox(
width: double.infinity,
height: 250,
child: Card(
elevation: 6,
margin: const EdgeInsets.all(12),
child: Padding(
padding: const EdgeInsets.all(16),
child: Image.network(
"https://picsum.photos/600",
fit: BoxFit.cover
)
)
)
);
}
More flutter tutorials
- flutter – How to create ExpansionPanelList
- flutter – ExpansionPanelList example
- flutter – How to use ExpansionPanel
- flutter – Padding background color
- flutter – Padding percentage
- flutter – Widget minHeight
- flutter – ConstrainedBox maxHeight
- flutter – BoxDecoration opacity
- flutter – BoxDecoration background color
- flutter – How to use LimitedBox
- flutter – How to use GridView
- flutter – Card elevation
- flutter – Card shadow
- flutter – Card padding
- flutter – Card with image and text