FreekakeApp/lib/components/card_list.dart
2025-05-08 13:32:33 +07:00

153 lines
5.3 KiB
Dart

import 'package:flutter/material.dart';
class CardList extends StatelessWidget {
final String title;
final String body;
final String? gambar;
final String? tipe;
final String? point;
final String? coint;
const CardList({
super.key,
required this.title,
required this.body,
this.gambar,
this.tipe,
this.point,
this.coint,
});
@override
Widget build(BuildContext context) {
return Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)),
elevation: 5,
color: const Color.fromARGB(225, 79, 76, 182),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ClipRRect(
borderRadius: BorderRadius.circular(
10.0,
), // Opsional: membuat gambar lebih rounded
child:
(gambar != null)
? Image.asset(
gambar!,
width: 65, // Atur ukuran gambar
height: 80,
fit: BoxFit.cover,
)
: Image.asset(
'assets/images/cepott.png',
width: 80, // Atur ukuran gambar
height: 120,
fit: BoxFit.cover,
),
),
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 1, width: 5),
Text(
body,
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 14,
fontWeight: FontWeight.normal,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
const Spacer(),
Padding(
padding: EdgeInsets.all(0.08),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Chip(
labelPadding: EdgeInsets.symmetric(
horizontal: 0,
vertical: 0,
),
label: Text(
point ?? ' 200',
style: TextStyle(
color: Colors.white,
fontSize: 12,
),
),
backgroundColor: Colors.blue,
avatar: const CircleAvatar(
backgroundColor: Colors.transparent,
child: Icon(
Icons.emoji_events,
size: 16,
color: Colors.amber,
),
),
),
SizedBox(width: 40),
Chip(
labelPadding: EdgeInsets.symmetric(
horizontal: 0,
vertical: 0,
),
label: Text(
coint ?? " 100",
style: TextStyle(
color: Colors.white,
fontSize: 12,
),
),
backgroundColor: Colors.blue,
avatar: const CircleAvatar(
backgroundColor: Colors.transparent,
child: Icon(
Icons.monetization_on,
size: 12,
color: Colors.amber,
),
),
),
],
),
Chip(
labelPadding: EdgeInsets.symmetric(
horizontal: 0,
vertical: 0,
),
label: Text(
tipe ?? "Text",
style: TextStyle(color: Colors.white, fontSize: 14),
),
backgroundColor: Colors.blue,
),
],
),
),
],
),
),
],
),
),
);
}
}