From ae51f1a835c044b4916b260ba9ff707f1e6b4396 Mon Sep 17 00:00:00 2001 From: bimabuana Date: Mon, 6 Jul 2026 15:59:52 +0700 Subject: [PATCH] revert: hapus integrasi debit air (water flow/volume) pada frontend --- lib/features/iot/page/home_page.dart | 36 ------------------- lib/features/iot/widgets/monitoring_card.dart | 13 ++----- lib/models/sensor_model.dart | 16 ++------- 3 files changed, 5 insertions(+), 60 deletions(-) diff --git a/lib/features/iot/page/home_page.dart b/lib/features/iot/page/home_page.dart index e7083fe..82d07b8 100644 --- a/lib/features/iot/page/home_page.dart +++ b/lib/features/iot/page/home_page.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../../../core/app_theme.dart'; -import '../../../models/monitoring_status.dart'; import '../../auth/auth_notifier.dart'; import '../../auth/auth_state.dart'; import '../providers/monitoring_provider.dart'; @@ -213,41 +212,6 @@ class MonitoringPage extends ConsumerWidget { const SizedBox(height: 16), - // ── Sensor cards Row 2 (Debit & Volume Air) ─── - Row( - children: [ - Expanded( - child: MonitoringCard( - value: (monitoring.latest?.waterFlow ?? 0.0).toStringAsFixed(1), - unit: ' L/m', - subtitle: 'Debit Aliran Air', - status: MonitoringStatus.normal, - gradient: const LinearGradient( - colors: [Color(0xFF0288D1), Color(0xFF005691)], - begin: Alignment.topLeft, - end: Alignment.bottomRight, - ), - ), - ), - const SizedBox(width: 16), - Expanded( - child: MonitoringCard( - value: (monitoring.latest?.waterVolume ?? 0.0).toStringAsFixed(1), - unit: ' L', - subtitle: 'Total Volume Air', - status: MonitoringStatus.normal, - gradient: const LinearGradient( - colors: [Color(0xFF00B0FF), Color(0xFF0091EA)], - begin: Alignment.topLeft, - end: Alignment.bottomRight, - ), - ), - ), - ], - ), - - const SizedBox(height: 16), - // ── Info Waktu Penyiraman Terbaik & Rentang Aman ── Container( padding: const EdgeInsets.all(16), diff --git a/lib/features/iot/widgets/monitoring_card.dart b/lib/features/iot/widgets/monitoring_card.dart index 25e52ad..bf1a82a 100644 --- a/lib/features/iot/widgets/monitoring_card.dart +++ b/lib/features/iot/widgets/monitoring_card.dart @@ -35,16 +35,9 @@ class MonitoringCard extends StatelessWidget { } IconData get _bgIcon { - final sub = subtitle.toLowerCase(); - if (sub.contains('suhu')) { - return Icons.thermostat; - } else if (sub.contains('debit') || sub.contains('alir')) { - return Icons.waves; - } else if (sub.contains('volume') || sub.contains('total')) { - return Icons.opacity; - } else { - return Icons.water_drop; - } + return subtitle.toLowerCase().contains('suhu') + ? Icons.thermostat + : Icons.water_drop; } @override diff --git a/lib/models/sensor_model.dart b/lib/models/sensor_model.dart index 00549ee..09a112f 100644 --- a/lib/models/sensor_model.dart +++ b/lib/models/sensor_model.dart @@ -1,9 +1,7 @@ -/// Model untuk data sensor IoT (suhu, kelembapan, & debit air). +/// Model untuk data sensor IoT (suhu & kelembapan). class SensorModel { final double temperature; final double humidity; - final double waterFlow; - final double waterVolume; final bool relayOn; final String mode; final DateTime timestamp; @@ -11,8 +9,6 @@ class SensorModel { const SensorModel({ required this.temperature, required this.humidity, - this.waterFlow = 0.0, - this.waterVolume = 0.0, this.relayOn = false, this.mode = 'auto', required this.timestamp, @@ -22,8 +18,6 @@ class SensorModel { return SensorModel( temperature: (json['temperature'] as num?)?.toDouble() ?? 0.0, humidity: (json['humidity'] as num?)?.toDouble() ?? 0.0, - waterFlow: (json['water_flow'] as num?)?.toDouble() ?? 0.0, - waterVolume: (json['water_volume'] as num?)?.toDouble() ?? 0.0, relayOn: json['relay_state'] as bool? ?? false, mode: json['mode'] as String? ?? 'auto', timestamp: json['timestamp'] != null @@ -37,8 +31,6 @@ class SensorModel { Map toJson() => { 'temperature': temperature, 'humidity': humidity, - 'water_flow': waterFlow, - 'water_volume': waterVolume, 'relay_state': relayOn, 'mode': mode, 'timestamp': timestamp.toIso8601String(), @@ -47,8 +39,6 @@ class SensorModel { SensorModel copyWith({ double? temperature, double? humidity, - double? waterFlow, - double? waterVolume, bool? relayOn, String? mode, DateTime? timestamp, @@ -56,8 +46,6 @@ class SensorModel { return SensorModel( temperature: temperature ?? this.temperature, humidity: humidity ?? this.humidity, - waterFlow: waterFlow ?? this.waterFlow, - waterVolume: waterVolume ?? this.waterVolume, relayOn: relayOn ?? this.relayOn, mode: mode ?? this.mode, timestamp: timestamp ?? this.timestamp, @@ -66,5 +54,5 @@ class SensorModel { @override String toString() => - 'SensorModel(temp: $temperature°C, hum: $humidity%, flow: $waterFlow L/min, vol: $waterVolume L, relay: $relayOn, mode: $mode, ts: $timestamp)'; + 'SensorModel(temp: $temperature°C, hum: $humidity%, relay: $relayOn, mode: $mode, ts: $timestamp)'; }