revert: hapus integrasi debit air (water flow/volume) pada frontend
This commit is contained in:
parent
ce118a806b
commit
ae51f1a835
|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
import '../../../core/app_theme.dart';
|
import '../../../core/app_theme.dart';
|
||||||
import '../../../models/monitoring_status.dart';
|
|
||||||
import '../../auth/auth_notifier.dart';
|
import '../../auth/auth_notifier.dart';
|
||||||
import '../../auth/auth_state.dart';
|
import '../../auth/auth_state.dart';
|
||||||
import '../providers/monitoring_provider.dart';
|
import '../providers/monitoring_provider.dart';
|
||||||
|
|
@ -213,41 +212,6 @@ class MonitoringPage extends ConsumerWidget {
|
||||||
|
|
||||||
const SizedBox(height: 16),
|
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 ──
|
// ── Info Waktu Penyiraman Terbaik & Rentang Aman ──
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
|
|
|
||||||
|
|
@ -35,16 +35,9 @@ class MonitoringCard extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
IconData get _bgIcon {
|
IconData get _bgIcon {
|
||||||
final sub = subtitle.toLowerCase();
|
return subtitle.toLowerCase().contains('suhu')
|
||||||
if (sub.contains('suhu')) {
|
? Icons.thermostat
|
||||||
return Icons.thermostat;
|
: Icons.water_drop;
|
||||||
} 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
/// Model untuk data sensor IoT (suhu, kelembapan, & debit air).
|
/// Model untuk data sensor IoT (suhu & kelembapan).
|
||||||
class SensorModel {
|
class SensorModel {
|
||||||
final double temperature;
|
final double temperature;
|
||||||
final double humidity;
|
final double humidity;
|
||||||
final double waterFlow;
|
|
||||||
final double waterVolume;
|
|
||||||
final bool relayOn;
|
final bool relayOn;
|
||||||
final String mode;
|
final String mode;
|
||||||
final DateTime timestamp;
|
final DateTime timestamp;
|
||||||
|
|
@ -11,8 +9,6 @@ class SensorModel {
|
||||||
const SensorModel({
|
const SensorModel({
|
||||||
required this.temperature,
|
required this.temperature,
|
||||||
required this.humidity,
|
required this.humidity,
|
||||||
this.waterFlow = 0.0,
|
|
||||||
this.waterVolume = 0.0,
|
|
||||||
this.relayOn = false,
|
this.relayOn = false,
|
||||||
this.mode = 'auto',
|
this.mode = 'auto',
|
||||||
required this.timestamp,
|
required this.timestamp,
|
||||||
|
|
@ -22,8 +18,6 @@ class SensorModel {
|
||||||
return SensorModel(
|
return SensorModel(
|
||||||
temperature: (json['temperature'] as num?)?.toDouble() ?? 0.0,
|
temperature: (json['temperature'] as num?)?.toDouble() ?? 0.0,
|
||||||
humidity: (json['humidity'] 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,
|
relayOn: json['relay_state'] as bool? ?? false,
|
||||||
mode: json['mode'] as String? ?? 'auto',
|
mode: json['mode'] as String? ?? 'auto',
|
||||||
timestamp: json['timestamp'] != null
|
timestamp: json['timestamp'] != null
|
||||||
|
|
@ -37,8 +31,6 @@ class SensorModel {
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'temperature': temperature,
|
'temperature': temperature,
|
||||||
'humidity': humidity,
|
'humidity': humidity,
|
||||||
'water_flow': waterFlow,
|
|
||||||
'water_volume': waterVolume,
|
|
||||||
'relay_state': relayOn,
|
'relay_state': relayOn,
|
||||||
'mode': mode,
|
'mode': mode,
|
||||||
'timestamp': timestamp.toIso8601String(),
|
'timestamp': timestamp.toIso8601String(),
|
||||||
|
|
@ -47,8 +39,6 @@ class SensorModel {
|
||||||
SensorModel copyWith({
|
SensorModel copyWith({
|
||||||
double? temperature,
|
double? temperature,
|
||||||
double? humidity,
|
double? humidity,
|
||||||
double? waterFlow,
|
|
||||||
double? waterVolume,
|
|
||||||
bool? relayOn,
|
bool? relayOn,
|
||||||
String? mode,
|
String? mode,
|
||||||
DateTime? timestamp,
|
DateTime? timestamp,
|
||||||
|
|
@ -56,8 +46,6 @@ class SensorModel {
|
||||||
return SensorModel(
|
return SensorModel(
|
||||||
temperature: temperature ?? this.temperature,
|
temperature: temperature ?? this.temperature,
|
||||||
humidity: humidity ?? this.humidity,
|
humidity: humidity ?? this.humidity,
|
||||||
waterFlow: waterFlow ?? this.waterFlow,
|
|
||||||
waterVolume: waterVolume ?? this.waterVolume,
|
|
||||||
relayOn: relayOn ?? this.relayOn,
|
relayOn: relayOn ?? this.relayOn,
|
||||||
mode: mode ?? this.mode,
|
mode: mode ?? this.mode,
|
||||||
timestamp: timestamp ?? this.timestamp,
|
timestamp: timestamp ?? this.timestamp,
|
||||||
|
|
@ -66,5 +54,5 @@ class SensorModel {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() =>
|
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)';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue