185 lines
6.4 KiB
Dart
185 lines
6.4 KiB
Dart
// lib/app/widgets/monitoring_card.dart
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import '../modules/home/controllers/home_controller.dart';
|
|
|
|
class MonitoringCard extends StatelessWidget {
|
|
final InfusMonitoring item;
|
|
final VoidCallback? onTap;
|
|
|
|
const MonitoringCard({super.key, required this.item, this.onTap});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return InkWell(
|
|
onTap: onTap,
|
|
borderRadius: BorderRadius.circular(16),
|
|
child: Container(
|
|
margin: const EdgeInsets.only(bottom: 12),
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(16),
|
|
border: Border.all(color: Colors.grey.shade200, width: 1.5),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.grey.withOpacity(0.08),
|
|
blurRadius: 12,
|
|
offset: const Offset(0, 2),
|
|
),
|
|
],
|
|
),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// LEFT ICON
|
|
Container(
|
|
padding: const EdgeInsets.all(12),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFFE3F2FD),
|
|
borderRadius: BorderRadius.circular(14),
|
|
),
|
|
child: const Icon(
|
|
Icons.water_drop_outlined,
|
|
size: 36,
|
|
color: Color(0xFF2196F3),
|
|
),
|
|
),
|
|
const SizedBox(width: 16),
|
|
|
|
// RIGHT CONTENT
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// DROPS
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
children: [
|
|
Text(
|
|
item.dropsPerMinute.split(' ')[0],
|
|
style: const TextStyle(
|
|
fontSize: 24,
|
|
fontWeight: FontWeight.bold,
|
|
color: Color(0xFF2196F3),
|
|
height: 1,
|
|
),
|
|
),
|
|
const SizedBox(width: 6),
|
|
Padding(
|
|
padding: const EdgeInsets.only(bottom: 3),
|
|
child: Text(
|
|
'tetes/menit',
|
|
style: TextStyle(
|
|
fontSize: 13,
|
|
color: Colors.grey.shade600,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
const SizedBox(height: 6),
|
|
|
|
// LAST UPDATE
|
|
Text(
|
|
'Last update • ${Get.find<HomeController>().getLastUpdateText(item.lastUpdate)}',
|
|
style: TextStyle(fontSize: 11, color: Colors.grey.shade600),
|
|
),
|
|
|
|
const SizedBox(height: 12),
|
|
|
|
// ROOM & DEVICE
|
|
Wrap(
|
|
spacing: 8,
|
|
children: [
|
|
// ROOM BADGE
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 12,
|
|
vertical: 6,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFFE3F2FD),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Text(
|
|
item.room,
|
|
style: const TextStyle(
|
|
fontSize: 11,
|
|
fontWeight: FontWeight.w600,
|
|
color: Color(0xFF2196F3),
|
|
),
|
|
),
|
|
),
|
|
|
|
// DEVICE BADGE
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 12,
|
|
vertical: 6,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: Colors.grey.shade100,
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Container(
|
|
width: 6,
|
|
height: 6,
|
|
decoration: const BoxDecoration(
|
|
color: Color(0xFF4CAF50),
|
|
shape: BoxShape.circle,
|
|
),
|
|
),
|
|
const SizedBox(width: 6),
|
|
Text(
|
|
item.deviceId,
|
|
style: TextStyle(
|
|
fontSize: 11,
|
|
fontWeight: FontWeight.w600,
|
|
color: Colors.grey.shade700,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
// PATIENT NAME BADGE (AUTO WIDTH - GREEN THEME)
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 12,
|
|
vertical: 6,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFFE8F5E9), // hijau soft
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Text(
|
|
item.patientName,
|
|
style: const TextStyle(
|
|
fontSize: 11,
|
|
fontWeight: FontWeight.w600,
|
|
color: Color(0xFF2E7D32),
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|