change pictures, add shadow to Card

This commit is contained in:
shirotame 2024-10-03 00:15:45 +04:00
parent 22cc6a561b
commit 43ef610e40

View File

@ -30,20 +30,20 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
List<_CardData> data = [
_CardData(
textData: "Random picture",
imageUrl: "https://loremflickr.com/150/150"),
textData: "250x150 picture",
imageUrl: "https://loremflickr.com/250/150/kitty"),
_CardData(
textData: "Another picture",
imageUrl: "https://loremflickr.com/150/150?random=12"),
textData: "200x250 picture",
imageUrl: "https://loremflickr.com/200/250/kitty"),
_CardData(
textData: "200x200 picture",
imageUrl: "https://loremflickr.com/200/200"),
imageUrl: "https://loremflickr.com/200/200/kitty"),
_CardData(
textData: "100x150 picture",
imageUrl: "https://loremflickr.com/100/150"),
imageUrl: "https://loremflickr.com/100/150/kitty"),
_CardData(
textData: "300x150 picture",
imageUrl: "https://loremflickr.com/350/150"),
imageUrl: "https://loremflickr.com/350/150/kitty"),
];
@override
Widget build(BuildContext context) {
@ -70,10 +70,10 @@ class _CardData {
}
class _Card extends StatelessWidget {
String text;
String imageUrl;
final String text;
final String imageUrl;
_Card({super.key, required this.text, required this.imageUrl});
const _Card({required this.text, required this.imageUrl});
factory _Card.withData(_CardData d) => _Card(
text: d.textData,
@ -88,6 +88,13 @@ class _Card extends StatelessWidget {
margin: EdgeInsets.all(5.0),
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 3,
offset: const Offset(0, 2),
blurRadius: 4)
],
color: Theme.of(context).colorScheme.inversePrimary,
borderRadius: BorderRadius.circular(20)),
child: Row(