217 lines
7.6 KiB
Dart
217 lines
7.6 KiB
Dart
// lib/app/modules/home_patient/views/home_patient_view.dart
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import '../controllers/home_patient_controller.dart';
|
|
import '../../../widgets/banner_slider.dart';
|
|
import '../../../widgets/monitoring_patient_card.dart';
|
|
import '../../../widgets/history_grafik_card.dart';
|
|
import '../../../widgets/notification_patient_card.dart';
|
|
|
|
class HomePatientView extends GetView<HomePatientController> {
|
|
const HomePatientView({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Get.put(HomePatientController());
|
|
|
|
return Scaffold(
|
|
backgroundColor: Colors.white,
|
|
body: SafeArea(
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// Header
|
|
Padding(
|
|
padding: const EdgeInsets.all(20),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Obx(
|
|
() => Text(
|
|
'Halo ${controller.patientName.value}',
|
|
style: const TextStyle(
|
|
fontSize: 24,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
padding: const EdgeInsets.all(8),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: Colors.grey[300]!),
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
child: const Icon(
|
|
Icons.logout,
|
|
color: Colors.red,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
|
|
// Banner Slider - Gunakan widget universal
|
|
BannerSlider(
|
|
bannerImages: controller.bannerImages,
|
|
currentCarouselIndex: controller.currentCarouselIndex,
|
|
onPageChanged: controller.updateCarouselIndex,
|
|
),
|
|
|
|
const SizedBox(height: 15),
|
|
|
|
// Monitoring Infus Section
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
const Text(
|
|
'Monitoring Infus',
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
TextButton(
|
|
onPressed: () {},
|
|
child: const Text(
|
|
'See all',
|
|
style: TextStyle(
|
|
color: Color(0xFF2196F3),
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
|
|
// Monitoring Card
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
child: Obx(
|
|
() => MonitoringPatientCard(
|
|
dropsPerMinute: controller.currentInfusData.value.dropsPerMinute,
|
|
room: controller.currentInfusData.value.room,
|
|
deviceId: controller.currentInfusData.value.deviceId,
|
|
updateTime: controller.currentInfusData.value.updateTime,
|
|
onTap: () {
|
|
// Handle bookmark tap
|
|
},
|
|
),
|
|
),
|
|
),
|
|
|
|
const SizedBox(height: 15),
|
|
|
|
// History Data Section
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
const Text(
|
|
'History Data',
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
TextButton(
|
|
onPressed: () {},
|
|
child: const Text(
|
|
'See all',
|
|
style: TextStyle(
|
|
color: Color(0xFF2196F3),
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
|
|
// Chart Card
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
child: Obx(
|
|
() => HistoryGrafikCard(
|
|
dataPoints: controller.chartDataPoints.toList(),
|
|
onBookmarkTap: () {
|
|
// Handle bookmark tap
|
|
},
|
|
),
|
|
),
|
|
),
|
|
|
|
const SizedBox(height: 15),
|
|
|
|
// History Notifikasi Section
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
const Text(
|
|
'History Notifikasi',
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
TextButton(
|
|
onPressed: () {},
|
|
child: const Text(
|
|
'See all',
|
|
style: TextStyle(
|
|
color: Color(0xFF2196F3),
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
|
|
// Notifications List
|
|
Obx(
|
|
() => ListView.builder(
|
|
shrinkWrap: true,
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
itemCount: controller.notificationsList.length,
|
|
itemBuilder: (context, index) {
|
|
final notification = controller.notificationsList[index];
|
|
return NotificationPatientCard(
|
|
title: notification.title,
|
|
message: notification.message,
|
|
room: notification.room,
|
|
deviceId: notification.deviceId,
|
|
timeAgo: notification.timeAgo,
|
|
onTap: () {
|
|
// Handle notification tap
|
|
},
|
|
);
|
|
},
|
|
),
|
|
),
|
|
|
|
const SizedBox(height: 20),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
|
|
// Floating Action Button - Call Nurse
|
|
floatingActionButton: FloatingActionButton(
|
|
onPressed: () => controller.showCallDialog(context),
|
|
backgroundColor: const Color(0xFF2196F3),
|
|
child: const Icon(
|
|
Icons.phone,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |