137 lines
4.6 KiB
Dart
137 lines
4.6 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,
|
|
),
|
|
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,
|
|
),
|
|
],
|
|
),
|
|
Chip(
|
|
labelPadding: EdgeInsets.symmetric(
|
|
horizontal: 0,
|
|
vertical: 0,
|
|
),
|
|
label: Text(
|
|
tipe ?? "Text",
|
|
style: TextStyle(color: Colors.white, fontSize: 14),
|
|
),
|
|
backgroundColor: Colors.blue,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|