MIF_E31222451/lib/components/riwayat_penimbangan.dart

140 lines
4.6 KiB
Dart

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class RiwayatPenimbangan extends StatelessWidget {
final DocumentSnapshot<Map<String, dynamic>> doc;
const RiwayatPenimbangan({
super.key,
required this.doc,
});
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.only(bottom: 16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 10,
spreadRadius: 0,
offset: const Offset(0, 2),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Header with date
Container(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
decoration: const BoxDecoration(
color: Color(0xFF1D91AA),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
const Icon(
Icons.calendar_today,
color: Colors.white,
size: 16,
),
const SizedBox(width: 8),
Text(
doc.data()?["tanggal"] ?? "",
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.w600,
color: Colors.white,
),
),
],
),
],
),
),
// Weight details
Padding(
padding: const EdgeInsets.all(20),
child: Row(
children: [
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: const Color(0xFF1D91AA).withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: const Icon(
Icons.monitor_weight,
color: Color(0xFF1D91AA),
size: 20,
),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
"Bobot Terkini",
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Color(0xFF1D91AA),
),
),
const SizedBox(height: 4),
Row(
children: [
Text(
doc.data()?["bobot_akhir"] ?? "",
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.w700,
color: Colors.black87,
),
),
const SizedBox(width: 4),
const Text(
"Kg",
style: TextStyle(
fontSize: 12,
color: Colors.black54,
),
),
],
),
],
),
),
// Container(
// padding: const EdgeInsets.all(8),
// decoration: BoxDecoration(
// color: Colors.green.withOpacity(0.1),
// borderRadius: BorderRadius.circular(8),
// ),
// child: const Icon(
// Icons.trending_up,
// color: Colors.green,
// size: 20,
// ),
// ),
],
),
),
],
),
);
}
}