From 410c51722bd490b011aebe20746506034e75a5ba Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Wed, 15 Apr 2026 00:18:44 +0700 Subject: [PATCH 01/19] oke --- .../views/widgets/period_selector.dart | 1 + .../widgets/wind_speed_chart_widget.dart | 58 ++++++++ .../wind_speed/views/wind_speed_screen.dart | 132 ++++++++++++------ 3 files changed, 148 insertions(+), 43 deletions(-) create mode 100644 lib/screens/monitoring/wind_speed/views/widgets/period_selector.dart create mode 100644 lib/screens/monitoring/wind_speed/views/widgets/wind_speed_chart_widget.dart diff --git a/lib/screens/monitoring/wind_speed/views/widgets/period_selector.dart b/lib/screens/monitoring/wind_speed/views/widgets/period_selector.dart new file mode 100644 index 0000000..067b14a --- /dev/null +++ b/lib/screens/monitoring/wind_speed/views/widgets/period_selector.dart @@ -0,0 +1 @@ +/// === Tombol Filter Jam/Hari/Minggu === /// diff --git a/lib/screens/monitoring/wind_speed/views/widgets/wind_speed_chart_widget.dart b/lib/screens/monitoring/wind_speed/views/widgets/wind_speed_chart_widget.dart new file mode 100644 index 0000000..7639bce --- /dev/null +++ b/lib/screens/monitoring/wind_speed/views/widgets/wind_speed_chart_widget.dart @@ -0,0 +1,58 @@ +/// === File ini khusus untuk urusan Grafik === /// +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +class WindSpeedChartWidget extends StatelessWidget { + final List dailySpeeds; + + const WindSpeedChartWidget({super.key, required this.dailySpeeds}); + + @override + Widget build(BuildContext context) { + return Container( + height: 250, + padding: const EdgeInsets.fromLTRB(10, 20, 20, 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(25), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.05), + blurRadius: 10, + offset: const Offset(0, 5), + ) + ], + ), + child: LineChart( + LineChartData( + gridData: const FlGridData(show: false), + titlesData: const FlTitlesData(show: false), + borderData: FlBorderData(show: false), + lineBarsData: [ + LineChartBarData( + spots: dailySpeeds.asMap().entries.map((e) { + return FlSpot(e.key.toDouble(), e.value); + }).toList(), + isCurved: true, + color: Colors.blue.shade700, + barWidth: 4, + isStrokeCapRound: true, + dotData: const FlDotData(show: false), + belowBarData: BarAreaData( + show: true, + gradient: LinearGradient( + colors: [ + Colors.blue.withOpacity(0.3), + Colors.blue.withOpacity(0.0) + ], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart b/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart index 25785df..c8d2567 100644 --- a/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart +++ b/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart @@ -2,41 +2,51 @@ import 'package:flutter/material.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import '../blocs/wind_speed_bloc.dart'; +import './widgets/wind_speed_chart_widget.dart'; class WindSpeedScreen extends StatelessWidget { const WindSpeedScreen({super.key}); @override Widget build(BuildContext context) { - // Pastikan MonitoringRepository sudah diprovide di atas screen ini return Scaffold( - appBar: AppBar(title: const Text("Wind Speed Monitoring")), + backgroundColor: Colors.grey.shade100, + appBar: AppBar( + title: const Text( + "Kecepatan Angin", + style: TextStyle(fontWeight: FontWeight.bold), + ), + centerTitle: true, + elevation: 0, + backgroundColor: Colors.transparent, + foregroundColor: Colors.black, + ), + + /// === Body area, lokasi dan tata letak Widgets === /// body: BlocBuilder( builder: (context, state) { if (state.isLoading) { return const Center(child: CircularProgressIndicator()); } - return Padding( - padding: const EdgeInsets.all(16.0), + return SingleChildScrollView( + padding: const EdgeInsets.all(20.0), child: Column( children: [ - // Card Informasi Kecepatan Saat Ini - _buildCurrentSpeedCard(state.currentSpeed), + /// ==== 1. Tampilan Angka Utama kecepatan angin (Hero Widget look) ==== /// + _buildMainSpeedDisplay(state.currentSpeed), const SizedBox(height: 30), - // Area Grafik - const Text("Grafik Kecepatan Angin", + const Text("Tren Real-time", style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)), - const SizedBox(height: 20), + const SizedBox(height: 15), + WindSpeedChartWidget(dailySpeeds: state.dailySpeeds), - SizedBox( - height: 300, - child: LineChart( - _mainData(state.dailySpeeds), - ), - ), + const SizedBox(height: 30), + + // 3. Info Tambahan (Status/Periode) + _buildDetailRow(state.selectedPeriod), ], ), ); @@ -45,39 +55,75 @@ class WindSpeedScreen extends StatelessWidget { ); } - Widget _buildCurrentSpeedCard(double speed) { - return Card( - elevation: 4, - child: ListTile( - leading: const Icon(Icons.wind_power, color: Colors.blue, size: 40), - title: const Text("Kecepatan Saat Ini"), - trailing: Text("${speed.toStringAsFixed(2)} m/s", - style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold)), + Widget _buildMainSpeedDisplay(double speed) { + return Container( + width: double.infinity, + padding: const EdgeInsets.symmetric(vertical: 40), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.blue.shade400, Colors.blue.shade800], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + ), + borderRadius: BorderRadius.circular(30), + boxShadow: [ + BoxShadow( + color: Colors.blue.withOpacity(0.3), + blurRadius: 20, + offset: const Offset(0, 10), + ) + ], + ), + child: Column( + children: [ + const Icon(Icons.air, color: Colors.white, size: 50), + const SizedBox( + height: 10, + ), + Text( + "${speed.toStringAsFixed(1)}", + style: const TextStyle( + fontSize: 80, fontWeight: FontWeight.bold, color: Colors.white), + ), + const Text("m/s", + style: TextStyle(fontSize: 20, color: Colors.white70)) + ], ), ); } - LineChartData _mainData(List speeds) { - return LineChartData( - gridData: const FlGridData(show: true), - titlesData: const FlTitlesData(show: true), // Bisa dikustom nanti - borderData: FlBorderData(show: true), - lineBarsData: [ - LineChartBarData( - // Mengubah List menjadi titik koordinat grafik (x, y) - spots: speeds.asMap().entries.map((e) { - return FlSpot(e.key.toDouble(), e.value); - }).toList(), - isCurved: true, // Biar garisnya melengkung halus - color: Colors.blue, - barWidth: 3, - dotData: const FlDotData(show: false), // Sembunyikan titik per data - belowBarData: BarAreaData( - show: true, - color: Colors.blue.withOpacity(0.2), // Efek bayangan di bawah garis - ), - ), + Widget _buildDetailRow(String period) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + _miniInfoCard("Status", "Normal", Icons.check_circle, Colors.green), + _miniInfoCard("Periode", period, Icons.timer, Colors.orange), ], ); } + + Widget _miniInfoCard(String label, String value, IconData icon, Color color) { + return Container( + width: 160, + padding: const EdgeInsets.all(15), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + ), + child: Row( + children: [ + Icon(icon, color: color, size: 30), + const SizedBox(width: 10), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(label, + style: const TextStyle(color: Colors.grey, fontSize: 12)), + Text(value, style: const TextStyle(fontWeight: FontWeight.bold)), + ], + ) + ], + ), + ); + } } From 2d1ccdb8b2a2f1474471a9944c0749e740b54f45 Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Wed, 15 Apr 2026 21:03:16 +0700 Subject: [PATCH 02/19] pembaruan wind_speed_screen.dart tampilan halaman kecepatan angin memperbarui tampilan dan period grafik dari harian, mingguan dan bulanan --- .../wind_speed/blocs/wind_speed_bloc.dart | 93 ++++++++++++++++--- .../views/widgets/period_selector.dart | 56 +++++++++++ .../wind_speed/views/wind_speed_screen.dart | 8 +- .../lib/src/firebase_monitoring_repo.dart | 24 +++++ .../lib/src/models/wind_speed.dart | 6 ++ .../lib/src/monitoring_repo.dart | 8 ++ 6 files changed, 182 insertions(+), 13 deletions(-) diff --git a/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart b/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart index 1ce90e6..76d5b63 100644 --- a/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart +++ b/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart @@ -17,21 +17,27 @@ class WindSpeedBloc extends Bloc { (event, emit) async { emit(state.copyWith(isLoading: true)); + // 1. Ambil semua history + final history = await _repository.getSensorHistory( + 'anemometer/history', (json) => MyWindSpeed.fromJson(json)); + + // 2. Petakan ke 24 jam (Harian) + final List dailyGraph = _mapHistoryToDaily(history); + + emit(state.copyWith( + dailySpeeds: dailyGraph, + isLoading: false, + )); + + // 2. Monitoring Real-time await emit.forEach( _repository.getSensorStream( 'anemometer/realtime', (json) => MyWindSpeed.fromJson(json)), onData: (data) { // Mengambil list lama dan menambah data baru untuk grafik - final updatedSpeeds = List.from(state.dailySpeeds) - ..add(data.speed); - // Batasi jumlah data di grafik (misal cuma simpan 20 data terakhir agar tidak berat) - if (updatedSpeeds.length > 20) { - updatedSpeeds.removeAt(0); - } return state.copyWith( currentSpeed: data.speed, - dailySpeeds: updatedSpeeds, // Update list grafik isLoading: false, ); }, @@ -41,13 +47,78 @@ class WindSpeedBloc extends Bloc { transformer: restartable(), ); - on((event, emit) { + on((event, emit) async { emit(state.copyWith(selectedPeriod: event.period)); + // Ambil ulang history dari database + final history = await _repository.getSensorHistory( + 'anemometer/history', (json) => MyWindSpeed.fromJson(json)); + List updatedGraph; + + // Pilih mapper berdasarkan pilihan user + if (event.period == "Minggu Ini") { + updatedGraph = _mapHistoryToWeekly(history); + } else if (event.period == "Bulan Ini") { + updatedGraph = _mapHistoryToMonthly(history); + } else { + updatedGraph = _mapHistoryToDaily(history); + } + + emit(state.copyWith( + dailySpeeds: updatedGraph, + isLoading: false, + )); }); } @override - Future close() { - return super.close(); - } + Future close() => super.close(); +} + +List _mapHistoryToDaily(List history) { + // Buat list 24 angka nol (representasi jam 00:00 - 23:00) + List slots = List.generate(24, (_) => 0.0); + + for (var item in history) { + // Ubah timestamp UTC ke jam lokal + DateTime date = item.timestamp; + + // Jika data ini adalah data hari ini, masukkan ke slot jamnya + if (date.day == DateTime.now().day) { + slots[date.hour] = item.speed; + } + } + return slots; +} + +// Mapper Mingguan (7 Slot: Senin - Minggu) +List _mapHistoryToWeekly(List history) { + List slots = List.generate(7, (_) => 0.0); + final now = DateTime.now(); + + // Mencari awal minggu ini (Senin) + DateTime startOfWeek = now.subtract(Duration(days: now.weekday - 1)); + startOfWeek = DateTime(startOfWeek.year, startOfWeek.month, startOfWeek.day); + + for (var item in history) { + if (item.timestamp.isAfter(startOfWeek)) { + // index 0 = Senin, dst. + slots[item.timestamp.weekday - 1] = item.speed; + } + } + return slots; +} + +// Mapper Bulanan (Sesuai jumlah hari di bulan ini) +List _mapHistoryToMonthly(List history) { + final now = DateTime.now(); + final daysInMonth = DateTime(now.year, now.month + 1, 0).day; + List slots = List.generate(daysInMonth, (_) => 0.0); + + for (var item in history) { + if (item.timestamp.month == now.month && item.timestamp.year == now.year) { + // index 0 = Tanggal 1, dst. + slots[item.timestamp.day - 1] = item.speed; + } + } + return slots; } diff --git a/lib/screens/monitoring/wind_speed/views/widgets/period_selector.dart b/lib/screens/monitoring/wind_speed/views/widgets/period_selector.dart index 067b14a..95c6f6c 100644 --- a/lib/screens/monitoring/wind_speed/views/widgets/period_selector.dart +++ b/lib/screens/monitoring/wind_speed/views/widgets/period_selector.dart @@ -1 +1,57 @@ /// === Tombol Filter Jam/Hari/Minggu === /// +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import '../../blocs/wind_speed_bloc.dart'; + +class PeriodSelector extends StatelessWidget { + const PeriodSelector({super.key}); + + @override + Widget build(BuildContext context) { + // Kita ambil state saat ini untuk tahu periode mana yang aktif + final selectedPeriod = + context.select((WindSpeedBloc bloc) => bloc.state.selectedPeriod); + + return Container( + padding: const EdgeInsets.all(4), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + _buildTab(context, "Hari Ini", selectedPeriod), + _buildTab(context, "Minggu Ini", selectedPeriod), + _buildTab(context, "Bulan Ini", selectedPeriod), + ], + ), + ); + } + + Widget _buildTab(BuildContext context, String label, String current) { + bool isActive = label == current; + + return GestureDetector( + onTap: () { + // Kirim event ke Bloc saat tombol diklik + context.read().add(WindSpeedPeriodChanged(label)); + }, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + decoration: BoxDecoration( + color: isActive ? Colors.blue : Colors.transparent, + borderRadius: BorderRadius.circular(12), + ), + child: Text( + label, + style: TextStyle( + color: isActive ? Colors.white : Colors.grey, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ), + ), + ); + } +} diff --git a/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart b/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart index c8d2567..84d4a4b 100644 --- a/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart +++ b/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart @@ -1,8 +1,9 @@ import 'package:flutter/material.dart'; -import 'package:fl_chart/fl_chart.dart'; +// import 'package:fl_chart/fl_chart.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import '../blocs/wind_speed_bloc.dart'; import './widgets/wind_speed_chart_widget.dart'; +import 'widgets/period_selector.dart'; class WindSpeedScreen extends StatelessWidget { const WindSpeedScreen({super.key}); @@ -37,10 +38,13 @@ class WindSpeedScreen extends StatelessWidget { _buildMainSpeedDisplay(state.currentSpeed), const SizedBox(height: 30), - const Text("Tren Real-time", + const Text("Tren Kecepatan", style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)), const SizedBox(height: 15), + const PeriodSelector(), + const SizedBox(height: 15), + WindSpeedChartWidget(dailySpeeds: state.dailySpeeds), const SizedBox(height: 30), diff --git a/packages/monitoring_repository/lib/src/firebase_monitoring_repo.dart b/packages/monitoring_repository/lib/src/firebase_monitoring_repo.dart index 5d19c33..2dd935b 100644 --- a/packages/monitoring_repository/lib/src/firebase_monitoring_repo.dart +++ b/packages/monitoring_repository/lib/src/firebase_monitoring_repo.dart @@ -38,4 +38,28 @@ class FirebaseMonitoringRepo implements MonitoringRepository { final data = snapshot.value as Map? ?? {}; return mapper(data); } + + @override + Future> getSensorHistory( + String path, + T Function(Map json) mapper, + ) async { + try { + // Ambil data dari path history + final snapshot = await _db.ref(path).get(); + + if (snapshot.exists && snapshot.value is Map) { + final Map data = snapshot.value as Map; + + // Karena RTDB push() menghasilkan Map dengan ID unik, + // kita ambil values-nya saja dan ubah jadi List objek + return data.values.map((item) { + return mapper(item as Map); + }).toList(); + } + return []; + } catch (e) { + return []; + } + } } diff --git a/packages/monitoring_repository/lib/src/models/wind_speed.dart b/packages/monitoring_repository/lib/src/models/wind_speed.dart index 8aa88fb..afc1c9d 100644 --- a/packages/monitoring_repository/lib/src/models/wind_speed.dart +++ b/packages/monitoring_repository/lib/src/models/wind_speed.dart @@ -9,6 +9,12 @@ class MyWindSpeed { required this.timestamp, }); + static final empty = MyWindSpeed( + speed: 0.0, + pulse: 0, + timestamp: DateTime.fromMillisecondsSinceEpoch(0), + ); + factory MyWindSpeed.fromJson(Map json) { return MyWindSpeed( speed: (json['speed'] ?? 0).toDouble(), diff --git a/packages/monitoring_repository/lib/src/monitoring_repo.dart b/packages/monitoring_repository/lib/src/monitoring_repo.dart index d97747b..ac08d1f 100644 --- a/packages/monitoring_repository/lib/src/monitoring_repo.dart +++ b/packages/monitoring_repository/lib/src/monitoring_repo.dart @@ -1,13 +1,21 @@ import 'models/models.dart'; abstract class MonitoringRepository { + // fungsi untuk ambil data berkali/streaming Stream getSensorStream( String path, T Function(Map json) mapper, ); + // fungsi untuk ambil sensor sekali Future getSensorSnapshot( String path, T Function(Map json) mapper, ); + + // Fungsi untuk ambil riwayat (List) + Future> getSensorHistory( + String path, + T Function(Map json) mapper, + ); } From 828645da5baf72931705edd050cfffbbfd0dbad1 Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Thu, 16 Apr 2026 17:12:35 +0700 Subject: [PATCH 03/19] joss --- .../wind_speed/blocs/wind_speed_bloc.dart | 24 ++++++-- .../widgets/wind_speed_chart_widget.dart | 60 ++++++++++++++++++- .../wind_speed/views/wind_speed_screen.dart | 5 +- .../lib/src/models/wind_speed.dart | 2 +- .../lib/src/monitoring_repo.dart | 2 +- 5 files changed, 83 insertions(+), 10 deletions(-) diff --git a/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart b/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart index 76d5b63..2ae3c1f 100644 --- a/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart +++ b/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart @@ -34,10 +34,20 @@ class WindSpeedBloc extends Bloc { _repository.getSensorStream( 'anemometer/realtime', (json) => MyWindSpeed.fromJson(json)), onData: (data) { - // Mengambil list lama dan menambah data baru untuk grafik + // 1. Ambil list kecepatan yang ada saat ini di state + final updatedSpeeds = List.from(state.dailySpeeds); + + // 2. Tentukan di index mana data ini harus masuk (misal berdasarkan menit saat ini) + final int index = DateTime.now().minute; + + // 3. Update nilai di index tersebut + if (index < updatedSpeeds.length) { + updatedSpeeds[index] = data.speed; + } return state.copyWith( currentSpeed: data.speed, + dailySpeeds: updatedSpeeds, isLoading: false, ); }, @@ -76,16 +86,22 @@ class WindSpeedBloc extends Bloc { List _mapHistoryToDaily(List history) { // Buat list 24 angka nol (representasi jam 00:00 - 23:00) - List slots = List.generate(24, (_) => 0.0); + List slots = List.generate(24, (_) => 0.0); // mode asli + // Kita buat 60 slot (representasi menit 0-59) agar tiap menit kelihatan titik baru + // List slots = List.generate(60, (_) => 0.0); // mode percobaan for (var item in history) { // Ubah timestamp UTC ke jam lokal - DateTime date = item.timestamp; + DateTime date = item.timestamp; // sudah dateTime dari model // Jika data ini adalah data hari ini, masukkan ke slot jamnya if (date.day == DateTime.now().day) { slots[date.hour] = item.speed; - } + } // mode asli + // pakai menit untuk percobaan (date.minute) sebagai index supaya kelihatan pergerakannya + // if (date.day == DateTime.now().day) { + // slots[date.minute] = item.speed; + // } // mode percobaan/testing } return slots; } diff --git a/lib/screens/monitoring/wind_speed/views/widgets/wind_speed_chart_widget.dart b/lib/screens/monitoring/wind_speed/views/widgets/wind_speed_chart_widget.dart index 7639bce..2310e44 100644 --- a/lib/screens/monitoring/wind_speed/views/widgets/wind_speed_chart_widget.dart +++ b/lib/screens/monitoring/wind_speed/views/widgets/wind_speed_chart_widget.dart @@ -1,16 +1,19 @@ /// === File ini khusus untuk urusan Grafik === /// import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; +// import 'package:intl/intl.dart'; class WindSpeedChartWidget extends StatelessWidget { final List dailySpeeds; + final String period; // menambahkan parameter periode - const WindSpeedChartWidget({super.key, required this.dailySpeeds}); + const WindSpeedChartWidget( + {super.key, required this.dailySpeeds, required this.period}); @override Widget build(BuildContext context) { return Container( - height: 250, + height: 270, padding: const EdgeInsets.fromLTRB(10, 20, 20, 10), decoration: BoxDecoration( color: Colors.white, @@ -25,9 +28,37 @@ class WindSpeedChartWidget extends StatelessWidget { ), child: LineChart( LineChartData( + minY: 0, + maxY: 50, gridData: const FlGridData(show: false), - titlesData: const FlTitlesData(show: false), borderData: FlBorderData(show: false), + + // === PENGATURAN LABEL SUMBU X === + titlesData: FlTitlesData( + show: true, + rightTitles: + const AxisTitles(sideTitles: SideTitles(showTitles: false)), + topTitles: + const AxisTitles(sideTitles: SideTitles(showTitles: false)), + leftTitles: + const AxisTitles(sideTitles: SideTitles(showTitles: false)), + bottomTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + reservedSize: 30, + interval: + _getInterval(), // Mengatur jarak label agar tidak tumpang tindih + getTitlesWidget: (value, meta) { + return SideTitleWidget( + meta: meta, + space: 8, + child: Text( + _getBottomTitle(value), + style: const TextStyle( + color: Colors.grey, fontSize: 10), + ), + ); + }))), lineBarsData: [ LineChartBarData( spots: dailySpeeds.asMap().entries.map((e) { @@ -55,4 +86,27 @@ class WindSpeedChartWidget extends StatelessWidget { ), ); } + + // Logika untuk menentukan teks label di bawah + String _getBottomTitle(double value) { + int index = value.toInt(); + if (index < 0 || index >= dailySpeeds.length) return ''; + + if (period == "Hari Ini") { + // Tampilkan jam genap saja (0, 2, 4...) agar tidak penuh + return index % 4 == 0 ? "${index.toString().padLeft(2, '0')}:00" : ""; + } else if (period == "Minggu Ini") { + const days = ["Sen", "Sel", "Rab", "Kam", "Jum", "Sab", "Min"]; + return days[index % 7]; + } else { + // Bulanan: Tampilkan tanggal kelipatan 5 + return (index + 1) % 5 == 0 ? "${index + 1}" : ""; + } + } + + double _getInterval() { + if (period == "Hari Ini") return 1; // Cek tiap jam + if (period == "Minggu Ini") return 1; // Cek tiap hari + return 1; + } } diff --git a/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart b/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart index 84d4a4b..c80a830 100644 --- a/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart +++ b/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart @@ -45,7 +45,10 @@ class WindSpeedScreen extends StatelessWidget { const PeriodSelector(), const SizedBox(height: 15), - WindSpeedChartWidget(dailySpeeds: state.dailySpeeds), + WindSpeedChartWidget( + dailySpeeds: state.dailySpeeds, + period: state.selectedPeriod, + ), const SizedBox(height: 30), diff --git a/packages/monitoring_repository/lib/src/models/wind_speed.dart b/packages/monitoring_repository/lib/src/models/wind_speed.dart index afc1c9d..37357f8 100644 --- a/packages/monitoring_repository/lib/src/models/wind_speed.dart +++ b/packages/monitoring_repository/lib/src/models/wind_speed.dart @@ -20,7 +20,7 @@ class MyWindSpeed { speed: (json['speed'] ?? 0).toDouble(), pulse: (json['pulse'] ?? 0) as int, timestamp: DateTime.fromMillisecondsSinceEpoch( - (json['timestamp'] ?? 0) * 1000, // kalau dari Unix detik + (json['timesTamp'] ?? 0) * 1000, // kalau dari Unix detik ).toLocal(), ); } diff --git a/packages/monitoring_repository/lib/src/monitoring_repo.dart b/packages/monitoring_repository/lib/src/monitoring_repo.dart index ac08d1f..555796a 100644 --- a/packages/monitoring_repository/lib/src/monitoring_repo.dart +++ b/packages/monitoring_repository/lib/src/monitoring_repo.dart @@ -1,4 +1,4 @@ -import 'models/models.dart'; +// import 'models/models.dart'; abstract class MonitoringRepository { // fungsi untuk ambil data berkali/streaming From 95b1759344393c760a6a6d2119870e0833788d81 Mon Sep 17 00:00:00 2001 From: e32232340-Nadif <158453666+kleponijo@users.noreply.github.com> Date: Sun, 19 Apr 2026 07:39:04 +0700 Subject: [PATCH 04/19] oke --- lib/core/utils/time_series_mapper.dart | 82 +++++++ .../evaporasi/blocs/evaporasi_bloc.dart | 140 +++++++++++ .../{evaporasi.dart => evaporasi_screen.dart} | 0 .../wind_speed/blocs/wind_speed_bloc.dart | 225 +++++++++--------- .../wind_speed/blocs/wind_speed_state.dart | 6 +- 5 files changed, 345 insertions(+), 108 deletions(-) create mode 100644 lib/core/utils/time_series_mapper.dart rename lib/screens/monitoring/evaporasi/views/{evaporasi.dart => evaporasi_screen.dart} (100%) diff --git a/lib/core/utils/time_series_mapper.dart b/lib/core/utils/time_series_mapper.dart new file mode 100644 index 0000000..fd2df54 --- /dev/null +++ b/lib/core/utils/time_series_mapper.dart @@ -0,0 +1,82 @@ +class TimeSeriesMapper { + /// ========================= + /// 📅 DAILY (24 JAM) + /// ========================= + static List toDaily({ + required List data, + required DateTime Function(T) getTime, + required double Function(T) getValue, + }) { + final now = DateTime.now(); + final slots = List.filled(24, 0.0); + + for (final item in data) { + final time = getTime(item); + + if (_isSameDay(time, now)) { + slots[time.hour] = getValue(item); + } + } + + return slots; + } + + /// ========================= + /// 📅 WEEKLY (7 HARI) + /// ========================= + static List toWeekly({ + required List data, + required DateTime Function(T) getTime, + required double Function(T) getValue, + }) { + final now = DateTime.now(); + final slots = List.filled(7, 0.0); + + DateTime startOfWeek = + now.subtract(Duration(days: now.weekday - 1)); + startOfWeek = DateTime( + startOfWeek.year, startOfWeek.month, startOfWeek.day); + + for (final item in data) { + final time = getTime(item); + + if (time.isAfter(startOfWeek)) { + slots[time.weekday - 1] = getValue(item); + } + } + + return slots; + } + + /// ========================= + /// 📅 MONTHLY + /// ========================= + static List toMonthly({ + required List data, + required DateTime Function(T) getTime, + required double Function(T) getValue, + }) { + final now = DateTime.now(); + final daysInMonth = DateTime(now.year, now.month + 1, 0).day; + final slots = List.filled(daysInMonth, 0.0); + + for (final item in data) { + final time = getTime(item); + + if (time.month == now.month && time.year == now.year) { + slots[time.day - 1] = getValue(item); + } + } + + return slots; + } + + /// ========================= + /// 🧠 HELPER + /// ========================= + static bool _isSameDay(DateTime a, DateTime b) { + return a.year == b.year && + a.month == b.month && + a.day == b.day; + } +} \ No newline at end of file diff --git a/lib/screens/monitoring/evaporasi/blocs/evaporasi_bloc.dart b/lib/screens/monitoring/evaporasi/blocs/evaporasi_bloc.dart index e69de29..fd8fafb 100644 --- a/lib/screens/monitoring/evaporasi/blocs/evaporasi_bloc.dart +++ b/lib/screens/monitoring/evaporasi/blocs/evaporasi_bloc.dart @@ -0,0 +1,140 @@ +import 'dart:async'; +import 'package:bloc/bloc.dart'; +import 'package:equatable/equatable.dart'; +import 'package:monitoring_repository/monitoring_repository.dart'; + +import '../../../core/utils/time_series_mapper.dart'; + +part 'evaporasi_event.dart'; +part 'evaporasi_state.dart'; + +class EvaporasiBloc extends Bloc { + final MonitoringRepository _repository; + StreamSubscription? _subscription; + + EvaporasiBloc({required MonitoringRepository repository}) + : _repository = repository, + super(const EvaporasiState()) { + + on(_onStarted); + on<_EvaporasiRealtimeUpdated>(_onRealtimeUpdated); + on(_onPeriodChanged); + } + + /// ========================= + /// 🚀 START + /// ========================= + Future _onStarted( + WatchEvaporasiStarted event, + Emitter emit, + ) async { + + emit(state.copyWith(isLoading: true)); + + final history = await _repository.getSensorHistory( + 'evaporasi/history', + (json) => Evaporasi.fromJson(json), + ); + + final dailyGraph = TimeSeriesMapper.toDaily( + data: history, + getTime: (e) => e.timestamp, + getValue: (e) => e.value, // ⚠️ sesuaikan nama field + ); + + emit(state.copyWith( + history: history, + dailyValues: dailyGraph, + isLoading: false, + )); + + await _subscription?.cancel(); + + _subscription = _repository + .getSensorStream( + 'evaporasi/realtime', + (json) => Evaporasi.fromJson(json), + ) + .listen((data) { + add(_EvaporasiRealtimeUpdated(data)); + }); + } + + /// ========================= + /// ⚡ REALTIME + /// ========================= + void _onRealtimeUpdated( + _EvaporasiRealtimeUpdated event, + Emitter emit, + ) { + + final updated = List.from(state.dailyValues); + + final index = DateTime.now().hour; + + if (index < updated.length) { + updated[index] = event.data.value; // ⚠️ sesuaikan field + } + + emit(state.copyWith( + currentValue: event.data.value, + dailyValues: updated, + )); + } + + /// ========================= + /// 📊 PERIOD + /// ========================= + Future _onPeriodChanged( + EvaporasiPeriodChanged event, + Emitter emit, + ) async { + + emit(state.copyWith(isLoading: true, selectedPeriod: event.period)); + + final history = state.history; + + List updated; + + if (event.period == "Minggu Ini") { + updated = TimeSeriesMapper.toWeekly( + data: history, + getTime: (e) => e.timestamp, + getValue: (e) => e.value, + ); + } else if (event.period == "Bulan Ini") { + updated = TimeSeriesMapper.toMonthly( + data: history, + getTime: (e) => e.timestamp, + getValue: (e) => e.value, + ); + } else { + updated = TimeSeriesMapper.toDaily( + data: history, + getTime: (e) => e.timestamp, + getValue: (e) => e.value, + ); + } + + emit(state.copyWith( + dailyValues: updated, + isLoading: false, + )); + } + + @override + Future close() async { + await _subscription?.cancel(); + return super.close(); + } +} + +/// INTERNAL EVENT +class _EvaporasiRealtimeUpdated extends EvaporasiEvent { + final Evaporasi data; + + const _EvaporasiRealtimeUpdated(this.data); + + @override + List get props => [data]; +} \ No newline at end of file diff --git a/lib/screens/monitoring/evaporasi/views/evaporasi.dart b/lib/screens/monitoring/evaporasi/views/evaporasi_screen.dart similarity index 100% rename from lib/screens/monitoring/evaporasi/views/evaporasi.dart rename to lib/screens/monitoring/evaporasi/views/evaporasi_screen.dart diff --git a/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart b/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart index 2ae3c1f..f7b18ef 100644 --- a/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart +++ b/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart @@ -3,138 +3,149 @@ import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:monitoring_repository/monitoring_repository.dart'; import 'package:bloc_concurrency/bloc_concurrency.dart'; +import '../../../../core/utils/time_series_mapper.dart'; + part 'wind_speed_event.dart'; part 'wind_speed_state.dart'; class WindSpeedBloc extends Bloc { final MonitoringRepository _repository; + StreamSubscription? _subscription; WindSpeedBloc({required MonitoringRepository repository}) : _repository = repository, super(const WindSpeedState()) { - // Handler saat aplikasi minta mulai monitoring - on( - (event, emit) async { - emit(state.copyWith(isLoading: true)); - // 1. Ambil semua history - final history = await _repository.getSensorHistory( - 'anemometer/history', (json) => MyWindSpeed.fromJson(json)); + /// 🔥 START MONITORING + on(_onStarted, transformer: restartable()); - // 2. Petakan ke 24 jam (Harian) - final List dailyGraph = _mapHistoryToDaily(history); + /// 🔥 REALTIME UPDATE + on<_WindSpeedRealtimeUpdated>(_onRealtimeUpdated); - emit(state.copyWith( - dailySpeeds: dailyGraph, - isLoading: false, - )); + /// 🔥 CHANGE PERIOD + on(_onPeriodChanged); + } - // 2. Monitoring Real-time - await emit.forEach( - _repository.getSensorStream( - 'anemometer/realtime', (json) => MyWindSpeed.fromJson(json)), - onData: (data) { - // 1. Ambil list kecepatan yang ada saat ini di state - final updatedSpeeds = List.from(state.dailySpeeds); + /// ========================= + /// 🚀 START + /// ========================= + Future _onStarted( + WatchWindSpeedStarted event, + Emitter emit, + ) async { - // 2. Tentukan di index mana data ini harus masuk (misal berdasarkan menit saat ini) - final int index = DateTime.now().minute; + emit(state.copyWith(isLoading: true)); - // 3. Update nilai di index tersebut - if (index < updatedSpeeds.length) { - updatedSpeeds[index] = data.speed; - } - - return state.copyWith( - currentSpeed: data.speed, - dailySpeeds: updatedSpeeds, - isLoading: false, - ); - }, - onError: (error, stackTrace) => state.copyWith(isLoading: false), - ); // emit forEach - }, - transformer: restartable(), + /// 1. Ambil history SEKALI + final history = await _repository.getSensorHistory( + 'anemometer/history', + (json) => MyWindSpeed.fromJson(json), ); - on((event, emit) async { - emit(state.copyWith(selectedPeriod: event.period)); - // Ambil ulang history dari database - final history = await _repository.getSensorHistory( - 'anemometer/history', (json) => MyWindSpeed.fromJson(json)); - List updatedGraph; + /// 2. Mapping default (harian) + final dailyGraph = TimeSeriesMapper.toDaily( + data: history, + getTime: (e) => e.timestamp, + getValue: (e) => e.speed, + ); - // Pilih mapper berdasarkan pilihan user - if (event.period == "Minggu Ini") { - updatedGraph = _mapHistoryToWeekly(history); - } else if (event.period == "Bulan Ini") { - updatedGraph = _mapHistoryToMonthly(history); - } else { - updatedGraph = _mapHistoryToDaily(history); - } + emit(state.copyWith( + history: history, + dailySpeeds: dailyGraph, + isLoading: false, + )); - emit(state.copyWith( - dailySpeeds: updatedGraph, - isLoading: false, - )); + /// 3. Start realtime stream (manual subscription) + await _subscription?.cancel(); + + _subscription = _repository + .getSensorStream( + 'anemometer/realtime', + (json) => MyWindSpeed.fromJson(json), + ) + .listen((data) { + add(_WindSpeedRealtimeUpdated(data)); }); } + /// ========================= + /// ⚡ REALTIME UPDATE + /// ========================= + void _onRealtimeUpdated( + _WindSpeedRealtimeUpdated event, + Emitter emit, + ) { + + final updatedSpeeds = List.from(state.dailySpeeds); + + /// 🔥 FIX: pakai JAM bukan menit + final int index = DateTime.now().hour; + + if (index < updatedSpeeds.length) { + updatedSpeeds[index] = event.data.speed; + } + + emit(state.copyWith( + currentSpeed: event.data.speed, + dailySpeeds: updatedSpeeds, + )); + } + + /// ========================= + /// 📊 CHANGE PERIOD + /// ========================= + Future _onPeriodChanged( + WindSpeedPeriodChanged event, + Emitter emit, + ) async { + + emit(state.copyWith(isLoading: true, selectedPeriod: event.period)); + + final history = state.history; + + List updatedGraph; + + if (event.period == "Minggu Ini") { + updatedGraph = TimeSeriesMapper.toWeekly( + data: history, + getTime: (e) => e.timestamp, + getValue: (e) => e.speed, + ); +} else if (event.period == "Bulan Ini") { + updatedGraph = TimeSeriesMapper.toMonthly( + data: history, + getTime: (e) => e.timestamp, + getValue: (e) => e.speed, + ); +} else { + updatedGraph = TimeSeriesMapper.toDaily( + data: history, + getTime: (e) => e.timestamp, + getValue: (e) => e.speed, + ); +} + + emit(state.copyWith( + dailySpeeds: updatedGraph, + isLoading: false, + )); + } + @override - Future close() => super.close(); -} - -List _mapHistoryToDaily(List history) { - // Buat list 24 angka nol (representasi jam 00:00 - 23:00) - List slots = List.generate(24, (_) => 0.0); // mode asli - // Kita buat 60 slot (representasi menit 0-59) agar tiap menit kelihatan titik baru - // List slots = List.generate(60, (_) => 0.0); // mode percobaan - - for (var item in history) { - // Ubah timestamp UTC ke jam lokal - DateTime date = item.timestamp; // sudah dateTime dari model - - // Jika data ini adalah data hari ini, masukkan ke slot jamnya - if (date.day == DateTime.now().day) { - slots[date.hour] = item.speed; - } // mode asli - // pakai menit untuk percobaan (date.minute) sebagai index supaya kelihatan pergerakannya - // if (date.day == DateTime.now().day) { - // slots[date.minute] = item.speed; - // } // mode percobaan/testing + Future close() async { + await _subscription?.cancel(); + return super.close(); } - return slots; } -// Mapper Mingguan (7 Slot: Senin - Minggu) -List _mapHistoryToWeekly(List history) { - List slots = List.generate(7, (_) => 0.0); - final now = DateTime.now(); +/// ========================= +/// 🔒 INTERNAL EVENT (PRIVATE) +/// ========================= +class _WindSpeedRealtimeUpdated extends WindSpeedEvent { + final MyWindSpeed data; - // Mencari awal minggu ini (Senin) - DateTime startOfWeek = now.subtract(Duration(days: now.weekday - 1)); - startOfWeek = DateTime(startOfWeek.year, startOfWeek.month, startOfWeek.day); + const _WindSpeedRealtimeUpdated(this.data); - for (var item in history) { - if (item.timestamp.isAfter(startOfWeek)) { - // index 0 = Senin, dst. - slots[item.timestamp.weekday - 1] = item.speed; - } - } - return slots; -} - -// Mapper Bulanan (Sesuai jumlah hari di bulan ini) -List _mapHistoryToMonthly(List history) { - final now = DateTime.now(); - final daysInMonth = DateTime(now.year, now.month + 1, 0).day; - List slots = List.generate(daysInMonth, (_) => 0.0); - - for (var item in history) { - if (item.timestamp.month == now.month && item.timestamp.year == now.year) { - // index 0 = Tanggal 1, dst. - slots[item.timestamp.day - 1] = item.speed; - } - } - return slots; -} + @override + List get props => [data]; +} \ No newline at end of file diff --git a/lib/screens/monitoring/wind_speed/blocs/wind_speed_state.dart b/lib/screens/monitoring/wind_speed/blocs/wind_speed_state.dart index fa9b167..becd2e4 100644 --- a/lib/screens/monitoring/wind_speed/blocs/wind_speed_state.dart +++ b/lib/screens/monitoring/wind_speed/blocs/wind_speed_state.dart @@ -5,12 +5,14 @@ class WindSpeedState extends Equatable { final String selectedPeriod; final List dailySpeeds; // Untuk grafik final bool isLoading; + final List history; const WindSpeedState({ this.currentSpeed = 0.0, this.selectedPeriod = "Hari Ini", this.dailySpeeds = const [], this.isLoading = true, + this.history = const [], }); WindSpeedState copyWith({ @@ -18,16 +20,18 @@ class WindSpeedState extends Equatable { String? selectedPeriod, List? dailySpeeds, bool? isLoading, + List? history, }) { return WindSpeedState( currentSpeed: currentSpeed ?? this.currentSpeed, selectedPeriod: selectedPeriod ?? this.selectedPeriod, dailySpeeds: dailySpeeds ?? this.dailySpeeds, isLoading: isLoading ?? this.isLoading, + history: history ?? this.history, ); } @override List get props => - [currentSpeed, selectedPeriod, dailySpeeds, isLoading]; + [currentSpeed, selectedPeriod, dailySpeeds, isLoading, history]; } From fd75feb34fc2c47f8b4feeb7f8299f1913d245c0 Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Sun, 19 Apr 2026 12:44:37 +0700 Subject: [PATCH 05/19] joss --- images/logo_klimatologi.png | Bin 0 -> 64554 bytes lib/screens/home/views/main_drawer.dart | 36 +- .../blocs/atmospheric_conditions_bloc.dart | 69 + .../blocs/atmospheric_conditions_event.dart | 10 + .../blocs/atmospheric_conditions_state.dart | 43 + .../views/atmospheric_screen.dart | 150 +++ .../evaporasi/blocs/evaporasi_bloc.dart | 42 +- .../evaporasi/blocs/evaporasi_event.dart | 21 + .../evaporasi/blocs/evaporasi_state.dart | 54 + .../evaporasi/views/evaporasi_screen.dart | 1149 ++--------------- .../src/models/atmospheric_conditions.dart | 25 + .../lib/src/models/evaporasi.dart | 36 + .../lib/src/models/models.dart | 2 +- .../lib/src/models/pressure_sensor.dart | 0 14 files changed, 586 insertions(+), 1051 deletions(-) create mode 100644 images/logo_klimatologi.png create mode 100644 lib/screens/monitoring/atmospheric_conditions/blocs/atmospheric_conditions_bloc.dart create mode 100644 lib/screens/monitoring/atmospheric_conditions/blocs/atmospheric_conditions_event.dart create mode 100644 lib/screens/monitoring/atmospheric_conditions/blocs/atmospheric_conditions_state.dart create mode 100644 lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart create mode 100644 packages/monitoring_repository/lib/src/models/atmospheric_conditions.dart delete mode 100644 packages/monitoring_repository/lib/src/models/pressure_sensor.dart diff --git a/images/logo_klimatologi.png b/images/logo_klimatologi.png new file mode 100644 index 0000000000000000000000000000000000000000..e127653d971d1e9ae30b52149d0da11bda229597 GIT binary patch literal 64554 zcmY&=WkA)-^EYvjL#K2%k^&OaT@nIn77ds{nol z&_iMQz(jddUcvDD*Fj@JhIxy2fc^xrlQ_oE_4n5bAORYHKARXV*@FDtuns+u4)g~-g6YQN zxaoh{UZR3HTw2SQNd86O+yMM4_8%@jqG6zEqTDrg-~Q06h)1pPZ;KaOym0{WT=+);9iPFHd#~nim5u@GU-{^rLGYRGNNWiH7!NWGLI-Y{ z4+e}{gIwntESoq42&p)P{-Xb1T03~4A-jl*X)BNzLkv*=m@Jx92aeaTQ|lj{f$d&V zfd)cQ(Lbv8-!z?05*;{?PQ-){Q-56sRtyBnr?QgkALKg!LmPw!ViAP)srdKbdEy9Q zK@eOP%l;7rjP`~y5QLtReXXwfU$t?9nR50|-~8`Guyl_t!XOSU_~>TQe<2X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cSF9N|Kjfc0fcnk90&;MIhu;FzZaP-RjaVjb$V9u-}Pz3*VUIZA$|9^x= zK!gcypu&qQGleSde?pG%S42L2e*RZuiSsiE}@L$ zqC!!MHR+!{C?@H^0!r06$H{)66l^KvHJ$mLM#*s&&h{XJ;4=+d7=ag>zO;{+cG9r< z!D@-4)rabF$k87Le7%Zl`2SWt4*XwF{Dk~m(2@Sd1H&E@j{OskH%M?)9}o!j^wXPL z@pE}JLk2=6nm+n7r%9&6yk5(3N-nr18MW19cg BlocProvider( + create: (context) => EvaporasiBloc( + repository: context.read(), + )..add(WatchEvaporasiStarted()), + child: const EvaporasiScreen(), + ), + ), + ); + }, ), ListTile( leading: Image.asset( @@ -76,8 +93,21 @@ class MainDrawer extends StatelessWidget { height: 20, width: 20, ), - title: const Text("Tekanan Udara"), - onTap: () {}, + title: const Text("Kondisi Atmosfer"), + onTap: () { + Navigator.pop(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => BlocProvider( + create: (context) => AtmosphericConditionsBloc( + repository: context.read(), + )..add(WatchAtmosphericConditionsStarted()), + child: AtmosphericScreen(), + ), + ), + ); + }, ), const Spacer(), // Dorong menu logout ke paling bawah const Divider(), diff --git a/lib/screens/monitoring/atmospheric_conditions/blocs/atmospheric_conditions_bloc.dart b/lib/screens/monitoring/atmospheric_conditions/blocs/atmospheric_conditions_bloc.dart new file mode 100644 index 0000000..a4d6cb5 --- /dev/null +++ b/lib/screens/monitoring/atmospheric_conditions/blocs/atmospheric_conditions_bloc.dart @@ -0,0 +1,69 @@ +import 'dart:async'; +import 'package:bloc/bloc.dart'; +import 'package:equatable/equatable.dart'; +import 'package:monitoring_repository/monitoring_repository.dart'; + +part 'atmospheric_conditions_event.dart'; +part 'atmospheric_conditions_state.dart'; + +class AtmosphericConditionsBloc + extends Bloc { + final MonitoringRepository _repository; + StreamSubscription? _subscription; + + AtmosphericConditionsBloc({required MonitoringRepository repository}) + : _repository = repository, + super(const AtmosphericConditionsState()) { + on(_onStarted); + on<_AtmosphericConditionsUpdated>(_onUpdated); + } + + /// 🚀 START + Future _onStarted( + WatchAtmosphericConditionsStarted event, + Emitter emit, + ) async { + emit(state.copyWith(isLoading: true)); + + await _subscription?.cancel(); + + _subscription = _repository + .getSensorStream( + 'sensor/latest', + (json) => AtmosphericConditions.fromJson(json), + ) + .listen((data) { + add(_AtmosphericConditionsUpdated(data)); + }); + } + + /// ⚡ REALTIME UPDATE + void _onUpdated( + _AtmosphericConditionsUpdated event, + Emitter emit, + ) { + emit(state.copyWith( + temperature: event.data.temperature, + humidity: event.data.humidity, + pressure: event.data.pressure, + altitude: event.data.altitude, + isLoading: false, + )); + } + + @override + Future close() async { + await _subscription?.cancel(); + return super.close(); + } +} + +/// INTERNAL EVENT +class _AtmosphericConditionsUpdated extends AtmosphericConditionsEvent { + final AtmosphericConditions data; + + const _AtmosphericConditionsUpdated(this.data); + + @override + List get props => [data]; +} diff --git a/lib/screens/monitoring/atmospheric_conditions/blocs/atmospheric_conditions_event.dart b/lib/screens/monitoring/atmospheric_conditions/blocs/atmospheric_conditions_event.dart new file mode 100644 index 0000000..e446497 --- /dev/null +++ b/lib/screens/monitoring/atmospheric_conditions/blocs/atmospheric_conditions_event.dart @@ -0,0 +1,10 @@ +part of 'atmospheric_conditions_bloc.dart'; + +abstract class AtmosphericConditionsEvent extends Equatable { + const AtmosphericConditionsEvent(); + + @override + List get props => []; +} + +class WatchAtmosphericConditionsStarted extends AtmosphericConditionsEvent {} diff --git a/lib/screens/monitoring/atmospheric_conditions/blocs/atmospheric_conditions_state.dart b/lib/screens/monitoring/atmospheric_conditions/blocs/atmospheric_conditions_state.dart new file mode 100644 index 0000000..01b12ba --- /dev/null +++ b/lib/screens/monitoring/atmospheric_conditions/blocs/atmospheric_conditions_state.dart @@ -0,0 +1,43 @@ +part of 'atmospheric_conditions_bloc.dart'; + +class AtmosphericConditionsState extends Equatable { + final double temperature; + final double humidity; + final double pressure; + final double altitude; + + final bool isLoading; + + const AtmosphericConditionsState({ + this.temperature = 0.0, + this.humidity = 0.0, + this.pressure = 0.0, + this.altitude = 0.0, + this.isLoading = true, + }); + + AtmosphericConditionsState copyWith({ + double? temperature, + double? humidity, + double? pressure, + double? altitude, + bool? isLoading, + }) { + return AtmosphericConditionsState( + temperature: temperature ?? this.temperature, + humidity: humidity ?? this.humidity, + pressure: pressure ?? this.pressure, + altitude: altitude ?? this.altitude, + isLoading: isLoading ?? this.isLoading, + ); + } + + @override + List get props => [ + temperature, + humidity, + pressure, + altitude, + isLoading, + ]; +} diff --git a/lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart b/lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart new file mode 100644 index 0000000..611e602 --- /dev/null +++ b/lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart @@ -0,0 +1,150 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import '../blocs/atmospheric_conditions_bloc.dart'; + +class AtmosphericScreen extends StatelessWidget { + const AtmosphericScreen({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.grey.shade100, + appBar: AppBar( + title: const Text( + "Kondisi Atmosfer", + style: TextStyle(fontWeight: FontWeight.bold), + ), + centerTitle: true, + backgroundColor: Colors.transparent, + elevation: 0, + foregroundColor: Colors.black, + ), + body: BlocBuilder( + builder: (context, state) { + if (state.isLoading) { + return const Center(child: CircularProgressIndicator()); + } + + return SingleChildScrollView( + padding: const EdgeInsets.all(20), + child: Column( + children: [ + _mainTemperature(state), + const SizedBox(height: 25), + _gridInfo(state), + ], + ), + ); + }, + ), + ); + } + + /// ========================= + /// 🌡️ TEMPERATURE (HERO CARD) + /// ========================= + Widget _mainTemperature(AtmosphericConditionsState state) { + return Container( + width: double.infinity, + padding: const EdgeInsets.symmetric(vertical: 40), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [ + const Color.fromARGB(255, 38, 255, 222), + const Color.fromARGB(255, 53, 132, 229) + ], + ), + borderRadius: BorderRadius.circular(25), + boxShadow: [ + BoxShadow( + color: const Color.fromARGB(255, 0, 191, 255).withOpacity(0.3), + blurRadius: 20, + offset: const Offset(0, 10), + ) + ], + ), + child: Column( + children: [ + const Icon(Icons.thermostat, color: Colors.white, size: 50), + const SizedBox(height: 10), + Text( + state.temperature.toStringAsFixed(1), + style: const TextStyle( + fontSize: 70, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + const Text( + "°C", + style: TextStyle(color: Colors.white70, fontSize: 18), + ), + ], + ), + ); + } + + /// ========================= + /// 📊 INFO GRID + /// ========================= + Widget _gridInfo(AtmosphericConditionsState state) { + return GridView.count( + crossAxisCount: 2, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + mainAxisSpacing: 15, + crossAxisSpacing: 15, + childAspectRatio: 1.6, + children: [ + _infoCard( + "Kelembapan", + "${state.humidity.toStringAsFixed(1)} %", + Icons.water_drop, + Colors.blue, + ), + _infoCard( + "Tekanan", + "${state.pressure.toStringAsFixed(1)} hPa", + Icons.speed, + Colors.green, + ), + _infoCard( + "Ketinggian", + "${state.altitude.toStringAsFixed(1)} m", + Icons.terrain, + Colors.brown, + ), + ], + ); + } + + Widget _infoCard(String title, String value, IconData icon, Color color) { + return Container( + padding: const EdgeInsets.all(15), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + ), + child: Row( + children: [ + Icon(icon, color: color, size: 30), + const SizedBox(width: 10), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + title, + style: const TextStyle(color: Colors.grey, fontSize: 12), + ), + Text( + value, + style: const TextStyle(fontWeight: FontWeight.bold), + ), + ], + ) + ], + ), + ); + } +} diff --git a/lib/screens/monitoring/evaporasi/blocs/evaporasi_bloc.dart b/lib/screens/monitoring/evaporasi/blocs/evaporasi_bloc.dart index fd8fafb..a785d90 100644 --- a/lib/screens/monitoring/evaporasi/blocs/evaporasi_bloc.dart +++ b/lib/screens/monitoring/evaporasi/blocs/evaporasi_bloc.dart @@ -3,7 +3,7 @@ import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:monitoring_repository/monitoring_repository.dart'; -import '../../../core/utils/time_series_mapper.dart'; +import '../../../../core/utils/time_series_mapper.dart'; part 'evaporasi_event.dart'; part 'evaporasi_state.dart'; @@ -15,7 +15,6 @@ class EvaporasiBloc extends Bloc { EvaporasiBloc({required MonitoringRepository repository}) : _repository = repository, super(const EvaporasiState()) { - on(_onStarted); on<_EvaporasiRealtimeUpdated>(_onRealtimeUpdated); on(_onPeriodChanged); @@ -25,10 +24,9 @@ class EvaporasiBloc extends Bloc { /// 🚀 START /// ========================= Future _onStarted( - WatchEvaporasiStarted event, - Emitter emit, - ) async { - + WatchEvaporasiStarted event, + Emitter emit, + ) async { emit(state.copyWith(isLoading: true)); final history = await _repository.getSensorHistory( @@ -39,7 +37,7 @@ class EvaporasiBloc extends Bloc { final dailyGraph = TimeSeriesMapper.toDaily( data: history, getTime: (e) => e.timestamp, - getValue: (e) => e.value, // ⚠️ sesuaikan nama field + getValue: (e) => e.evaporasi, // ⚠️ sesuaikan nama field ); emit(state.copyWith( @@ -52,7 +50,7 @@ class EvaporasiBloc extends Bloc { _subscription = _repository .getSensorStream( - 'evaporasi/realtime', + 'kelompok1/evaporasi', (json) => Evaporasi.fromJson(json), ) .listen((data) { @@ -64,20 +62,21 @@ class EvaporasiBloc extends Bloc { /// ⚡ REALTIME /// ========================= void _onRealtimeUpdated( - _EvaporasiRealtimeUpdated event, - Emitter emit, - ) { - + _EvaporasiRealtimeUpdated event, + Emitter emit, + ) { final updated = List.from(state.dailyValues); final index = DateTime.now().hour; if (index < updated.length) { - updated[index] = event.data.value; // ⚠️ sesuaikan field + updated[index] = event.data.evaporasi; // ⚠️ sesuaikan field } emit(state.copyWith( - currentValue: event.data.value, + currentValue: event.data.evaporasi, + temperature: event.data.suhu, + waterLevel: event.data.tinggiAir, dailyValues: updated, )); } @@ -86,10 +85,9 @@ class EvaporasiBloc extends Bloc { /// 📊 PERIOD /// ========================= Future _onPeriodChanged( - EvaporasiPeriodChanged event, - Emitter emit, - ) async { - + EvaporasiPeriodChanged event, + Emitter emit, + ) async { emit(state.copyWith(isLoading: true, selectedPeriod: event.period)); final history = state.history; @@ -100,19 +98,19 @@ class EvaporasiBloc extends Bloc { updated = TimeSeriesMapper.toWeekly( data: history, getTime: (e) => e.timestamp, - getValue: (e) => e.value, + getValue: (e) => e.evaporasi, ); } else if (event.period == "Bulan Ini") { updated = TimeSeriesMapper.toMonthly( data: history, getTime: (e) => e.timestamp, - getValue: (e) => e.value, + getValue: (e) => e.evaporasi, ); } else { updated = TimeSeriesMapper.toDaily( data: history, getTime: (e) => e.timestamp, - getValue: (e) => e.value, + getValue: (e) => e.evaporasi, ); } @@ -137,4 +135,4 @@ class _EvaporasiRealtimeUpdated extends EvaporasiEvent { @override List get props => [data]; -} \ No newline at end of file +} diff --git a/lib/screens/monitoring/evaporasi/blocs/evaporasi_event.dart b/lib/screens/monitoring/evaporasi/blocs/evaporasi_event.dart index e69de29..735954a 100644 --- a/lib/screens/monitoring/evaporasi/blocs/evaporasi_event.dart +++ b/lib/screens/monitoring/evaporasi/blocs/evaporasi_event.dart @@ -0,0 +1,21 @@ +part of 'evaporasi_bloc.dart'; + +abstract class EvaporasiEvent extends Equatable { + const EvaporasiEvent(); + + @override + List get props => []; +} + +/// 🚀 START MONITORING +class WatchEvaporasiStarted extends EvaporasiEvent {} + +/// 📊 GANTI PERIODE (Harian / Mingguan / Bulanan) +class EvaporasiPeriodChanged extends EvaporasiEvent { + final String period; + + const EvaporasiPeriodChanged(this.period); + + @override + List get props => [period]; +} diff --git a/lib/screens/monitoring/evaporasi/blocs/evaporasi_state.dart b/lib/screens/monitoring/evaporasi/blocs/evaporasi_state.dart index e69de29..b0487b7 100644 --- a/lib/screens/monitoring/evaporasi/blocs/evaporasi_state.dart +++ b/lib/screens/monitoring/evaporasi/blocs/evaporasi_state.dart @@ -0,0 +1,54 @@ +part of 'evaporasi_bloc.dart'; + +class EvaporasiState extends Equatable { + final double currentValue; // nilai evaporasi realtime + final double temperature; // suhu (opsional dari firebase) + final double waterLevel; // tinggi air + final String selectedPeriod; + + final List dailyValues; // untuk grafik + final List history; + + final bool isLoading; + + const EvaporasiState({ + this.currentValue = 0.0, + this.temperature = 0.0, + this.waterLevel = 0.0, + this.selectedPeriod = "Hari Ini", + this.dailyValues = const [], + this.history = const [], + this.isLoading = true, + }); + + EvaporasiState copyWith({ + double? currentValue, + double? temperature, + double? waterLevel, + String? selectedPeriod, + List? dailyValues, + List? history, + bool? isLoading, + }) { + return EvaporasiState( + currentValue: currentValue ?? this.currentValue, + temperature: temperature ?? this.temperature, + waterLevel: waterLevel ?? this.waterLevel, + selectedPeriod: selectedPeriod ?? this.selectedPeriod, + dailyValues: dailyValues ?? this.dailyValues, + history: history ?? this.history, + isLoading: isLoading ?? this.isLoading, + ); + } + + @override + List get props => [ + currentValue, + temperature, + waterLevel, + selectedPeriod, + dailyValues, + history, + isLoading, + ]; +} diff --git a/lib/screens/monitoring/evaporasi/views/evaporasi_screen.dart b/lib/screens/monitoring/evaporasi/views/evaporasi_screen.dart index f31a02c..a8214f4 100644 --- a/lib/screens/monitoring/evaporasi/views/evaporasi_screen.dart +++ b/lib/screens/monitoring/evaporasi/views/evaporasi_screen.dart @@ -1,1047 +1,146 @@ import 'package:flutter/material.dart'; -import 'package:fl_chart/fl_chart.dart'; -import 'package:firebase_database/firebase_database.dart'; -import 'dart:async'; -import 'package:intl/intl.dart'; -import '../../shared/widgets/monitoring_shared.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import '../blocs/evaporasi_bloc.dart'; -/// EVAPORASI MONITORING SCREEN -class EvaporasiMonitoringScreen extends StatefulWidget { - const EvaporasiMonitoringScreen({super.key}); - - @override - State createState() => - _EvaporasiMonitoringScreenState(); -} - -class _EvaporasiMonitoringScreenState extends State { - String _selectedPeriod = "Hari Ini"; - - final DatabaseReference _evaporationRef = - FirebaseDatabase.instance.ref('kelompok1/evaporasi'); - StreamSubscription? _evaporationSub; - - DateTime? _lastUpdateTime; - double _currentEvaporation = 0.0; - double _currentTemperature = 0.0; - double _currentWaterHeight = 0.0; - final List _dailyEvaporation = List.filled(24, 0.0); - double _hourlyTotal = 0.0; - int _hourlyCount = 0; - int _currentHour = DateTime.now().hour; - - bool get _isOnline { - if (_lastUpdateTime == null) return false; - final diff = DateTime.now().difference(_lastUpdateTime!); - return diff.inMinutes <= 5; - } - - @override - void initState() { - super.initState(); - _evaporationSub = _evaporationRef.onValue.listen(_onRealtimeData); - } - - @override - void dispose() { - _evaporationSub?.cancel(); - super.dispose(); - } - - void _onRealtimeData(DatabaseEvent event) { - final data = event.snapshot.value; - if (data is Map) { - final value = double.tryParse( - (data['evaporasi'] ?? data['nilai'] ?? 0).toString()) ?? - 0.0; - final temp = double.tryParse(data['suhu']?.toString() ?? '0') ?? 0.0; - final waterHeight = - double.tryParse(data['tinggi_air']?.toString() ?? '0') ?? 0.0; - final DateTime waktu; - - if (data.containsKey('timestamp')) { - final timestamp = - int.tryParse(data['timestamp']?.toString() ?? '0') ?? 0; - waktu = DateTime.fromMillisecondsSinceEpoch(timestamp * 1000); - } else { - final hour = int.tryParse(data['jam']?.toString() ?? '0') ?? 0; - final minute = int.tryParse(data['menit']?.toString() ?? '0') ?? 0; - final now = DateTime.now(); - waktu = DateTime(now.year, now.month, now.day, hour, minute); - } - - setState(() { - _currentEvaporation = value; - _currentTemperature = temp; - _currentWaterHeight = waterHeight; - _lastUpdateTime = waktu; - - final incomingHour = waktu.hour; - if (incomingHour != _currentHour) { - if (_hourlyCount > 0) { - _dailyEvaporation[_currentHour] = _hourlyTotal / _hourlyCount; - } - _hourlyTotal = 0.0; - _hourlyCount = 0; - _currentHour = incomingHour; - if (incomingHour == 0) { - for (int i = 0; i < 24; i++) { - _dailyEvaporation[i] = 0.0; - } - } - } - - _hourlyTotal += value; - _hourlyCount++; - _dailyEvaporation[incomingHour] = - _hourlyCount > 0 ? _hourlyTotal / _hourlyCount : value; - }); - } - } - - String _formatUpdateTime() { - if (_lastUpdateTime == null) return '-'; - return DateFormat('dd MMM yyyy • HH:mm').format(_lastUpdateTime!); - } - - bool get _hasRealtimeEvaporation => - _dailyEvaporation.any((value) => value > 0.0); - - Widget _buildDetailTile({ - required String label, - required String value, - required IconData icon, - required Color color, - }) { - return Expanded( - child: Container( - padding: const EdgeInsets.all(12), - decoration: BoxDecoration( - color: color.withOpacity(0.08), - borderRadius: BorderRadius.circular(12), - border: Border.all(color: color.withOpacity(0.2)), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon(icon, color: color, size: 16), - const SizedBox(width: 6), - Text( - label, - style: TextStyle( - fontSize: 11, - color: Colors.grey.shade700, - ), - ), - ], - ), - const SizedBox(height: 8), - Text( - value, - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: color, - ), - ), - ], - ), - ), - ); - } +class EvaporasiScreen extends StatelessWidget { + const EvaporasiScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( + backgroundColor: Colors.grey.shade100, appBar: AppBar( - title: const Text("Monitoring Evaporasi"), + title: const Text( + "Evaporasi", + style: TextStyle(fontWeight: FontWeight.bold), + ), centerTitle: true, + backgroundColor: Colors.transparent, + elevation: 0, + foregroundColor: Colors.black, ), - body: Padding( - padding: const EdgeInsets.all(16), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - "Evaporasi", - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 16), - if (_lastUpdateTime != null) - Card( - elevation: 2, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "${_currentEvaporation.toStringAsFixed(1)} mm", - style: const TextStyle( - fontSize: 28, - fontWeight: FontWeight.bold, - color: Colors.blue, - ), - ), - const SizedBox(height: 8), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - "Terakhir diperbarui", - style: TextStyle( - fontSize: 12, - color: Colors.grey, - ), - ), - const SizedBox(height: 4), - Text( - _formatUpdateTime(), - style: const TextStyle( - fontSize: 12, - color: Colors.black54, - ), - ), - ], - ), - Container( - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, - ), - decoration: BoxDecoration( - color: _isOnline - ? Colors.green.shade100 - : Colors.red.shade100, - borderRadius: BorderRadius.circular(20), - ), - child: Text( - _isOnline ? 'ONLINE' : 'OFFLINE', - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: _isOnline ? Colors.green : Colors.red, - ), - ), - ), - ], - ), - ], - ), - ), - ), - const SizedBox(height: 12), - Card( - elevation: 2, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 16, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - 'Detail Sensor Evaporasi', - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 14), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - _buildDetailTile( - label: 'Jam', - value: DateFormat('HH:mm').format(_lastUpdateTime!), - icon: Icons.access_time, - color: Colors.blue, - ), - _buildDetailTile( - label: 'Suhu', - value: - '${_currentTemperature.toStringAsFixed(2)} °C', - icon: Icons.thermostat, - color: Colors.red, - ), - ], - ), - const SizedBox(height: 12), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - _buildDetailTile( - label: 'Tinggi Air', - value: '${_currentWaterHeight.toStringAsFixed(2)}', - icon: Icons.water_drop, - color: Colors.blueAccent, - ), - _buildDetailTile( - label: 'Evaporasi', - value: - '${_currentEvaporation.toStringAsFixed(1)} mm', - icon: Icons.opacity, - color: Colors.blue, - ), - ], - ), - ], - ), - ), - ), - const SizedBox(height: 20), + body: BlocBuilder( + builder: (context, state) { + if (state.isLoading) { + return const Center(child: CircularProgressIndicator()); + } - /// SISTEM KONTROL AIR OTOMATIS - _buildAutomaticWaterControlSystem(), - const SizedBox(height: 25), - - /// GRAFIK MONITORING - _buildMonitoringGraphBlock(), - const SizedBox(height: 25), - - /// PENJELASAN - _buildMonitoringExplanation(), - const SizedBox(height: 25), - - /// STATISTIK TAHUNAN - _buildAnnualCombinedGraphSection(), - ], - ), - ), - ), - ); - } - - /// EXPORT FUNCTIONS - void _exportDailyData() { - final StringBuffer csvContent = StringBuffer(); - csvContent.writeln("DATA MONITORING EVAPORASI - HARIAN (24 JAM)"); - csvContent.writeln("Tanggal: ${DateTime.now().toString().split(' ')[0]}"); - csvContent.writeln(""); - csvContent.writeln("Jam,Nilai (mm)"); - - final dailyData = [ - 2.1, - 2.3, - 2.0, - 1.9, - 2.2, - 2.5, - 3.0, - 3.5, - 4.0, - 4.2, - 4.5, - 4.8, - 5.0, - 5.2, - 5.1, - 4.9, - 4.5, - 4.0, - 3.5, - 3.0, - 2.8, - 2.5, - 2.3, - 2.2 - ]; - for (int i = 0; i < dailyData.length; i++) { - csvContent.writeln("$i:00,${dailyData[i]}"); - } - - csvContent.writeln(""); - csvContent.writeln("Statistik Harian"); - csvContent.writeln("Total: 79.4 mm"); - csvContent.writeln("Rata-rata: 3.3 mm"); - csvContent.writeln("Maksimal: 5.2 mm"); - csvContent.writeln("Minimal: 1.9 mm"); - - showExportPreview(context, csvContent.toString(), "Data Harian"); - } - - void _exportWeeklyData() { - final StringBuffer csvContent = StringBuffer(); - csvContent.writeln("DATA MONITORING EVAPORASI - MINGGUAN"); - csvContent.writeln("Tanggal: ${DateTime.now().toString().split(' ')[0]}"); - csvContent.writeln(""); - csvContent.writeln("Hari,Nilai (mm)"); - - final days = [ - 'Senin', - 'Selasa', - 'Rabu', - 'Kamis', - 'Jumat', - 'Sabtu', - 'Minggu' - ]; - final weeklyData = [3.5, 3.8, 4.2, 4.5, 4.0, 3.8, 3.2]; - - for (int i = 0; i < days.length; i++) { - csvContent.writeln("${days[i]},${weeklyData[i]}"); - } - - csvContent.writeln(""); - csvContent.writeln("Statistik Mingguan"); - csvContent.writeln("Total: 27.0 mm"); - csvContent.writeln("Rata-rata: 3.86 mm"); - csvContent.writeln("Maksimal: 4.5 mm"); - csvContent.writeln("Minimal: 3.2 mm"); - - showExportPreview(context, csvContent.toString(), "Data Mingguan"); - } - - void _exportMonthlyData() { - final StringBuffer csvContent = StringBuffer(); - csvContent.writeln("DATA MONITORING EVAPORASI - BULANAN"); - csvContent.writeln( - "Bulan: ${DateTime.now().toString().split(' ')[0].substring(0, 7)}"); - csvContent.writeln(""); - csvContent.writeln("Tanggal,Nilai (mm)"); - - for (int i = 1; i <= 28; i++) { - final value = (3.0 + (i % 6) * 0.5).toStringAsFixed(1); - csvContent.writeln("$i,$value"); - } - - csvContent.writeln(""); - csvContent.writeln("Statistik Bulanan"); - csvContent.writeln("Total: 99.2 mm"); - csvContent.writeln("Rata-rata: 3.54 mm"); - csvContent.writeln("Maksimal: 5.0 mm"); - csvContent.writeln("Minimal: 2.5 mm"); - - showExportPreview(context, csvContent.toString(), "Data Bulanan"); - } - - void _exportAnnualData() { - final StringBuffer csvContent = StringBuffer(); - csvContent.writeln("DATA MONITORING EVAPORASI - TAHUNAN"); - csvContent.writeln("Tahun: 2025"); - csvContent.writeln(""); - csvContent.writeln("Bulan,Pengisian (x),Rata-rata (mm)"); - - final months = [ - 'Januari', - 'Februari', - 'Maret', - 'April', - 'Mei', - 'Juni', - 'Juli', - 'Agustus', - 'September', - 'Oktober', - 'November', - 'Desember' - ]; - final fillings = [12, 13, 15, 14, 13, 12, 14, 16, 13, 14, 15, 13]; - final averages = [ - 3.5, - 3.8, - 4.2, - 4.5, - 5.0, - 5.2, - 5.5, - 5.8, - 5.0, - 4.5, - 4.0, - 3.7 - ]; - - for (int i = 0; i < months.length; i++) { - csvContent.writeln("${months[i]},${fillings[i]},${averages[i]}"); - } - - csvContent.writeln(""); - csvContent.writeln("STATISTIK TAHUNAN"); - csvContent.writeln("Total Pengisian: 156x"); - csvContent.writeln("Rata-rata Evaporasi: 4.4 mm"); - csvContent.writeln("Total Evaporasi: 52.8 mm"); - - showExportPreview(context, csvContent.toString(), "Data Tahunan"); - } - - /// DATA GENERATORS - List _getEvaporationPeriodData() { - switch (_selectedPeriod) { - case "Hari Ini": - if (_hasRealtimeEvaporation) { - return List.generate( - _dailyEvaporation.length, - (index) => FlSpot(index.toDouble(), _dailyEvaporation[index]), - ); - } - return List.generate(24, (index) => FlSpot(index.toDouble(), 0.0)); - case "Minggu Ini": - return List.generate(7, (index) => FlSpot(index.toDouble(), 0.0)); - case "Bulan Ini": - return List.generate(12, (index) => FlSpot(index.toDouble(), 0.0)); - default: - return []; - } - } - - /// UI BUILDERS - Widget _buildAutomaticWaterControlSystem() { - bool isActive = DateTime.now().hour >= 6 && DateTime.now().hour < 7; - - return Container( - padding: const EdgeInsets.all(16), - decoration: BoxDecoration( - color: Colors.grey.shade50, - borderRadius: BorderRadius.circular(12), - border: Border.all(color: Colors.grey.shade300), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - "Sistem Kontrol Air Otomatis", - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 12), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - "Jadwal Operasional", - style: TextStyle( - fontSize: 12, - color: Colors.grey, - ), - ), - const SizedBox(height: 4), - const Text( - "06.00 - 07.00 WIB", - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - ), - ), - ], - ), - Container( - padding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 10, - ), - decoration: BoxDecoration( - color: isActive ? Colors.blue : Colors.grey.shade300, - borderRadius: BorderRadius.circular(20), - ), - child: Text( - isActive ? "AKTIF" : "TIDAK AKTIF", - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: isActive ? Colors.white : Colors.grey.shade700, - ), - ), - ), - ], - ), - const SizedBox(height: 12), - Container( - padding: const EdgeInsets.all(10), - decoration: BoxDecoration( - color: Colors.blue.shade50, - borderRadius: BorderRadius.circular(8), - ), - child: const Text( - "Sistem otomatis akan mengisi air pada waktu yang telah ditentukan untuk menjaga tingkat evaporasi pada level optimal.", - style: TextStyle( - fontSize: 11, - color: Colors.blue, - height: 1.5, - ), - ), - ), - ], - ), - ); - } - - Widget _buildMonitoringGraphBlock() { - return Card( - elevation: 4, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Text( - "Status Evaporasi", - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, - ), - ), - Container( - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, - ), - decoration: BoxDecoration( - color: Colors.amber.shade100, - borderRadius: BorderRadius.circular(20), - ), - child: const Text( - "Normal", - style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.w600, - color: Colors.amber, - ), - ), - ), - ], - ), - const SizedBox(height: 16), - - /// PERIOD SELECTOR + EXPORT - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - children: - ["Hari Ini", "Minggu Ini", "Bulan Ini"].map((period) { - return Padding( - padding: const EdgeInsets.only(right: 8), - child: ChoiceChip( - label: Text(period), - selected: _selectedPeriod == period, - onSelected: (selected) { - setState(() { - _selectedPeriod = period; - }); - }, - selectedColor: Colors.blue, - labelStyle: TextStyle( - color: _selectedPeriod == period - ? Colors.white - : Colors.black, - ), - ), - ); - }).toList(), - ), - ), - ), - const SizedBox(width: 8), - ElevatedButton.icon( - onPressed: () { - if (_selectedPeriod == "Hari Ini") { - _exportDailyData(); - } else if (_selectedPeriod == "Minggu Ini") { - _exportWeeklyData(); - } else if (_selectedPeriod == "Bulan Ini") { - _exportMonthlyData(); - } - }, - icon: const Icon(Icons.download, size: 16), - label: const Text("Export"), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.orange, - foregroundColor: Colors.white, - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 6, - ), - textStyle: const TextStyle(fontSize: 11), - ), - ), - ], - ), - const SizedBox(height: 16), - - /// GRAPH - SizedBox( - height: 300, - child: LineChart( - LineChartData( - gridData: FlGridData( - show: true, - drawHorizontalLine: true, - drawVerticalLine: false, - horizontalInterval: 1, - getDrawingHorizontalLine: (value) { - return FlLine( - color: Colors.grey.shade300, - strokeWidth: 1, - ); - }, - ), - titlesData: FlTitlesData( - show: true, - bottomTitles: AxisTitles( - sideTitles: SideTitles( - showTitles: true, - interval: getPeriodInterval(_selectedPeriod), - getTitlesWidget: (value, meta) { - return Text( - getPeriodLabel(_selectedPeriod, value), - style: const TextStyle( - fontSize: 10, - color: Colors.grey, - ), - ); - }, - ), - ), - leftTitles: AxisTitles( - sideTitles: SideTitles( - showTitles: true, - interval: 1, - getTitlesWidget: (value, meta) { - return Text( - value.toInt().toString(), - style: const TextStyle( - fontSize: 9, - color: Colors.grey, - ), - ); - }, - reservedSize: 28, - ), - ), - topTitles: AxisTitles( - sideTitles: SideTitles(showTitles: false), - ), - rightTitles: AxisTitles( - sideTitles: SideTitles(showTitles: false), - ), - ), - borderData: FlBorderData( - show: true, - border: Border( - left: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - bottom: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - ), - lineBarsData: [ - LineChartBarData( - spots: _getEvaporationPeriodData(), - isCurved: true, - barWidth: 2.5, - dotData: FlDotData( - show: true, - getDotPainter: (spot, percent, barData, index) { - return FlDotCirclePainter( - radius: 4, - color: Colors.blue, - strokeWidth: 0, - ); - }, - ), - color: Colors.blue, - belowBarData: BarAreaData( - show: true, - color: Colors.blue.withOpacity(0.1), - ), - ), - ], - ), - ), - ), - ], - ), - ), - ); - } - - Widget _buildMonitoringExplanation() { - return Container( - padding: const EdgeInsets.all(16), - decoration: BoxDecoration( - color: Colors.blue.shade50, - borderRadius: BorderRadius.circular(12), - border: Border.all(color: Colors.blue.shade200), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - "Penjelasan Evaporasi", - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - color: Colors.blue, - ), - ), - const SizedBox(height: 10), - const Text( - "Evaporasi adalah proses penguapan air dari permukaan tanah atau air menuju atmosfer. Tingkat evaporasi dipengaruhi oleh suhu, kelembaban udara, kecepatan angin, dan intensitas cahaya matahari. Data ini penting untuk manajemen irigasi dan perencanaan kebutuhan air.", - style: TextStyle( - fontSize: 12, - height: 1.6, - color: Colors.blue, - ), - ), - ], - ), - ); - } - - Widget _buildAnnualCombinedGraphSection() { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - "Statistik Tahunan & Rata-rata", - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - - /// STATS - Row( - children: [ - Expanded( - child: StatCard( - title: "Total Pengisian", - value: "156x", - color: Colors.blue, - icon: Icons.water_drop, - ), - ), - const SizedBox(width: 10), - Expanded( - child: StatCard( - title: "Rata-rata", - value: "4.2 mm", - color: Colors.green, - icon: Icons.trending_up, - ), - ), - ], - ), - const SizedBox(height: 20), - - /// CHART - const Text( - "Grafik Tahunan - Pengisian Air & Rata-rata Evaporasi", - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - ), - ), - const SizedBox(height: 12), - Card( - elevation: 3, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - child: Padding( - padding: const EdgeInsets.all(16), + return SingleChildScrollView( + padding: const EdgeInsets.all(20), child: Column( children: [ - SizedBox( - height: 320, - child: BarChart( - BarChartData( - gridData: FlGridData( - show: true, - drawHorizontalLine: true, - drawVerticalLine: false, - horizontalInterval: 2, - getDrawingHorizontalLine: (value) { - return FlLine( - color: Colors.grey.shade300, - strokeWidth: 1, - ); - }, - ), - titlesData: FlTitlesData( - show: true, - bottomTitles: AxisTitles( - sideTitles: SideTitles( - showTitles: true, - getTitlesWidget: (value, meta) { - final months = [ - 'Jan', - 'Feb', - 'Mar', - 'Apr', - 'Mei', - 'Jun', - 'Jul', - 'Agu', - 'Sep', - 'Okt', - 'Nov', - 'Des' - ]; - return Text( - months[value.toInt()], - style: const TextStyle( - fontSize: 10, - color: Colors.grey, - ), - ); - }, - reservedSize: 30, - ), - ), - leftTitles: AxisTitles( - sideTitles: SideTitles( - showTitles: true, - getTitlesWidget: (value, meta) { - return Text( - value.toInt().toString(), - style: const TextStyle( - fontSize: 9, - color: Colors.grey, - ), - ); - }, - reservedSize: 28, - ), - ), - rightTitles: AxisTitles( - sideTitles: SideTitles( - showTitles: true, - getTitlesWidget: (value, meta) { - return Text( - '${value.toInt()} mm', - style: const TextStyle( - fontSize: 9, - color: Colors.green, - ), - ); - }, - reservedSize: 45, - ), - ), - topTitles: AxisTitles( - sideTitles: SideTitles(showTitles: false), - ), - ), - borderData: FlBorderData( - show: true, - border: Border( - left: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - bottom: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - right: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - ), - barGroups: List.generate( - 12, - (index) => buildBarGroup(index, 0), - ), - rangeAnnotations: RangeAnnotations( - horizontalRangeAnnotations: [ - HorizontalRangeAnnotation( - y1: 3.5, - y2: 5.8, - color: Colors.green.withOpacity(0.1), - ), - ], - ), - ), - ), - ), - const SizedBox(height: 20), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - width: 16, - height: 16, - decoration: BoxDecoration( - color: Colors.blue, - borderRadius: BorderRadius.circular(3), - ), - ), - const SizedBox(width: 8), - const Text( - "Pengisian Air (kali)", - style: TextStyle(fontSize: 12), - ), - const SizedBox(width: 20), - Container( - width: 16, - height: 16, - decoration: BoxDecoration( - color: Colors.green.withOpacity(0.3), - borderRadius: BorderRadius.circular(3), - ), - ), - const SizedBox(width: 8), - const Text( - "Area Rata-rata (mm)", - style: TextStyle(fontSize: 12), - ), - ], - ), + _mainCard(state), + const SizedBox(height: 25), + _infoRow(state), + const SizedBox(height: 25), + _trendSection(), ], ), - ), + ); + }, + ), + ); + } + + /// ========================= + /// 🔥 MAIN CARD (EVAPORASI) + /// ========================= + Widget _mainCard(EvaporasiState state) { + return Container( + width: double.infinity, + padding: const EdgeInsets.symmetric(vertical: 40), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.blue.shade400, Colors.blue.shade800], ), - const SizedBox(height: 15), - Center( - child: ElevatedButton.icon( - onPressed: () => _exportAnnualData(), - icon: const Icon(Icons.file_download), - label: const Text("Download Excel Tahunan"), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.green, - foregroundColor: Colors.white, + borderRadius: BorderRadius.circular(25), + ), + child: Column( + children: [ + const Icon(Icons.water_drop, color: Colors.white, size: 45), + const SizedBox(height: 10), + Text( + state.currentValue.toStringAsFixed(1), + style: const TextStyle( + fontSize: 70, + fontWeight: FontWeight.bold, + color: Colors.white, ), ), + const Text( + "mm", + style: TextStyle(color: Colors.white70, fontSize: 18), + ), + ], + ), + ); + } + + /// ========================= + /// 📊 INFO KECIL (SUHU & AIR) + /// ========================= + Widget _infoRow(EvaporasiState state) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + _miniCard( + "Suhu", + "${state.temperature.toStringAsFixed(1)} °C", + Icons.thermostat, + Colors.orange, + ), + _miniCard( + "Tinggi Air", + "${state.waterLevel.toStringAsFixed(1)} cm", + Icons.water, + Colors.blue, ), ], ); } + + Widget _miniCard(String title, String value, IconData icon, Color color) { + return Container( + width: 160, + padding: const EdgeInsets.all(15), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + ), + child: Row( + children: [ + Icon(icon, color: color), + const SizedBox(width: 10), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title, + style: const TextStyle(fontSize: 12, color: Colors.grey)), + Text(value, style: const TextStyle(fontWeight: FontWeight.bold)), + ], + ) + ], + ), + ); + } + + /// ========================= + /// 📈 TREND (SIMPLE PLACEHOLDER) + /// ========================= + Widget _trendSection() { + return Container( + width: double.infinity, + height: 200, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + ), + child: const Center( + child: Text( + "Grafik Evaporasi", + style: TextStyle(color: Colors.grey), + ), + ), + ); + } } diff --git a/packages/monitoring_repository/lib/src/models/atmospheric_conditions.dart b/packages/monitoring_repository/lib/src/models/atmospheric_conditions.dart new file mode 100644 index 0000000..c0707f7 --- /dev/null +++ b/packages/monitoring_repository/lib/src/models/atmospheric_conditions.dart @@ -0,0 +1,25 @@ +class AtmosphericConditions { + final double temperature; + final double humidity; + final double pressure; + final double altitude; + final DateTime timestamp; + + AtmosphericConditions({ + required this.temperature, + required this.humidity, + required this.pressure, + required this.altitude, + required this.timestamp, + }); + + factory AtmosphericConditions.fromJson(Map json) { + return AtmosphericConditions( + temperature: (json['temperature'] ?? 0).toDouble(), + humidity: (json['humidity'] ?? 0).toDouble(), + pressure: (json['pressure'] ?? 0).toDouble(), + altitude: (json['altitude'] ?? 0).toDouble(), + timestamp: DateTime.now(), // karena kamu pakai latest + ); + } +} diff --git a/packages/monitoring_repository/lib/src/models/evaporasi.dart b/packages/monitoring_repository/lib/src/models/evaporasi.dart index e69de29..da56dd1 100644 --- a/packages/monitoring_repository/lib/src/models/evaporasi.dart +++ b/packages/monitoring_repository/lib/src/models/evaporasi.dart @@ -0,0 +1,36 @@ +class Evaporasi { + final double evaporasi; + final double suhu; + final double tinggiAir; + final DateTime timestamp; + + Evaporasi({ + required this.evaporasi, + required this.suhu, + required this.tinggiAir, + required this.timestamp, + }); + + static final empty = Evaporasi( + evaporasi: 0.0, + suhu: 0.0, + tinggiAir: 0.0, + timestamp: DateTime.fromMillisecondsSinceEpoch(0), + ); + + factory Evaporasi.fromJson(Map json) { + final int jam = (json['jam'] ?? 0) as int; + final int menit = (json['menit'] ?? 0) as int; + + final now = DateTime.now(); + + return Evaporasi( + evaporasi: (json['evaporasi'] ?? 0).toDouble(), + suhu: (json['suhu'] ?? 0).toDouble(), + tinggiAir: (json['tinggi_air'] ?? 0).toDouble(), + + /// 🔥 bikin timestamp dari jam & menit + timestamp: DateTime(now.year, now.month, now.day, jam, menit), + ); + } +} diff --git a/packages/monitoring_repository/lib/src/models/models.dart b/packages/monitoring_repository/lib/src/models/models.dart index f4c6e66..ae80da6 100644 --- a/packages/monitoring_repository/lib/src/models/models.dart +++ b/packages/monitoring_repository/lib/src/models/models.dart @@ -1,3 +1,3 @@ export 'wind_speed.dart'; export 'evaporasi.dart'; -export 'pressure_sensor.dart'; +export 'atmospheric_conditions.dart'; diff --git a/packages/monitoring_repository/lib/src/models/pressure_sensor.dart b/packages/monitoring_repository/lib/src/models/pressure_sensor.dart deleted file mode 100644 index e69de29..0000000 From 1f5c03ea8fc1969e7eba0c831a3702c55ce47ca3 Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Mon, 20 Apr 2026 16:57:43 +0700 Subject: [PATCH 06/19] Update home_screen.dart --- lib/screens/home/views/home_screen.dart | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/screens/home/views/home_screen.dart b/lib/screens/home/views/home_screen.dart index 007c2ff..81e5624 100644 --- a/lib/screens/home/views/home_screen.dart +++ b/lib/screens/home/views/home_screen.dart @@ -27,16 +27,12 @@ class HomeScreen extends StatelessWidget { title: Row( children: [ // Ganti dengan Image.asset jika sudah ada logo - const Icon(Icons.cloud_queue, color: Colors.blue, size: 28), - const SizedBox(width: 10), - Text( - "Klimatologi", - style: GoogleFonts.rubik( - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 20, - ), + Image.asset( + 'images/logo_klimatologi.png', + height: 90, + fit: BoxFit.contain, ), + const SizedBox(width: 10), ], ), actions: [ From 6bdf5466fdc039d2b7054176bca96a928b030115 Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Mon, 20 Apr 2026 17:04:38 +0700 Subject: [PATCH 07/19] Update google-services.json --- android/app/google-services.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/android/app/google-services.json b/android/app/google-services.json index 3fe32cf..45ff491 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -14,6 +14,14 @@ } }, "oauth_client": [ + { + "client_id": "219079385989-qtvssir2q3c4lo6ijn3p07kl77ukdme2.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.example.klimatologiot", + "certificate_hash": "f5be897daa6ad87f2bd9c04560f67ef379eac6fe" + } + }, { "client_id": "219079385989-8hkp1kg2pprs5k269s4c08r6rpdj1gjd.apps.googleusercontent.com", "client_type": 3 From a31c3c001f2e8028502822bd09971b74d2d6ea5a Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Mon, 20 Apr 2026 21:45:05 +0700 Subject: [PATCH 08/19] oke --- .../lib/src/firebase_user_repo.dart | 31 +++++++---- packages/user_repository/pubspec.lock | 52 ++++++++++++++++++- packages/user_repository/pubspec.yaml | 4 +- pubspec.lock | 12 ++--- pubspec.yaml | 2 +- 5 files changed, 79 insertions(+), 22 deletions(-) diff --git a/packages/user_repository/lib/src/firebase_user_repo.dart b/packages/user_repository/lib/src/firebase_user_repo.dart index 62890c7..ad1c960 100644 --- a/packages/user_repository/lib/src/firebase_user_repo.dart +++ b/packages/user_repository/lib/src/firebase_user_repo.dart @@ -3,6 +3,7 @@ import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:rxdart/rxdart.dart'; import 'package:user_repository/user_repository.dart'; +import 'package:google_sign_in/google_sign_in.dart'; class FirebaseUserRepo implements UserRepository { final FirebaseAuth _firebaseAuth; @@ -93,21 +94,29 @@ class FirebaseUserRepo implements UserRepository { @override Future signInWithGoogle() async { try { - final GoogleAuthProvider googleProvider = GoogleAuthProvider(); - final UserCredential userCredential = - await _firebaseAuth.signInWithPopup(googleProvider); + final account = await GoogleSignIn.instance.authenticate( + serverClientId: "1234567890-abcxyz.apps.googleusercontent.com", + ); - final User? firebaseUser = userCredential.user; - if (firebaseUser != null) { - // Check if user data already exists in Firestore - final existingUser = await userCollection.doc(firebaseUser.uid).get(); + final auth = await account.authentication; + + final credential = GoogleAuthProvider.credential( + idToken: auth.idToken, + ); + + final userCredential = + await _firebaseAuth.signInWithCredential(credential); + + final user = userCredential.user; + + if (user != null) { + final existingUser = await userCollection.doc(user.uid).get(); if (!existingUser.exists) { - // Create new user data from Google account info final newUser = MyUser( - userId: firebaseUser.uid, - email: firebaseUser.email ?? '', - name: firebaseUser.displayName ?? 'User', + userId: user.uid, + email: user.email ?? '', + name: user.displayName ?? 'User', hasActiveCart: false, ); diff --git a/packages/user_repository/pubspec.lock b/packages/user_repository/pubspec.lock index 6260b95..17d8956 100644 --- a/packages/user_repository/pubspec.lock +++ b/packages/user_repository/pubspec.lock @@ -152,6 +152,54 @@ packages: description: flutter source: sdk version: "0.0.0" + google_identity_services_web: + dependency: transitive + description: + name: google_identity_services_web + sha256: "5d187c46dc59e02646e10fe82665fc3884a9b71bc1c90c2b8b749316d33ee454" + url: "https://pub.dev" + source: hosted + version: "0.3.3+1" + google_sign_in: + dependency: "direct main" + description: + name: google_sign_in + sha256: "521031b65853b4409b8213c0387d57edaad7e2a949ce6dea0d8b2afc9cb29763" + url: "https://pub.dev" + source: hosted + version: "7.2.0" + google_sign_in_android: + dependency: transitive + description: + name: google_sign_in_android + sha256: be0d0733a6a7c5da165879d844a239aa87587a3c767a9163faedde581f731f76 + url: "https://pub.dev" + source: hosted + version: "7.2.10" + google_sign_in_ios: + dependency: transitive + description: + name: google_sign_in_ios + sha256: ac1e4c1205267cb7999d1d81333fccffdfda29e853f434bbaf71525498bb6950 + url: "https://pub.dev" + source: hosted + version: "6.3.0" + google_sign_in_platform_interface: + dependency: transitive + description: + name: google_sign_in_platform_interface + sha256: "7f59208c42b415a3cca203571128d6f84f885fead2d5b53eb65a9e27f2965bb5" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + google_sign_in_web: + dependency: transitive + description: + name: google_sign_in_web + sha256: d473003eeca892f96a01a64fc803378be765071cb0c265ee872c7f8683245d14 + url: "https://pub.dev" + source: hosted + version: "1.1.3" http: dependency: transitive description: @@ -334,5 +382,5 @@ packages: source: hosted version: "1.1.1" sdks: - dart: ">=3.8.0-0 <4.0.0" - flutter: ">=3.22.0" + dart: ">=3.10.0 <4.0.0" + flutter: ">=3.38.0" diff --git a/packages/user_repository/pubspec.yaml b/packages/user_repository/pubspec.yaml index aa491f8..b3c6629 100644 --- a/packages/user_repository/pubspec.yaml +++ b/packages/user_repository/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: flutter: sdk: flutter - + google_sign_in: ^7.1.1 # equatable: ^2.0.5 firebase_auth: ^6.1.3 cloud_firestore: ^6.1.1 @@ -23,4 +23,4 @@ dev_dependencies: flutter_lints: ^3.0.0 flutter: - uses-material-design: true \ No newline at end of file + uses-material-design: true diff --git a/pubspec.lock b/pubspec.lock index 99e4d46..4241d6c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -300,18 +300,18 @@ packages: dependency: transitive description: name: google_sign_in_android - sha256: "5ec98ab35387c68c0050495bb211bd88375873723a80fae7c2e9266ea0bdd8bb" + sha256: be0d0733a6a7c5da165879d844a239aa87587a3c767a9163faedde581f731f76 url: "https://pub.dev" source: hosted - version: "7.2.7" + version: "7.2.10" google_sign_in_ios: dependency: transitive description: name: google_sign_in_ios - sha256: "234fc2830b55d1bbeb7e05662967691f5994143ff43dc70d3f139d1bbb3b8fb2" + sha256: ac1e4c1205267cb7999d1d81333fccffdfda29e853f434bbaf71525498bb6950 url: "https://pub.dev" source: hosted - version: "6.2.5" + version: "6.3.0" google_sign_in_platform_interface: dependency: transitive description: @@ -324,10 +324,10 @@ packages: dependency: transitive description: name: google_sign_in_web - sha256: "2fc1f941e6443b2d6984f4056a727a3eaeab15d8ee99ba7125d79029be75a1da" + sha256: d473003eeca892f96a01a64fc803378be765071cb0c265ee872c7f8683245d14 url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.3" hooks: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 378b697..df2bb2e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: sdk: flutter flutter_bloc: ^8.1.0 google_fonts: ^8.0.2 - google_sign_in: ^7.2.0 + google_sign_in: ^7.1.1 intl: ^0.20.2 monitoring_repository: path: packages/monitoring_repository From 7e88c0f8e89c2e20e56ff07ca81c48b77488121c Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Mon, 20 Apr 2026 22:31:03 +0700 Subject: [PATCH 09/19] josss --- .vscode/launch.json | 65 +++++++++++++++++++ .../lib/src/firebase_user_repo.dart | 16 +++-- packages/user_repository/pubspec.lock | 24 +++---- packages/user_repository/pubspec.yaml | 2 +- pubspec.lock | 20 +++--- pubspec.yaml | 2 +- 6 files changed, 100 insertions(+), 29 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..58e5f7e --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,65 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "klimatologi", + "request": "launch", + "type": "dart" + }, + { + "name": "klimatologi (profile mode)", + "request": "launch", + "type": "dart", + "flutterMode": "profile" + }, + { + "name": "klimatologi (release mode)", + "request": "launch", + "type": "dart", + "flutterMode": "release" + }, + { + "name": "monitoring_repository", + "cwd": "packages\\monitoring_repository", + "request": "launch", + "type": "dart" + }, + { + "name": "monitoring_repository (profile mode)", + "cwd": "packages\\monitoring_repository", + "request": "launch", + "type": "dart", + "flutterMode": "profile" + }, + { + "name": "monitoring_repository (release mode)", + "cwd": "packages\\monitoring_repository", + "request": "launch", + "type": "dart", + "flutterMode": "release" + }, + { + "name": "user_repository", + "cwd": "packages\\user_repository", + "request": "launch", + "type": "dart" + }, + { + "name": "user_repository (profile mode)", + "cwd": "packages\\user_repository", + "request": "launch", + "type": "dart", + "flutterMode": "profile" + }, + { + "name": "user_repository (release mode)", + "cwd": "packages\\user_repository", + "request": "launch", + "type": "dart", + "flutterMode": "release" + } + ] +} \ No newline at end of file diff --git a/packages/user_repository/lib/src/firebase_user_repo.dart b/packages/user_repository/lib/src/firebase_user_repo.dart index ad1c960..14e67a3 100644 --- a/packages/user_repository/lib/src/firebase_user_repo.dart +++ b/packages/user_repository/lib/src/firebase_user_repo.dart @@ -73,6 +73,8 @@ class FirebaseUserRepo implements UserRepository { /// == Melakukan Implement Log Out == /// @override Future logOut() async { + final GoogleSignIn googleSignIn = GoogleSignIn(); + await googleSignIn.signOut(); await _firebaseAuth.signOut(); } @@ -94,14 +96,18 @@ class FirebaseUserRepo implements UserRepository { @override Future signInWithGoogle() async { try { - final account = await GoogleSignIn.instance.authenticate( - serverClientId: "1234567890-abcxyz.apps.googleusercontent.com", - ); + final GoogleSignIn googleSignIn = GoogleSignIn(); - final auth = await account.authentication; + final GoogleSignInAccount? googleUser = await googleSignIn.signIn(); + + if (googleUser == null) return; + + final GoogleSignInAuthentication googleAuth = + await googleUser.authentication; final credential = GoogleAuthProvider.credential( - idToken: auth.idToken, + accessToken: googleAuth.accessToken, + idToken: googleAuth.idToken, ); final userCredential = diff --git a/packages/user_repository/pubspec.lock b/packages/user_repository/pubspec.lock index 17d8956..68c4d0e 100644 --- a/packages/user_repository/pubspec.lock +++ b/packages/user_repository/pubspec.lock @@ -164,42 +164,42 @@ packages: dependency: "direct main" description: name: google_sign_in - sha256: "521031b65853b4409b8213c0387d57edaad7e2a949ce6dea0d8b2afc9cb29763" + sha256: d0a2c3bcb06e607bb11e4daca48bd4b6120f0bbc4015ccebbe757d24ea60ed2a url: "https://pub.dev" source: hosted - version: "7.2.0" + version: "6.3.0" google_sign_in_android: dependency: transitive description: name: google_sign_in_android - sha256: be0d0733a6a7c5da165879d844a239aa87587a3c767a9163faedde581f731f76 + sha256: d5e23c56a4b84b6427552f1cf3f98f716db3b1d1a647f16b96dbb5b93afa2805 url: "https://pub.dev" source: hosted - version: "7.2.10" + version: "6.2.1" google_sign_in_ios: dependency: transitive description: name: google_sign_in_ios - sha256: ac1e4c1205267cb7999d1d81333fccffdfda29e853f434bbaf71525498bb6950 + sha256: "102005f498ce18442e7158f6791033bbc15ad2dcc0afa4cf4752e2722a516c96" url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "5.9.0" google_sign_in_platform_interface: dependency: transitive description: name: google_sign_in_platform_interface - sha256: "7f59208c42b415a3cca203571128d6f84f885fead2d5b53eb65a9e27f2965bb5" + sha256: "5f6f79cf139c197261adb6ac024577518ae48fdff8e53205c5373b5f6430a8aa" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "2.5.0" google_sign_in_web: dependency: transitive description: name: google_sign_in_web - sha256: d473003eeca892f96a01a64fc803378be765071cb0c265ee872c7f8683245d14 + sha256: "460547beb4962b7623ac0fb8122d6b8268c951cf0b646dd150d60498430e4ded" url: "https://pub.dev" source: hosted - version: "1.1.3" + version: "0.12.4+4" http: dependency: transitive description: @@ -382,5 +382,5 @@ packages: source: hosted version: "1.1.1" sdks: - dart: ">=3.10.0 <4.0.0" - flutter: ">=3.38.0" + dart: ">=3.8.0-0 <4.0.0" + flutter: ">=3.27.0" diff --git a/packages/user_repository/pubspec.yaml b/packages/user_repository/pubspec.yaml index b3c6629..e1428ff 100644 --- a/packages/user_repository/pubspec.yaml +++ b/packages/user_repository/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: flutter: sdk: flutter - google_sign_in: ^7.1.1 + google_sign_in: ^6.3.0 # equatable: ^2.0.5 firebase_auth: ^6.1.3 cloud_firestore: ^6.1.1 diff --git a/pubspec.lock b/pubspec.lock index 4241d6c..1b69af3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -292,42 +292,42 @@ packages: dependency: "direct main" description: name: google_sign_in - sha256: "521031b65853b4409b8213c0387d57edaad7e2a949ce6dea0d8b2afc9cb29763" + sha256: d0a2c3bcb06e607bb11e4daca48bd4b6120f0bbc4015ccebbe757d24ea60ed2a url: "https://pub.dev" source: hosted - version: "7.2.0" + version: "6.3.0" google_sign_in_android: dependency: transitive description: name: google_sign_in_android - sha256: be0d0733a6a7c5da165879d844a239aa87587a3c767a9163faedde581f731f76 + sha256: d5e23c56a4b84b6427552f1cf3f98f716db3b1d1a647f16b96dbb5b93afa2805 url: "https://pub.dev" source: hosted - version: "7.2.10" + version: "6.2.1" google_sign_in_ios: dependency: transitive description: name: google_sign_in_ios - sha256: ac1e4c1205267cb7999d1d81333fccffdfda29e853f434bbaf71525498bb6950 + sha256: "102005f498ce18442e7158f6791033bbc15ad2dcc0afa4cf4752e2722a516c96" url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "5.9.0" google_sign_in_platform_interface: dependency: transitive description: name: google_sign_in_platform_interface - sha256: "7f59208c42b415a3cca203571128d6f84f885fead2d5b53eb65a9e27f2965bb5" + sha256: "5f6f79cf139c197261adb6ac024577518ae48fdff8e53205c5373b5f6430a8aa" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "2.5.0" google_sign_in_web: dependency: transitive description: name: google_sign_in_web - sha256: d473003eeca892f96a01a64fc803378be765071cb0c265ee872c7f8683245d14 + sha256: "460547beb4962b7623ac0fb8122d6b8268c951cf0b646dd150d60498430e4ded" url: "https://pub.dev" source: hosted - version: "1.1.3" + version: "0.12.4+4" hooks: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index df2bb2e..fdfe240 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: sdk: flutter flutter_bloc: ^8.1.0 google_fonts: ^8.0.2 - google_sign_in: ^7.1.1 + google_sign_in: ^6.3.0 intl: ^0.20.2 monitoring_repository: path: packages/monitoring_repository From 760f15db14af69d1182f200ea251828dd80e07df Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Thu, 23 Apr 2026 11:32:51 +0700 Subject: [PATCH 10/19] update --- lib/core/utils/time_series_mapper.dart | 43 +- .../auth/blocs/sign_in_bloc/sign_in_bloc.dart | 1 + .../air_quality_monitoring_screen.dart | 784 ------------------ .../wind_speed/blocs/wind_speed_bloc.dart | 96 ++- .../lib/src/firebase_user_repo.dart | 48 +- 5 files changed, 103 insertions(+), 869 deletions(-) delete mode 100644 lib/screens/monitoring/air_quality_monitoring_screen.dart diff --git a/lib/core/utils/time_series_mapper.dart b/lib/core/utils/time_series_mapper.dart index fd2df54..5cc4ac0 100644 --- a/lib/core/utils/time_series_mapper.dart +++ b/lib/core/utils/time_series_mapper.dart @@ -8,17 +8,24 @@ class TimeSeriesMapper { required double Function(T) getValue, }) { final now = DateTime.now(); - final slots = List.filled(24, 0.0); + + final sums = List.filled(24, 0.0); + final counts = List.filled(24, 0); for (final item in data) { final time = getTime(item); if (_isSameDay(time, now)) { - slots[time.hour] = getValue(item); + final hour = time.hour; + sums[hour] += getValue(item); + counts[hour]++; } } - return slots; + return List.generate(24, (i) { + if (counts[i] == 0) return 0; + return sums[i] / counts[i]; // 🔥 average, bukan overwrite + }); } /// ========================= @@ -32,10 +39,9 @@ class TimeSeriesMapper { final now = DateTime.now(); final slots = List.filled(7, 0.0); - DateTime startOfWeek = - now.subtract(Duration(days: now.weekday - 1)); - startOfWeek = DateTime( - startOfWeek.year, startOfWeek.month, startOfWeek.day); + DateTime startOfWeek = now.subtract(Duration(days: now.weekday - 1)); + startOfWeek = + DateTime(startOfWeek.year, startOfWeek.month, startOfWeek.day); for (final item in data) { final time = getTime(item); @@ -75,8 +81,23 @@ class TimeSeriesMapper { /// 🧠 HELPER /// ========================= static bool _isSameDay(DateTime a, DateTime b) { - return a.year == b.year && - a.month == b.month && - a.day == b.day; + return a.year == b.year && a.month == b.month && a.day == b.day; } -} \ No newline at end of file + + static List smooth(List data) { + if (data.length < 3) return data; + + List result = []; + + for (int i = 0; i < data.length; i++) { + if (i == 0 || i == data.length - 1) { + result.add(data[i]); + } else { + final avg = (data[i - 1] + data[i] + data[i + 1]) / 3; + result.add(avg); + } + } + + return result; + } +} diff --git a/lib/screens/auth/blocs/sign_in_bloc/sign_in_bloc.dart b/lib/screens/auth/blocs/sign_in_bloc/sign_in_bloc.dart index 5cdc2c8..ef52fb0 100644 --- a/lib/screens/auth/blocs/sign_in_bloc/sign_in_bloc.dart +++ b/lib/screens/auth/blocs/sign_in_bloc/sign_in_bloc.dart @@ -22,6 +22,7 @@ class SignInBloc extends Bloc { emit(SignInProcess()); try { await _userRepository.signInWithGoogle(); + emit(SignInSuccess()); } catch (e) { emit(SignInFailure()); emit(SignInInitial()); diff --git a/lib/screens/monitoring/air_quality_monitoring_screen.dart b/lib/screens/monitoring/air_quality_monitoring_screen.dart deleted file mode 100644 index ea75308..0000000 --- a/lib/screens/monitoring/air_quality_monitoring_screen.dart +++ /dev/null @@ -1,784 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:fl_chart/fl_chart.dart'; -import 'shared/widgets/monitoring_shared.dart'; - -/// AIR QUALITY MONITORING SCREEN -class AirQualityMonitoringScreen extends StatefulWidget { - const AirQualityMonitoringScreen({super.key}); - - @override - State createState() => - _AirQualityMonitoringScreenState(); -} - -class _AirQualityMonitoringScreenState - extends State { - String _selectedPeriod = "Hari Ini"; - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text("Monitoring Kualitas Udara"), - centerTitle: true, - ), - body: Padding( - padding: const EdgeInsets.all(16), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - "Kualitas Udara", - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 20), - - /// GRAFIK MONITORING - _buildMonitoringGraphBlock(), - const SizedBox(height: 25), - - /// PENJELASAN - _buildAirQualityExplanation(), - const SizedBox(height: 25), - - /// STATISTIK TAHUNAN - _buildAnnualAirQualityGraphSection(), - ], - ), - ), - ), - ); - } - - /// EXPORT FUNCTIONS - void _exportDailyAirQualityData() { - final StringBuffer csvContent = StringBuffer(); - csvContent.writeln("DATA MONITORING KUALITAS UDARA - HARIAN (24 JAM)"); - csvContent.writeln("Tanggal: ${DateTime.now().toString().split(' ')[0]}"); - csvContent.writeln(""); - csvContent.writeln("Jam,AQI (Air Quality Index)"); - - final dailyData = [ - 68.0, - 70.0, - 72.0, - 75.0, - 78.0, - 80.0, - 78.0, - 75.0, - 72.0, - 70.0, - 68.0, - 65.0, - 60.0, - 58.0, - 60.0, - 62.0, - 65.0, - 68.0, - 70.0, - 72.0, - 75.0, - 78.0, - 76.0, - 74.0 - ]; - for (int i = 0; i < dailyData.length; i++) { - csvContent.writeln("$i:00,${dailyData[i]}"); - } - - csvContent.writeln(""); - csvContent.writeln("Statistik Harian"); - csvContent.writeln("Total: 1709 AQI"); - csvContent.writeln("Rata-rata: 71.2 AQI"); - csvContent.writeln("Maksimal: 80 AQI"); - csvContent.writeln("Minimal: 58 AQI"); - - showExportPreview( - context, csvContent.toString(), "Data Harian Kualitas Udara"); - } - - void _exportWeeklyAirQualityData() { - final StringBuffer csvContent = StringBuffer(); - csvContent.writeln("DATA MONITORING KUALITAS UDARA - MINGGUAN"); - csvContent.writeln("Tanggal: ${DateTime.now().toString().split(' ')[0]}"); - csvContent.writeln(""); - csvContent.writeln("Hari,Rata-rata AQI"); - - final days = [ - 'Senin', - 'Selasa', - 'Rabu', - 'Kamis', - 'Jumat', - 'Sabtu', - 'Minggu' - ]; - final weeklyData = [68.0, 72.0, 75.0, 78.0, 72.0, 68.0, 62.0]; - - for (int i = 0; i < days.length; i++) { - csvContent.writeln("${days[i]},${weeklyData[i]}"); - } - - csvContent.writeln(""); - csvContent.writeln("Statistik Mingguan"); - csvContent.writeln("Total: 495 AQI"); - csvContent.writeln("Rata-rata: 70.7 AQI"); - csvContent.writeln("Maksimal: 78 AQI"); - csvContent.writeln("Minimal: 62 AQI"); - - showExportPreview( - context, csvContent.toString(), "Data Mingguan Kualitas Udara"); - } - - void _exportMonthlyAirQualityData() { - final StringBuffer csvContent = StringBuffer(); - csvContent.writeln("DATA MONITORING KUALITAS UDARA - BULANAN"); - csvContent.writeln( - "Bulan: ${DateTime.now().toString().split(' ')[0].substring(0, 7)}"); - csvContent.writeln(""); - csvContent.writeln("Tanggal,Rata-rata AQI"); - - for (int i = 1; i <= 28; i++) { - final value = (70.0 + (i % 6) * 2.5).toStringAsFixed(1); - csvContent.writeln("$i,$value"); - } - - csvContent.writeln(""); - csvContent.writeln("Statistik Bulanan"); - csvContent.writeln("Total: 1990 AQI"); - csvContent.writeln("Rata-rata: 71.1 AQI"); - csvContent.writeln("Maksimal: 82 AQI"); - csvContent.writeln("Minimal: 55 AQI"); - - showExportPreview( - context, csvContent.toString(), "Data Bulanan Kualitas Udara"); - } - - void _exportAnnualAirQualityData() { - final StringBuffer csvContent = StringBuffer(); - csvContent.writeln("DATA MONITORING KUALITAS UDARA - TAHUNAN"); - csvContent.writeln("Tahun: 2025"); - csvContent.writeln(""); - csvContent.writeln("Bulan,Rata-rata AQI,AQI Max"); - - final months = [ - 'Januari', - 'Februari', - 'Maret', - 'April', - 'Mei', - 'Juni', - 'Juli', - 'Agustus', - 'September', - 'Oktober', - 'November', - 'Desember' - ]; - final averages = [ - 68.0, - 70.0, - 72.5, - 75.0, - 78.0, - 80.0, - 82.0, - 80.0, - 75.0, - 70.0, - 68.0, - 65.0 - ]; - final maxAqi = [ - 85.0, - 88.0, - 90.0, - 95.0, - 98.0, - 100.0, - 102.0, - 100.0, - 95.0, - 90.0, - 85.0, - 80.0 - ]; - - for (int i = 0; i < months.length; i++) { - csvContent.writeln("${months[i]},${averages[i]},${maxAqi[i]}"); - } - - csvContent.writeln(""); - csvContent.writeln("STATISTIK TAHUNAN"); - csvContent.writeln("Rata-rata Tahunan: 74.2 AQI"); - csvContent.writeln("AQI Max Teringgi: 102.0"); - csvContent.writeln("AQI Min Terendah: 65.0"); - - showExportPreview( - context, csvContent.toString(), "Data Tahunan Kualitas Udara"); - } - - /// DATA GENERATORS - List _getAirQualityPeriodData() { - switch (_selectedPeriod) { - case "Hari Ini": - return List.generate(24, (i) { - final values = [ - 68.0, - 70.0, - 72.0, - 75.0, - 78.0, - 80.0, - 78.0, - 75.0, - 72.0, - 70.0, - 68.0, - 65.0, - 60.0, - 58.0, - 60.0, - 62.0, - 65.0, - 68.0, - 70.0, - 72.0, - 75.0, - 78.0, - 76.0, - 74.0 - ]; - return FlSpot(i.toDouble(), values[i]); - }); - case "Minggu Ini": - return [ - const FlSpot(0, 68.0), - const FlSpot(1, 72.0), - const FlSpot(2, 75.0), - const FlSpot(3, 78.0), - const FlSpot(4, 72.0), - const FlSpot(5, 68.0), - const FlSpot(6, 62.0), - ]; - case "Bulan Ini": - return [ - const FlSpot(0, 70.0), - const FlSpot(1, 72.5), - const FlSpot(2, 75.0), - const FlSpot(3, 77.5), - const FlSpot(4, 80.0), - const FlSpot(5, 82.0), - const FlSpot(6, 80.0), - const FlSpot(7, 78.0), - const FlSpot(8, 75.0), - const FlSpot(9, 72.0), - const FlSpot(10, 70.0), - const FlSpot(11, 68.0), - ]; - default: - return []; - } - } - - /// UI BUILDERS - Widget _buildMonitoringGraphBlock() { - return Card( - elevation: 4, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Text( - "Status Kualitas Udara", - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, - ), - ), - Container( - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, - ), - decoration: BoxDecoration( - color: Colors.amber.shade100, - borderRadius: BorderRadius.circular(20), - ), - child: const Text( - "Normal", - style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.w600, - color: Colors.amber, - ), - ), - ), - ], - ), - const SizedBox(height: 16), - - /// PERIOD SELECTOR + EXPORT - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - children: - ["Hari Ini", "Minggu Ini", "Bulan Ini"].map((period) { - return Padding( - padding: const EdgeInsets.only(right: 8), - child: ChoiceChip( - label: Text(period), - selected: _selectedPeriod == period, - onSelected: (selected) { - setState(() { - _selectedPeriod = period; - }); - }, - selectedColor: Colors.orange, - labelStyle: TextStyle( - color: _selectedPeriod == period - ? Colors.white - : Colors.black, - ), - ), - ); - }).toList(), - ), - ), - ), - const SizedBox(width: 8), - ElevatedButton.icon( - onPressed: () { - if (_selectedPeriod == "Hari Ini") { - _exportDailyAirQualityData(); - } else if (_selectedPeriod == "Minggu Ini") { - _exportWeeklyAirQualityData(); - } else if (_selectedPeriod == "Bulan Ini") { - _exportMonthlyAirQualityData(); - } - }, - icon: const Icon(Icons.download, size: 16), - label: const Text("Export"), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.orange, - foregroundColor: Colors.white, - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 6, - ), - textStyle: const TextStyle(fontSize: 11), - ), - ), - ], - ), - const SizedBox(height: 16), - - /// GRAPH - SizedBox( - height: 300, - child: LineChart( - LineChartData( - gridData: FlGridData( - show: true, - drawHorizontalLine: true, - drawVerticalLine: false, - horizontalInterval: 1, - getDrawingHorizontalLine: (value) { - return FlLine( - color: Colors.grey.shade300, - strokeWidth: 1, - ); - }, - ), - titlesData: FlTitlesData( - show: true, - bottomTitles: AxisTitles( - sideTitles: SideTitles( - showTitles: true, - interval: getPeriodInterval(_selectedPeriod), - getTitlesWidget: (value, meta) { - return Text( - getPeriodLabel(_selectedPeriod, value), - style: const TextStyle( - fontSize: 10, - color: Colors.grey, - ), - ); - }, - ), - ), - leftTitles: AxisTitles( - sideTitles: SideTitles( - showTitles: true, - interval: 1, - getTitlesWidget: (value, meta) { - return Text( - value.toInt().toString(), - style: const TextStyle( - fontSize: 9, - color: Colors.grey, - ), - ); - }, - reservedSize: 28, - ), - ), - topTitles: AxisTitles( - sideTitles: SideTitles(showTitles: false), - ), - rightTitles: AxisTitles( - sideTitles: SideTitles(showTitles: false), - ), - ), - borderData: FlBorderData( - show: true, - border: Border( - left: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - bottom: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - ), - lineBarsData: [ - LineChartBarData( - spots: _getAirQualityPeriodData(), - isCurved: true, - barWidth: 2.5, - dotData: FlDotData( - show: true, - getDotPainter: (spot, percent, barData, index) { - return FlDotCirclePainter( - radius: 4, - color: Colors.orange, - strokeWidth: 0, - ); - }, - ), - color: Colors.orange, - belowBarData: BarAreaData( - show: true, - color: Colors.orange.withOpacity(0.1), - ), - ), - ], - ), - ), - ), - ], - ), - ), - ); - } - - Widget _buildAirQualityExplanation() { - return Container( - padding: const EdgeInsets.all(16), - decoration: BoxDecoration( - color: Colors.orange.shade50, - borderRadius: BorderRadius.circular(12), - border: Border.all(color: Colors.orange.shade200), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - "Penjelasan Kualitas Udara", - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - color: Colors.orange, - ), - ), - const SizedBox(height: 10), - const Text( - "Kualitas udara diukur menggunakan Air Quality Index (AQI) yang menunjukkan tingkat polusi udara. AQI berkisar dari 0-500, dengan nilai lebih rendah menunjukkan udara lebih bersih. Monitoring kualitas udara penting untuk kesehatan masyarakat, perencanaan lingkungan, dan identifikasi sumber polusi. Kategori: 0-50 (Baik), 51-100 (Wajar), 101-150 (Tidak Sehat), 151+ (Sangat Tidak Sehat).", - style: TextStyle( - fontSize: 12, - height: 1.6, - color: Colors.orange, - ), - ), - ], - ), - ); - } - - Widget _buildAnnualAirQualityGraphSection() { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - "Statistik Tahunan Kualitas Udara", - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - - /// STATS - Row( - children: [ - Expanded( - child: StatCard( - title: "Rata-rata Tahunan", - value: "74.2 AQI", - color: Colors.orange, - icon: Icons.cloud, - ), - ), - const SizedBox(width: 10), - Expanded( - child: StatCard( - title: "AQI Maksimal", - value: "102.0", - color: Colors.red, - icon: Icons.warning, - ), - ), - ], - ), - const SizedBox(height: 20), - - /// CHART - const Text( - "Grafik Tahunan - Rata-rata & AQI Maksimal", - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - ), - ), - const SizedBox(height: 12), - Card( - elevation: 3, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - child: Padding( - padding: const EdgeInsets.all(16), - child: SizedBox( - height: 320, - child: LineChart( - LineChartData( - gridData: FlGridData( - show: true, - drawHorizontalLine: true, - drawVerticalLine: false, - horizontalInterval: 5, - getDrawingHorizontalLine: (value) { - return FlLine( - color: Colors.grey.shade300, - strokeWidth: 1, - ); - }, - ), - titlesData: FlTitlesData( - show: true, - bottomTitles: AxisTitles( - sideTitles: SideTitles( - showTitles: true, - getTitlesWidget: (value, meta) { - final months = [ - 'Jan', - 'Feb', - 'Mar', - 'Apr', - 'Mei', - 'Jun', - 'Jul', - 'Agu', - 'Sep', - 'Okt', - 'Nov', - 'Des' - ]; - return Text( - months[value.toInt()], - style: const TextStyle( - fontSize: 10, - color: Colors.grey, - ), - ); - }, - reservedSize: 30, - ), - ), - leftTitles: AxisTitles( - sideTitles: SideTitles( - showTitles: true, - getTitlesWidget: (value, meta) { - return Text( - '${value.toInt()} AQI', - style: const TextStyle( - fontSize: 9, - color: Colors.grey, - ), - ); - }, - reservedSize: 50, - ), - ), - rightTitles: AxisTitles( - sideTitles: SideTitles(showTitles: false), - ), - topTitles: AxisTitles( - sideTitles: SideTitles(showTitles: false), - ), - ), - borderData: FlBorderData( - show: true, - border: Border( - left: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - bottom: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - ), - lineBarsData: [ - /// Rata-rata - LineChartBarData( - spots: const [ - FlSpot(0, 68.0), - FlSpot(1, 70.0), - FlSpot(2, 72.5), - FlSpot(3, 75.0), - FlSpot(4, 78.0), - FlSpot(5, 80.0), - FlSpot(6, 82.0), - FlSpot(7, 80.0), - FlSpot(8, 75.0), - FlSpot(9, 70.0), - FlSpot(10, 68.0), - FlSpot(11, 65.0), - ], - isCurved: true, - barWidth: 2.5, - dotData: FlDotData( - show: true, - getDotPainter: (spot, percent, barData, index) { - return FlDotCirclePainter( - radius: 4, - color: Colors.orange, - strokeWidth: 0, - ); - }, - ), - color: Colors.orange, - belowBarData: BarAreaData( - show: true, - color: Colors.orange.withOpacity(0.1), - ), - ), - - /// AQI Max - LineChartBarData( - spots: const [ - FlSpot(0, 85.0), - FlSpot(1, 88.0), - FlSpot(2, 90.0), - FlSpot(3, 95.0), - FlSpot(4, 98.0), - FlSpot(5, 100.0), - FlSpot(6, 102.0), - FlSpot(7, 100.0), - FlSpot(8, 95.0), - FlSpot(9, 90.0), - FlSpot(10, 85.0), - FlSpot(11, 80.0), - ], - isCurved: true, - barWidth: 2.5, - dotData: FlDotData( - show: true, - getDotPainter: (spot, percent, barData, index) { - return FlDotCirclePainter( - radius: 4, - color: Colors.red, - strokeWidth: 0, - ); - }, - ), - color: Colors.red, - ), - ], - ), - ), - ), - ), - ), - const SizedBox(height: 15), - - /// LEGEND - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - width: 16, - height: 16, - decoration: BoxDecoration( - color: Colors.orange, - borderRadius: BorderRadius.circular(3), - ), - ), - const SizedBox(width: 8), - const Text( - "Rata-rata AQI", - style: TextStyle(fontSize: 12), - ), - const SizedBox(width: 20), - Container( - width: 16, - height: 16, - decoration: BoxDecoration( - color: Colors.red, - borderRadius: BorderRadius.circular(3), - ), - ), - const SizedBox(width: 8), - const Text( - "AQI Maksimal", - style: TextStyle(fontSize: 12), - ), - ], - ), - const SizedBox(height: 15), - Center( - child: ElevatedButton.icon( - onPressed: () => _exportAnnualAirQualityData(), - icon: const Icon(Icons.file_download), - label: const Text("Download Excel Tahunan"), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.green, - foregroundColor: Colors.white, - ), - ), - ), - ], - ); - } -} diff --git a/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart b/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart index f7b18ef..7544b4e 100644 --- a/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart +++ b/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart @@ -15,7 +15,6 @@ class WindSpeedBloc extends Bloc { WindSpeedBloc({required MonitoringRepository repository}) : _repository = repository, super(const WindSpeedState()) { - /// 🔥 START MONITORING on(_onStarted, transformer: restartable()); @@ -30,24 +29,24 @@ class WindSpeedBloc extends Bloc { /// 🚀 START /// ========================= Future _onStarted( - WatchWindSpeedStarted event, - Emitter emit, - ) async { - + WatchWindSpeedStarted event, + Emitter emit, + ) async { emit(state.copyWith(isLoading: true)); /// 1. Ambil history SEKALI final history = await _repository.getSensorHistory( 'anemometer/history', - (json) => MyWindSpeed.fromJson(json), + (json) => MyWindSpeed.fromJson(json), ); /// 2. Mapping default (harian) - final dailyGraph = TimeSeriesMapper.toDaily( + final raw = TimeSeriesMapper.toDaily( data: history, - getTime: (e) => e.timestamp, - getValue: (e) => e.speed, - ); + getTime: (e) => e.timestamp, + getValue: (e) => e.speed, + ); + final dailyGraph = TimeSeriesMapper.smooth(raw); emit(state.copyWith( history: history, @@ -61,7 +60,7 @@ class WindSpeedBloc extends Bloc { _subscription = _repository .getSensorStream( 'anemometer/realtime', - (json) => MyWindSpeed.fromJson(json), + (json) => MyWindSpeed.fromJson(json), ) .listen((data) { add(_WindSpeedRealtimeUpdated(data)); @@ -72,22 +71,32 @@ class WindSpeedBloc extends Bloc { /// ⚡ REALTIME UPDATE /// ========================= void _onRealtimeUpdated( - _WindSpeedRealtimeUpdated event, - Emitter emit, - ) { + _WindSpeedRealtimeUpdated event, + Emitter emit, + ) { + final updated = List.from(state.dailySpeeds); - final updatedSpeeds = List.from(state.dailySpeeds); + final index = DateTime.now().hour; + double newValue = event.data.speed; - /// 🔥 FIX: pakai JAM bukan menit - final int index = DateTime.now().hour; + if (index < updated.length) { + final lastValue = updated[index]; - if (index < updatedSpeeds.length) { - updatedSpeeds[index] = event.data.speed; + /// 🔥 ANTI SPIKE + SMOOTHING + if (lastValue != 0) { + if ((newValue - lastValue).abs() > 15) { + newValue = lastValue; // buang spike + } else { + newValue = (lastValue + newValue) / 2; // smoothing + } + } + + updated[index] = newValue; } emit(state.copyWith( - currentSpeed: event.data.speed, - dailySpeeds: updatedSpeeds, + currentSpeed: newValue, + dailySpeeds: updated, )); } @@ -95,10 +104,9 @@ class WindSpeedBloc extends Bloc { /// 📊 CHANGE PERIOD /// ========================= Future _onPeriodChanged( - WindSpeedPeriodChanged event, - Emitter emit, - ) async { - + WindSpeedPeriodChanged event, + Emitter emit, + ) async { emit(state.copyWith(isLoading: true, selectedPeriod: event.period)); final history = state.history; @@ -106,24 +114,24 @@ class WindSpeedBloc extends Bloc { List updatedGraph; if (event.period == "Minggu Ini") { - updatedGraph = TimeSeriesMapper.toWeekly( - data: history, - getTime: (e) => e.timestamp, - getValue: (e) => e.speed, - ); -} else if (event.period == "Bulan Ini") { - updatedGraph = TimeSeriesMapper.toMonthly( - data: history, - getTime: (e) => e.timestamp, - getValue: (e) => e.speed, - ); -} else { - updatedGraph = TimeSeriesMapper.toDaily( - data: history, - getTime: (e) => e.timestamp, - getValue: (e) => e.speed, - ); -} + updatedGraph = TimeSeriesMapper.toWeekly( + data: history, + getTime: (e) => e.timestamp, + getValue: (e) => e.speed, + ); + } else if (event.period == "Bulan Ini") { + updatedGraph = TimeSeriesMapper.toMonthly( + data: history, + getTime: (e) => e.timestamp, + getValue: (e) => e.speed, + ); + } else { + updatedGraph = TimeSeriesMapper.toDaily( + data: history, + getTime: (e) => e.timestamp, + getValue: (e) => e.speed, + ); + } emit(state.copyWith( dailySpeeds: updatedGraph, @@ -148,4 +156,4 @@ class _WindSpeedRealtimeUpdated extends WindSpeedEvent { @override List get props => [data]; -} \ No newline at end of file +} diff --git a/packages/user_repository/lib/src/firebase_user_repo.dart b/packages/user_repository/lib/src/firebase_user_repo.dart index 14e67a3..f816dc5 100644 --- a/packages/user_repository/lib/src/firebase_user_repo.dart +++ b/packages/user_repository/lib/src/firebase_user_repo.dart @@ -4,6 +4,7 @@ import 'package:firebase_auth/firebase_auth.dart'; import 'package:rxdart/rxdart.dart'; import 'package:user_repository/user_repository.dart'; import 'package:google_sign_in/google_sign_in.dart'; +import 'package:flutter/foundation.dart' show kIsWeb; class FirebaseUserRepo implements UserRepository { final FirebaseAuth _firebaseAuth; @@ -96,38 +97,25 @@ class FirebaseUserRepo implements UserRepository { @override Future signInWithGoogle() async { try { - final GoogleSignIn googleSignIn = GoogleSignIn(); + if (kIsWeb) { + final googleProvider = GoogleAuthProvider(); + await _firebaseAuth.signInWithPopup(googleProvider); + } else { + final GoogleSignIn googleSignIn = GoogleSignIn(); + final googleUser = await googleSignIn.signIn(); - final GoogleSignInAccount? googleUser = await googleSignIn.signIn(); - - if (googleUser == null) return; - - final GoogleSignInAuthentication googleAuth = - await googleUser.authentication; - - final credential = GoogleAuthProvider.credential( - accessToken: googleAuth.accessToken, - idToken: googleAuth.idToken, - ); - - final userCredential = - await _firebaseAuth.signInWithCredential(credential); - - final user = userCredential.user; - - if (user != null) { - final existingUser = await userCollection.doc(user.uid).get(); - - if (!existingUser.exists) { - final newUser = MyUser( - userId: user.uid, - email: user.email ?? '', - name: user.displayName ?? 'User', - hasActiveCart: false, - ); - - await setUserData(newUser); + if (googleUser == null) { + throw Exception("cancelled"); } + + final GoogleSignInAuthentication googleAuth = + await googleUser.authentication; + + final credential = GoogleAuthProvider.credential( + accessToken: googleAuth.accessToken, + idToken: googleAuth.idToken, + ); + await _firebaseAuth.signInWithCredential(credential); } } catch (e) { log('Google sign-in error: $e'); From c9221e45f65b35d8d5b265d3f243b1867a78508a Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Thu, 23 Apr 2026 13:37:08 +0700 Subject: [PATCH 11/19] byuh --- lib/core/utils/time_series_mapper.dart | 26 ++++++++++++++----- .../wind_speed/blocs/wind_speed_bloc.dart | 11 +++++--- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/lib/core/utils/time_series_mapper.dart b/lib/core/utils/time_series_mapper.dart index 5cc4ac0..3133012 100644 --- a/lib/core/utils/time_series_mapper.dart +++ b/lib/core/utils/time_series_mapper.dart @@ -37,7 +37,9 @@ class TimeSeriesMapper { required double Function(T) getValue, }) { final now = DateTime.now(); - final slots = List.filled(7, 0.0); + + final sums = List.filled(7, 0.0); + final counts = List.filled(7, 0); DateTime startOfWeek = now.subtract(Duration(days: now.weekday - 1)); startOfWeek = @@ -47,11 +49,16 @@ class TimeSeriesMapper { final time = getTime(item); if (time.isAfter(startOfWeek)) { - slots[time.weekday - 1] = getValue(item); + final index = time.weekday - 1; + sums[index] += getValue(item); + counts[index]++; } } - return slots; + return List.generate(7, (i) { + if (counts[i] == 0) return 0; + return sums[i] / counts[i]; + }); } /// ========================= @@ -64,17 +71,24 @@ class TimeSeriesMapper { }) { final now = DateTime.now(); final daysInMonth = DateTime(now.year, now.month + 1, 0).day; - final slots = List.filled(daysInMonth, 0.0); + + final sums = List.filled(daysInMonth, 0.0); + final counts = List.filled(daysInMonth, 0); for (final item in data) { final time = getTime(item); if (time.month == now.month && time.year == now.year) { - slots[time.day - 1] = getValue(item); + final index = time.day - 1; + sums[index] += getValue(item); + counts[index]++; } } - return slots; + return List.generate(daysInMonth, (i) { + if (counts[i] == 0) return 0; + return sums[i] / counts[i]; + }); } /// ========================= diff --git a/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart b/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart index 7544b4e..27f633c 100644 --- a/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart +++ b/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart @@ -111,28 +111,31 @@ class WindSpeedBloc extends Bloc { final history = state.history; - List updatedGraph; + List raw; if (event.period == "Minggu Ini") { - updatedGraph = TimeSeriesMapper.toWeekly( + raw = TimeSeriesMapper.toWeekly( data: history, getTime: (e) => e.timestamp, getValue: (e) => e.speed, ); } else if (event.period == "Bulan Ini") { - updatedGraph = TimeSeriesMapper.toMonthly( + raw = TimeSeriesMapper.toMonthly( data: history, getTime: (e) => e.timestamp, getValue: (e) => e.speed, ); } else { - updatedGraph = TimeSeriesMapper.toDaily( + raw = TimeSeriesMapper.toDaily( data: history, getTime: (e) => e.timestamp, getValue: (e) => e.speed, ); } + /// 🔥 baru di-smooth + final updatedGraph = TimeSeriesMapper.smooth(raw); + emit(state.copyWith( dailySpeeds: updatedGraph, isLoading: false, From 4b01a7e41b6712de556b76b179bf1c00a5d73487 Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Thu, 23 Apr 2026 17:09:22 +0700 Subject: [PATCH 12/19] geloo --- .../widgets/wind_speed_chart_widget.dart | 60 +++++++++++++++++-- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/lib/screens/monitoring/wind_speed/views/widgets/wind_speed_chart_widget.dart b/lib/screens/monitoring/wind_speed/views/widgets/wind_speed_chart_widget.dart index 2310e44..1c2e6bb 100644 --- a/lib/screens/monitoring/wind_speed/views/widgets/wind_speed_chart_widget.dart +++ b/lib/screens/monitoring/wind_speed/views/widgets/wind_speed_chart_widget.dart @@ -10,8 +10,20 @@ class WindSpeedChartWidget extends StatelessWidget { const WindSpeedChartWidget( {super.key, required this.dailySpeeds, required this.period}); + double _getMaxY() { + if (dailySpeeds.isEmpty) return 10; + + final max = dailySpeeds.reduce((a, b) => a > b ? a : b); + + return (max + 5).clamp(10, 100); // kasih padding + } + @override Widget build(BuildContext context) { + final List safeData = dailySpeeds.map((e) { + if (e.isNaN || e.isInfinite) return 0.0; + return e < 0 ? 0.0 : e; + }).toList(); return Container( height: 270, padding: const EdgeInsets.fromLTRB(10, 20, 20, 10), @@ -27,9 +39,12 @@ class WindSpeedChartWidget extends StatelessWidget { ], ), child: LineChart( + duration: const Duration(milliseconds: 600), + curve: Curves.easeOutCubic, LineChartData( minY: 0, - maxY: 50, + + maxY: _getMaxY(), gridData: const FlGridData(show: false), borderData: FlBorderData(show: false), @@ -61,27 +76,60 @@ class WindSpeedChartWidget extends StatelessWidget { }))), lineBarsData: [ LineChartBarData( - spots: dailySpeeds.asMap().entries.map((e) { + spots: safeData.asMap().entries.map((e) { return FlSpot(e.key.toDouble(), e.value); }).toList(), isCurved: true, + curveSmoothness: 0.2, + preventCurveOverShooting: true, color: Colors.blue.shade700, - barWidth: 4, + barWidth: 3, isStrokeCapRound: true, - dotData: const FlDotData(show: false), + dotData: FlDotData( + show: true, + getDotPainter: (spot, percent, bar, index) { + if (index == dailySpeeds.length - 1) { + return FlDotCirclePainter( + radius: 5, + color: Colors.red, + strokeWidth: 2, + strokeColor: Colors.white, + ); + } + return FlDotCirclePainter(radius: 0); + }, + ), belowBarData: BarAreaData( show: true, gradient: LinearGradient( colors: [ - Colors.blue.withOpacity(0.3), - Colors.blue.withOpacity(0.0) + Colors.blue.withOpacity(0.35), + Colors.blue.withOpacity(0.1), + Colors.transparent ], begin: Alignment.topCenter, end: Alignment.bottomCenter, ), ), + shadow: Shadow( + color: Colors.blue.withOpacity(0.3), + blurRadius: 6, + ), ), ], + lineTouchData: LineTouchData( + handleBuiltInTouches: true, + touchTooltipData: LineTouchTooltipData( + getTooltipItems: (touchedSpots) { + return touchedSpots.map((spot) { + return LineTooltipItem( + "${spot.y.toStringAsFixed(1)} m/s", + const TextStyle(color: Colors.white), + ); + }).toList(); + }, + ), + ), ), ), ); From a08bb1e7109e83bca11c74422b108b8475d90858 Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Sat, 25 Apr 2026 07:28:05 +0700 Subject: [PATCH 13/19] joss banget anjing --- lib/main.dart | 2 + .../shared/dialogs/export_dialog.dart | 0 .../utils/pdf/atmospheric_pdf_builder.dart | 90 ++++++ .../utils/pdf/evaporasi_pdf_builder.dart | 85 ++++++ .../shared/utils/pdf/pdf_components.dart | 284 ++++++++++++++++++ .../shared/utils/pdf/pdf_export_service.dart | 62 ++++ .../utils/pdf/wind_speed_pdf_builder.dart | 110 +++++++ .../shared/widgets/export_pdf_button.dart | 130 ++++++++ .../wind_speed/blocs/wind_speed_bloc.dart | 30 +- .../wind_speed/blocs/wind_speed_state.dart | 10 +- .../wind_speed/views/wind_speed_screen.dart | 43 ++- linux/flutter/generated_plugin_registrant.cc | 4 + linux/flutter/generated_plugins.cmake | 1 + macos/Flutter/GeneratedPluginRegistrant.swift | 2 + pubspec.lock | 96 ++++++ pubspec.yaml | 2 + .../flutter/generated_plugin_registrant.cc | 3 + windows/flutter/generated_plugins.cmake | 1 + 18 files changed, 951 insertions(+), 4 deletions(-) create mode 100644 lib/screens/monitoring/shared/dialogs/export_dialog.dart create mode 100644 lib/screens/monitoring/shared/utils/pdf/atmospheric_pdf_builder.dart create mode 100644 lib/screens/monitoring/shared/utils/pdf/evaporasi_pdf_builder.dart create mode 100644 lib/screens/monitoring/shared/utils/pdf/pdf_components.dart create mode 100644 lib/screens/monitoring/shared/utils/pdf/pdf_export_service.dart create mode 100644 lib/screens/monitoring/shared/utils/pdf/wind_speed_pdf_builder.dart create mode 100644 lib/screens/monitoring/shared/widgets/export_pdf_button.dart diff --git a/lib/main.dart b/lib/main.dart index eb74045..f0093ed 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -6,12 +6,14 @@ import 'package:klimatologiot/app.dart'; import 'package:user_repository/user_repository.dart'; import 'package:monitoring_repository/monitoring_repository.dart'; import 'firebase_options.dart'; +import 'package:intl/date_symbol_data_local.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); + await initializeDateFormatting('id_ID', null); Bloc.observer = SimpleBlocObserver(); runApp(MyApp( FirebaseUserRepo(), diff --git a/lib/screens/monitoring/shared/dialogs/export_dialog.dart b/lib/screens/monitoring/shared/dialogs/export_dialog.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/screens/monitoring/shared/utils/pdf/atmospheric_pdf_builder.dart b/lib/screens/monitoring/shared/utils/pdf/atmospheric_pdf_builder.dart new file mode 100644 index 0000000..17116ea --- /dev/null +++ b/lib/screens/monitoring/shared/utils/pdf/atmospheric_pdf_builder.dart @@ -0,0 +1,90 @@ +import 'package:pdf/pdf.dart'; +import 'package:pdf/widgets.dart' as pw; +import 'package:printing/printing.dart'; +import 'pdf_components.dart'; + +/// ============================================================ +/// Atmospheric PDF Builder +/// Letakkan di: lib/screens/monitoring/shared/utils/pdf/atmospheric_pdf_builder.dart +/// ============================================================ + +Future exportAtmosphericPdf({ + required double temperature, + required double humidity, + required double pressure, + required double altitude, + required DateTime timestamp, + List>? historyData, +}) async { + final pdf = pw.Document(); + + pdf.addPage( + pw.MultiPage( + pageFormat: PdfPageFormat.a4, + margin: const pw.EdgeInsets.all(32), + header: (ctx) => buildPdfHeader('Laporan Kondisi Atmosfer', timestamp), + footer: (ctx) => buildPdfFooter(ctx), + build: (ctx) => [ + // — Summary card + buildSummaryCard( + title: 'Data Terkini', + subtitle: pdfFullFormat.format(timestamp), + items: [ + SummaryItem('Suhu', '${temperature.toStringAsFixed(1)} °C', '🌡️'), + SummaryItem('Kelembapan', '${humidity.toStringAsFixed(1)} %', '💧'), + SummaryItem('Tekanan', '${pressure.toStringAsFixed(1)} hPa', '🔵'), + SummaryItem('Ketinggian', '${altitude.toStringAsFixed(1)} m', '⛰️'), + ], + ), + pw.SizedBox(height: 24), + + // — Tabel key-value ringkasan + buildSectionTitle('Detail Parameter'), + pw.SizedBox(height: 8), + buildKeyValueTable([ + ['Parameter', 'Nilai', 'Satuan'], + ['Suhu', temperature.toStringAsFixed(1), '°C'], + ['Kelembapan', humidity.toStringAsFixed(1), '%'], + ['Tekanan Udara', pressure.toStringAsFixed(1), 'hPa'], + ['Ketinggian', altitude.toStringAsFixed(1), 'm'], + ]), + + // — Tabel history jika ada + if (historyData != null && historyData.isNotEmpty) ...[ + pw.SizedBox(height: 24), + buildSectionTitle('Riwayat Data'), + pw.SizedBox(height: 8), + _buildHistoryTable(historyData), + ], + ], + ), + ); + + await Printing.layoutPdf(onLayout: (_) => pdf.save()); +} + +pw.Widget _buildHistoryTable(List> data) { + return buildDataTable( + headers: ['No', 'Waktu', 'Suhu (°C)', 'Kelembapan (%)', 'Tekanan (hPa)', 'Ketinggian (m)'], + rows: data.asMap().entries.map((e) { + final d = e.value; + final ts = d['timestamp'] as DateTime?; + return [ + '${e.key + 1}', + ts != null ? pdfFullFormat.format(ts) : '-', + (d['temperature'] as double? ?? 0).toStringAsFixed(1), + (d['humidity'] as double? ?? 0).toStringAsFixed(1), + (d['pressure'] as double? ?? 0).toStringAsFixed(1), + (d['altitude'] as double? ?? 0).toStringAsFixed(1), + ]; + }).toList(), + colWidths: { + 0: const pw.FixedColumnWidth(25), + 1: const pw.FlexColumnWidth(2), + 2: const pw.FlexColumnWidth(1), + 3: const pw.FlexColumnWidth(1.2), + 4: const pw.FlexColumnWidth(1.2), + 5: const pw.FlexColumnWidth(1.2), + }, + ); +} diff --git a/lib/screens/monitoring/shared/utils/pdf/evaporasi_pdf_builder.dart b/lib/screens/monitoring/shared/utils/pdf/evaporasi_pdf_builder.dart new file mode 100644 index 0000000..0e7e460 --- /dev/null +++ b/lib/screens/monitoring/shared/utils/pdf/evaporasi_pdf_builder.dart @@ -0,0 +1,85 @@ +import 'package:pdf/pdf.dart'; +import 'package:pdf/widgets.dart' as pw; +import 'package:printing/printing.dart'; +import 'pdf_components.dart'; + +/// ============================================================ +/// Evaporasi PDF Builder +/// Letakkan di: lib/screens/monitoring/shared/utils/pdf/evaporasi_pdf_builder.dart +/// ============================================================ + +Future exportEvaporasiPdf({ + required double evaporasi, + required double suhu, + required double tinggiAir, + required DateTime timestamp, + List>? historyData, +}) async { + final pdf = pw.Document(); + + pdf.addPage( + pw.MultiPage( + pageFormat: PdfPageFormat.a4, + margin: const pw.EdgeInsets.all(32), + header: (ctx) => buildPdfHeader('Laporan Evaporasi', timestamp), + footer: (ctx) => buildPdfFooter(ctx), + build: (ctx) => [ + // — Summary card + buildSummaryCard( + title: 'Data Terkini', + subtitle: pdfFullFormat.format(timestamp), + items: [ + SummaryItem('Evaporasi', '${evaporasi.toStringAsFixed(2)} mm', '💧'), + SummaryItem('Suhu', '${suhu.toStringAsFixed(1)} °C', '🌡️'), + SummaryItem('Tinggi Air', '${tinggiAir.toStringAsFixed(1)} cm', '📏'), + ], + ), + pw.SizedBox(height: 24), + + // — Tabel key-value ringkasan + buildSectionTitle('Detail Parameter'), + pw.SizedBox(height: 8), + buildKeyValueTable([ + ['Parameter', 'Nilai', 'Satuan'], + ['Evaporasi', evaporasi.toStringAsFixed(2), 'mm'], + ['Suhu', suhu.toStringAsFixed(1), '°C'], + ['Tinggi Air', tinggiAir.toStringAsFixed(1), 'cm'], + ]), + + // — Tabel history jika ada + if (historyData != null && historyData.isNotEmpty) ...[ + pw.SizedBox(height: 24), + buildSectionTitle('Riwayat Data'), + pw.SizedBox(height: 8), + _buildHistoryTable(historyData), + ], + ], + ), + ); + + await Printing.layoutPdf(onLayout: (_) => pdf.save()); +} + +pw.Widget _buildHistoryTable(List> data) { + return buildDataTable( + headers: ['No', 'Waktu', 'Evaporasi (mm)', 'Suhu (°C)', 'Tinggi Air (cm)'], + rows: data.asMap().entries.map((e) { + final d = e.value; + final ts = d['timestamp'] as DateTime?; + return [ + '${e.key + 1}', + ts != null ? pdfFullFormat.format(ts) : '-', + (d['evaporasi'] as double? ?? 0).toStringAsFixed(2), + (d['suhu'] as double? ?? 0).toStringAsFixed(1), + (d['tinggiAir'] as double? ?? 0).toStringAsFixed(1), + ]; + }).toList(), + colWidths: { + 0: const pw.FixedColumnWidth(25), + 1: const pw.FlexColumnWidth(2), + 2: const pw.FlexColumnWidth(1.3), + 3: const pw.FlexColumnWidth(1), + 4: const pw.FlexColumnWidth(1.3), + }, + ); +} diff --git a/lib/screens/monitoring/shared/utils/pdf/pdf_components.dart b/lib/screens/monitoring/shared/utils/pdf/pdf_components.dart new file mode 100644 index 0000000..97f719e --- /dev/null +++ b/lib/screens/monitoring/shared/utils/pdf/pdf_components.dart @@ -0,0 +1,284 @@ +import 'package:pdf/pdf.dart'; +import 'package:pdf/widgets.dart' as pw; +import 'package:intl/intl.dart'; + +/// ============================================================ +/// PDF Components — Reusable builders +/// Letakkan di: lib/screens/monitoring/shared/utils/pdf/pdf_components.dart +/// ============================================================ + +// ─── Warna tema ─────────────────────────────────────────────── +const kPdfPrimary = PdfColor.fromInt(0xFF1565C0); +const kPdfAccent = PdfColor.fromInt(0xFF42A5F5); +const kPdfRowEven = PdfColor.fromInt(0xFFF5F9FF); +const kPdfBorder = PdfColor.fromInt(0xFFBBDEFB); + +// ─── Format tanggal ─────────────────────────────────────────── +final pdfDateFormat = DateFormat('dd MMMM yyyy', 'id_ID'); +final pdfTimeFormat = DateFormat('HH:mm:ss'); +final pdfFullFormat = DateFormat('dd MMM yyyy, HH:mm', 'id_ID'); + +// ================================================================ +// HEADER — muncul di setiap halaman +// ================================================================ +pw.Widget buildPdfHeader(String title, DateTime date) { + return pw.Container( + margin: const pw.EdgeInsets.only(bottom: 16), + decoration: const pw.BoxDecoration( + border: pw.Border( + bottom: pw.BorderSide(color: kPdfBorder, width: 1.5), + ), + ), + child: pw.Row( + mainAxisAlignment: pw.MainAxisAlignment.spaceBetween, + children: [ + pw.Column( + crossAxisAlignment: pw.CrossAxisAlignment.start, + children: [ + pw.Text( + title, + style: pw.TextStyle( + fontSize: 18, + fontWeight: pw.FontWeight.bold, + color: kPdfPrimary, + ), + ), + pw.SizedBox(height: 2), + pw.Text( + 'Sistem Monitoring Klimatologi', + style: pw.TextStyle(fontSize: 10, color: PdfColors.grey600), + ), + ], + ), + pw.Column( + crossAxisAlignment: pw.CrossAxisAlignment.end, + children: [ + pw.Text( + pdfDateFormat.format(date), + style: pw.TextStyle( + fontSize: 10, + fontWeight: pw.FontWeight.bold, + color: kPdfPrimary, + ), + ), + pw.Text( + pdfTimeFormat.format(date), + style: pw.TextStyle(fontSize: 9, color: PdfColors.grey600), + ), + ], + ), + ], + ), + ); +} + +// ================================================================ +// FOOTER — muncul di setiap halaman +// ================================================================ +pw.Widget buildPdfFooter(pw.Context context) { + return pw.Container( + margin: const pw.EdgeInsets.only(top: 12), + decoration: const pw.BoxDecoration( + border: pw.Border(top: pw.BorderSide(color: kPdfBorder, width: 1)), + ), + child: pw.Padding( + padding: const pw.EdgeInsets.only(top: 6), + child: pw.Row( + mainAxisAlignment: pw.MainAxisAlignment.spaceBetween, + children: [ + pw.Text( + 'Digenerate otomatis oleh Aplikasi Klimatologi', + style: pw.TextStyle(fontSize: 8, color: PdfColors.grey500), + ), + pw.Text( + 'Halaman ${context.pageNumber} / ${context.pagesCount}', + style: pw.TextStyle(fontSize: 8, color: PdfColors.grey500), + ), + ], + ), + ), + ); +} + +// ================================================================ +// SECTION TITLE — judul bagian dengan background biru +// ================================================================ +pw.Widget buildSectionTitle(String title) { + return pw.Container( + padding: const pw.EdgeInsets.symmetric(vertical: 6, horizontal: 10), + decoration: const pw.BoxDecoration( + color: kPdfPrimary, + borderRadius: pw.BorderRadius.all(pw.Radius.circular(4)), + ), + child: pw.Text( + title, + style: pw.TextStyle( + fontSize: 12, + fontWeight: pw.FontWeight.bold, + color: PdfColors.white, + ), + ), + ); +} + +// ================================================================ +// SUMMARY CARD — grid kartu nilai terkini +// ================================================================ +pw.Widget buildSummaryCard({ + required String title, + required String subtitle, + required List items, +}) { + return pw.Container( + padding: const pw.EdgeInsets.all(16), + decoration: pw.BoxDecoration( + color: const PdfColor.fromInt(0xFFE3F2FD), + borderRadius: const pw.BorderRadius.all(pw.Radius.circular(8)), + border: pw.Border.all(color: kPdfBorder), + ), + child: pw.Column( + crossAxisAlignment: pw.CrossAxisAlignment.start, + children: [ + pw.Text( + title, + style: pw.TextStyle( + fontSize: 13, + fontWeight: pw.FontWeight.bold, + color: kPdfPrimary, + ), + ), + pw.Text( + subtitle, + style: pw.TextStyle(fontSize: 9, color: PdfColors.grey600), + ), + pw.SizedBox(height: 12), + pw.Wrap( + spacing: 12, + runSpacing: 8, + children: items.map((item) => _summaryItemCard(item)).toList(), + ), + ], + ), + ); +} + +pw.Widget _summaryItemCard(SummaryItem item) { + return pw.Container( + width: 200, + padding: const pw.EdgeInsets.symmetric(vertical: 8, horizontal: 12), + decoration: pw.BoxDecoration( + color: PdfColors.white, + borderRadius: const pw.BorderRadius.all(pw.Radius.circular(6)), + border: pw.Border.all(color: kPdfBorder), + ), + child: pw.Row( + children: [ + pw.Text(item.emoji, style: const pw.TextStyle(fontSize: 18)), + pw.SizedBox(width: 8), + pw.Column( + crossAxisAlignment: pw.CrossAxisAlignment.start, + children: [ + pw.Text( + item.label, + style: pw.TextStyle(fontSize: 9, color: PdfColors.grey600), + ), + pw.Text( + item.value, + style: pw.TextStyle( + fontSize: 14, + fontWeight: pw.FontWeight.bold, + color: kPdfPrimary, + ), + ), + ], + ), + ], + ), + ); +} + +// ================================================================ +// BASE TABLE — semua tabel pakai ini +// ================================================================ +pw.Widget buildDataTable({ + required List headers, + required List> rows, + Map? colWidths, +}) { + return pw.Table( + border: pw.TableBorder.all(color: kPdfBorder, width: 0.5), + columnWidths: colWidths, + children: [ + // Header + pw.TableRow( + decoration: const pw.BoxDecoration(color: kPdfPrimary), + children: headers + .map((h) => pw.Padding( + padding: const pw.EdgeInsets.symmetric( + vertical: 7, horizontal: 8), + child: pw.Text( + h, + style: pw.TextStyle( + fontSize: 9, + fontWeight: pw.FontWeight.bold, + color: PdfColors.white, + ), + ), + )) + .toList(), + ), + // Data rows + ...rows.asMap().entries.map((entry) { + final isEven = entry.key % 2 == 0; + return pw.TableRow( + decoration: pw.BoxDecoration( + color: isEven ? kPdfRowEven : PdfColors.white, + ), + children: entry.value + .map((cell) => pw.Padding( + padding: const pw.EdgeInsets.symmetric( + vertical: 5, horizontal: 8), + child: pw.Text(cell, + style: const pw.TextStyle(fontSize: 9)), + )) + .toList(), + ); + }), + ], + ); +} + +// ================================================================ +// KEY-VALUE TABLE — tabel 3 kolom: Parameter | Nilai | Satuan +// ================================================================ +pw.Widget buildKeyValueTable(List> rows) { + return buildDataTable( + headers: rows.first, + rows: rows.skip(1).toList(), + colWidths: { + 0: const pw.FlexColumnWidth(2), + 1: const pw.FlexColumnWidth(1.5), + 2: const pw.FlexColumnWidth(1), + }, + ); +} + +// ================================================================ +// HELPER CLASS +// ================================================================ +class SummaryItem { + final String label; + final String value; + final String emoji; + const SummaryItem(this.label, this.value, this.emoji); +} + +// ================================================================ +// STATS HELPER +// ================================================================ +Map calcStats(List data) { + if (data.isEmpty) return {'avg': 0, 'max': 0, 'min': 0}; + final sorted = List.from(data)..sort(); + final avg = data.reduce((a, b) => a + b) / data.length; + return {'avg': avg, 'max': sorted.last, 'min': sorted.first}; +} diff --git a/lib/screens/monitoring/shared/utils/pdf/pdf_export_service.dart b/lib/screens/monitoring/shared/utils/pdf/pdf_export_service.dart new file mode 100644 index 0000000..9f22e35 --- /dev/null +++ b/lib/screens/monitoring/shared/utils/pdf/pdf_export_service.dart @@ -0,0 +1,62 @@ +import 'atmospheric_pdf_builder.dart'; +import 'evaporasi_pdf_builder.dart'; +import 'wind_speed_pdf_builder.dart'; + +/// ============================================================ +/// PDF Export Service — Entry Point +/// Letakkan di: lib/screens/monitoring/shared/utils/pdf/pdf_export_service.dart +/// +/// Ini cuma facade — semua logic ada di builder masing-masing. +/// Import file ini saja di screen kamu. +/// ============================================================ + +class PdfExportService { + PdfExportService._(); // tidak bisa di-instantiate + + static Future atmospheric({ + required double temperature, + required double humidity, + required double pressure, + required double altitude, + required DateTime timestamp, + List>? historyData, + }) => + exportAtmosphericPdf( + temperature: temperature, + humidity: humidity, + pressure: pressure, + altitude: altitude, + timestamp: timestamp, + historyData: historyData, + ); + + static Future evaporasi({ + required double evaporasi, + required double suhu, + required double tinggiAir, + required DateTime timestamp, + List>? historyData, + }) => + exportEvaporasiPdf( + evaporasi: evaporasi, + suhu: suhu, + tinggiAir: tinggiAir, + timestamp: timestamp, + historyData: historyData, + ); + + static Future windSpeed({ + required double currentSpeed, + required String period, + required List speeds, + required DateTime timestamp, + List>? historyData, + }) => + exportWindSpeedPdf( + currentSpeed: currentSpeed, + period: period, + speeds: speeds, + timestamp: timestamp, + historyData: historyData, + ); +} diff --git a/lib/screens/monitoring/shared/utils/pdf/wind_speed_pdf_builder.dart b/lib/screens/monitoring/shared/utils/pdf/wind_speed_pdf_builder.dart new file mode 100644 index 0000000..1abb06b --- /dev/null +++ b/lib/screens/monitoring/shared/utils/pdf/wind_speed_pdf_builder.dart @@ -0,0 +1,110 @@ +import 'package:pdf/pdf.dart'; +import 'package:pdf/widgets.dart' as pw; +import 'package:printing/printing.dart'; +import 'pdf_components.dart'; + +/// ============================================================ +/// Wind Speed PDF Builder +/// Letakkan di: lib/screens/monitoring/shared/utils/pdf/wind_speed_pdf_builder.dart +/// ============================================================ + +Future exportWindSpeedPdf({ + required double currentSpeed, + required String period, + required List speeds, + required DateTime timestamp, + List>? historyData, +}) async { + final pdf = pw.Document(); + final stats = calcStats(speeds); + + pdf.addPage( + pw.MultiPage( + pageFormat: PdfPageFormat.a4, + margin: const pw.EdgeInsets.all(32), + header: (ctx) => buildPdfHeader('Laporan Kecepatan Angin', timestamp), + footer: (ctx) => buildPdfFooter(ctx), + build: (ctx) => [ + // — Summary card + buildSummaryCard( + title: 'Data Terkini', + subtitle: 'Periode: $period', + items: [ + SummaryItem('Kecepatan', '${currentSpeed.toStringAsFixed(1)} m/s', '💨'), + SummaryItem('Rata-rata', '${stats['avg']!.toStringAsFixed(1)} m/s', '📊'), + SummaryItem('Maksimum', '${stats['max']!.toStringAsFixed(1)} m/s', '⬆️'), + SummaryItem('Minimum', '${stats['min']!.toStringAsFixed(1)} m/s', '⬇️'), + ], + ), + pw.SizedBox(height: 24), + + // — Tabel data per periode + if (speeds.isNotEmpty) ...[ + buildSectionTitle('Data Periode ($period)'), + pw.SizedBox(height: 8), + _buildPeriodTable(speeds, period), + ], + + // — Tabel history jika ada + if (historyData != null && historyData.isNotEmpty) ...[ + pw.SizedBox(height: 24), + buildSectionTitle('Riwayat Detail'), + pw.SizedBox(height: 8), + _buildHistoryTable(historyData), + ], + ], + ), + ); + + await Printing.layoutPdf(onLayout: (_) => pdf.save()); +} + +pw.Widget _buildPeriodTable(List speeds, String period) { + final labels = _periodLabels(speeds.length, period); + return buildDataTable( + headers: ['No', 'Label', 'Kecepatan (m/s)'], + rows: speeds.asMap().entries.map((e) => [ + '${e.key + 1}', + labels[e.key], + e.value.toStringAsFixed(2), + ]).toList(), + colWidths: { + 0: const pw.FixedColumnWidth(30), + 1: const pw.FlexColumnWidth(2), + 2: const pw.FlexColumnWidth(1.5), + }, + ); +} + +pw.Widget _buildHistoryTable(List> data) { + return buildDataTable( + headers: ['No', 'Waktu', 'Kecepatan (m/s)', 'Pulse'], + rows: data.asMap().entries.map((e) { + final d = e.value; + final ts = d['timestamp'] as DateTime?; + return [ + '${e.key + 1}', + ts != null ? pdfFullFormat.format(ts) : '-', + (d['speed'] as double? ?? 0).toStringAsFixed(2), + '${d['pulse'] ?? 0}', + ]; + }).toList(), + colWidths: { + 0: const pw.FixedColumnWidth(25), + 1: const pw.FlexColumnWidth(2.5), + 2: const pw.FlexColumnWidth(1.5), + 3: const pw.FlexColumnWidth(1), + }, + ); +} + +List _periodLabels(int count, String period) { + if (period == 'Hari Ini') { + return List.generate(count, (i) => 'Jam ${i.toString().padLeft(2, '0')}:00'); + } else if (period == 'Minggu Ini') { + const days = ['Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab', 'Min']; + return List.generate(count, (i) => days[i % 7]); + } else { + return List.generate(count, (i) => 'Minggu ${i + 1}'); + } +} diff --git a/lib/screens/monitoring/shared/widgets/export_pdf_button.dart b/lib/screens/monitoring/shared/widgets/export_pdf_button.dart new file mode 100644 index 0000000..5e8f69a --- /dev/null +++ b/lib/screens/monitoring/shared/widgets/export_pdf_button.dart @@ -0,0 +1,130 @@ +import 'package:flutter/material.dart'; + +/// ============================================================ +/// Export PDF Button — Reusable Widget +/// Letakkan di: lib/screens/monitoring/shared/widgets/export_pdf_button.dart +/// ============================================================ +/// +/// Cara pakai (contoh di WindSpeedScreen): +/// +/// ExportPdfButton( +/// onExport: () async { +/// await PdfExportService.exportWindSpeedPdf( +/// currentSpeed: state.currentSpeed, +/// period: state.selectedPeriod, +/// speeds: data, +/// timestamp: DateTime.now(), +/// ); +/// }, +/// ) + +class ExportPdfButton extends StatefulWidget { + /// Callback async yang memanggil PdfExportService + final Future Function() onExport; + + /// Label tombol (default: "Export PDF") + final String label; + + /// Style: FAB (floating) atau ElevatedButton (inline) + final ExportButtonStyle style; + + const ExportPdfButton({ + super.key, + required this.onExport, + this.label = 'Export PDF', + this.style = ExportButtonStyle.elevated, + }); + + @override + State createState() => _ExportPdfButtonState(); +} + +class _ExportPdfButtonState extends State { + bool _isLoading = false; + + Future _handleExport() async { + if (_isLoading) return; + setState(() => _isLoading = true); + + try { + await widget.onExport(); + } catch (e) { + if (mounted) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('Gagal export PDF: $e'), + backgroundColor: Colors.red.shade600, + ), + ); + } + } finally { + if (mounted) setState(() => _isLoading = false); + } + } + + @override + Widget build(BuildContext context) { + return widget.style == ExportButtonStyle.fab + ? _buildFab() + : _buildElevated(); + } + + // — FAB style (floating action button) + Widget _buildFab() { + return FloatingActionButton.extended( + onPressed: _isLoading ? null : _handleExport, + backgroundColor: Colors.blue.shade700, + icon: _isLoading + ? const SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator( + strokeWidth: 2, + color: Colors.white, + ), + ) + : const Icon(Icons.picture_as_pdf, color: Colors.white), + label: Text( + _isLoading ? 'Menyiapkan...' : widget.label, + style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + ), + ); + } + + // — Elevated button style (inline di dalam konten) + Widget _buildElevated() { + return SizedBox( + width: double.infinity, + child: ElevatedButton.icon( + onPressed: _isLoading ? null : _handleExport, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.blue.shade700, + padding: const EdgeInsets.symmetric(vertical: 14), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + ), + icon: _isLoading + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator( + strokeWidth: 2, + color: Colors.white, + ), + ) + : const Icon(Icons.picture_as_pdf, color: Colors.white), + label: Text( + _isLoading ? 'Menyiapkan PDF...' : widget.label, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15, + ), + ), + ), + ); + } +} + +enum ExportButtonStyle { fab, elevated } diff --git a/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart b/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart index 27f633c..4b01e41 100644 --- a/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart +++ b/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart @@ -48,9 +48,35 @@ class WindSpeedBloc extends Bloc { ); final dailyGraph = TimeSeriesMapper.smooth(raw); + final daily = TimeSeriesMapper.smooth( + TimeSeriesMapper.toDaily( + data: history, + getTime: (e) => e.timestamp, + getValue: (e) => e.speed, + ), + ); + + final weekly = TimeSeriesMapper.smooth( + TimeSeriesMapper.toWeekly( + data: history, + getTime: (e) => e.timestamp, + getValue: (e) => e.speed, + ), + ); + + final monthly = TimeSeriesMapper.smooth( + TimeSeriesMapper.toMonthly( + data: history, + getTime: (e) => e.timestamp, + getValue: (e) => e.speed, + ), + ); + emit(state.copyWith( history: history, dailySpeeds: dailyGraph, + weeklySpeeds: weekly, + monthlySpeeds: monthly, isLoading: false, )); @@ -91,7 +117,7 @@ class WindSpeedBloc extends Bloc { } } - updated[index] = newValue; + updated[index] = newValue.clamp(0, 100); } emit(state.copyWith( @@ -107,7 +133,7 @@ class WindSpeedBloc extends Bloc { WindSpeedPeriodChanged event, Emitter emit, ) async { - emit(state.copyWith(isLoading: true, selectedPeriod: event.period)); + emit(state.copyWith(selectedPeriod: event.period)); final history = state.history; diff --git a/lib/screens/monitoring/wind_speed/blocs/wind_speed_state.dart b/lib/screens/monitoring/wind_speed/blocs/wind_speed_state.dart index becd2e4..3276997 100644 --- a/lib/screens/monitoring/wind_speed/blocs/wind_speed_state.dart +++ b/lib/screens/monitoring/wind_speed/blocs/wind_speed_state.dart @@ -3,7 +3,9 @@ part of 'wind_speed_bloc.dart'; class WindSpeedState extends Equatable { final double currentSpeed; final String selectedPeriod; - final List dailySpeeds; // Untuk grafik + final List dailySpeeds; + final List weeklySpeeds; + final List monthlySpeeds; final bool isLoading; final List history; @@ -13,12 +15,16 @@ class WindSpeedState extends Equatable { this.dailySpeeds = const [], this.isLoading = true, this.history = const [], + this.monthlySpeeds = const [], + this.weeklySpeeds = const [], }); WindSpeedState copyWith({ double? currentSpeed, String? selectedPeriod, List? dailySpeeds, + List? weeklySpeeds, + List? monthlySpeeds, bool? isLoading, List? history, }) { @@ -26,6 +32,8 @@ class WindSpeedState extends Equatable { currentSpeed: currentSpeed ?? this.currentSpeed, selectedPeriod: selectedPeriod ?? this.selectedPeriod, dailySpeeds: dailySpeeds ?? this.dailySpeeds, + weeklySpeeds: weeklySpeeds ?? this.weeklySpeeds, + monthlySpeeds: monthlySpeeds ?? this.monthlySpeeds, isLoading: isLoading ?? this.isLoading, history: history ?? this.history, ); diff --git a/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart b/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart index c80a830..d24c2f4 100644 --- a/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart +++ b/lib/screens/monitoring/wind_speed/views/wind_speed_screen.dart @@ -5,6 +5,9 @@ import '../blocs/wind_speed_bloc.dart'; import './widgets/wind_speed_chart_widget.dart'; import 'widgets/period_selector.dart'; +import '../../shared/utils/pdf/pdf_export_service.dart'; +import '../../shared/widgets/export_pdf_button.dart'; + class WindSpeedScreen extends StatelessWidget { const WindSpeedScreen({super.key}); @@ -30,6 +33,32 @@ class WindSpeedScreen extends StatelessWidget { return const Center(child: CircularProgressIndicator()); } + // Pilih data sesuai periode + final List data = switch (state.selectedPeriod) { + "Minggu Ini" => state.weeklySpeeds, + "Bulan Ini" => state.monthlySpeeds, + _ => state.dailySpeeds, + }; + + // List data; + + // if (state.selectedPeriod == "Minggu Ini") { + // data = state.weeklySpeeds; + // } else if (state.selectedPeriod == "Bulan Ini") { + // data = state.monthlySpeeds; + // } else { + // data = state.dailySpeeds; + // } + + // Konversi history MyWindSpeed → Map (untuk tabel PDF) + final historyMaps = state.history + .map((e) => { + 'timestamp': e.timestamp, + 'speed': e.speed, + 'pulse': e.pulse, + }) + .toList(); + return SingleChildScrollView( padding: const EdgeInsets.all(20.0), child: Column( @@ -46,7 +75,7 @@ class WindSpeedScreen extends StatelessWidget { const SizedBox(height: 15), WindSpeedChartWidget( - dailySpeeds: state.dailySpeeds, + dailySpeeds: data, period: state.selectedPeriod, ), @@ -54,6 +83,18 @@ class WindSpeedScreen extends StatelessWidget { // 3. Info Tambahan (Status/Periode) _buildDetailRow(state.selectedPeriod), + const SizedBox(height: 24), + + // ← Tombol Export PDF + ExportPdfButton( + onExport: () => PdfExportService.windSpeed( + currentSpeed: state.currentSpeed, + period: state.selectedPeriod, + speeds: data, + timestamp: DateTime.now(), + historyData: historyMaps.isNotEmpty ? historyMaps : null, + ), + ), ], ), ); diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index e71a16d..ce0e550 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -6,6 +6,10 @@ #include "generated_plugin_registrant.h" +#include void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) printing_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "PrintingPlugin"); + printing_plugin_register_with_registrar(printing_registrar); } diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index be1ee3e..fd82dd7 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + printing ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 608950e..bf298b9 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -10,6 +10,7 @@ import firebase_auth import firebase_core import firebase_database import google_sign_in_ios +import printing func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin")) @@ -17,4 +18,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) FLTFirebaseDatabasePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseDatabasePlugin")) FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin")) + PrintingPlugin.register(with: registry.registrar(forPlugin: "PrintingPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index 1b69af3..2a56299 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -9,6 +9,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.66" + archive: + dependency: transitive + description: + name: archive + sha256: a96e8b390886ee8abb49b7bd3ac8df6f451c621619f52a26e815fdcf568959ff + url: "https://pub.dev" + source: hosted + version: "4.0.9" args: dependency: transitive description: @@ -25,6 +33,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.13.0" + barcode: + dependency: transitive + description: + name: barcode + sha256: "7b6729c37e3b7f34233e2318d866e8c48ddb46c1f7ad01ff7bb2a8de1da2b9f4" + url: "https://pub.dev" + source: hosted + version: "2.2.9" + bidi: + dependency: transitive + description: + name: bidi + sha256: "77f475165e94b261745cf1032c751e2032b8ed92ccb2bf5716036db79320637d" + url: "https://pub.dev" + source: hosted + version: "2.0.13" bloc: dependency: "direct main" description: @@ -352,6 +376,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.2" + image: + dependency: transitive + description: + name: image + sha256: f9881ff4998044947ec38d098bc7c8316ae1186fa786eddffdb867b9bc94dfce + url: "https://pub.dev" + source: hosted + version: "4.8.0" intl: dependency: "direct main" description: @@ -487,6 +519,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.1" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" + url: "https://pub.dev" + source: hosted + version: "1.1.0" path_provider: dependency: transitive description: @@ -535,6 +575,30 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.0" + pdf: + dependency: "direct main" + description: + name: pdf + sha256: e47a275b267873d5944ad5f5ff0dcc7ac2e36c02b3046a0ffac9b72fd362c44b + url: "https://pub.dev" + source: hosted + version: "3.12.0" + pdf_widget_wrapper: + dependency: transitive + description: + name: pdf_widget_wrapper + sha256: c930860d987213a3d58c7ec3b7ecf8085c3897f773e8dc23da9cae60a5d6d0f5 + url: "https://pub.dev" + source: hosted + version: "1.0.4" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675" + url: "https://pub.dev" + source: hosted + version: "7.0.2" platform: dependency: transitive description: @@ -551,6 +615,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" + posix: + dependency: transitive + description: + name: posix + sha256: "185ef7606574f789b40f289c233efa52e96dead518aed988e040a10737febb07" + url: "https://pub.dev" + source: hosted + version: "6.5.0" + printing: + dependency: "direct main" + description: + name: printing + sha256: "689170c9ddb1bda85826466ba80378aa8993486d3c959a71cd7d2d80cb606692" + url: "https://pub.dev" + source: hosted + version: "5.14.3" provider: dependency: transitive description: @@ -567,6 +647,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.0" + qr: + dependency: transitive + description: + name: qr + sha256: "5a1d2586170e172b8a8c8470bbbffd5eb0cd38a66c0d77155ea138d3af3a4445" + url: "https://pub.dev" + source: hosted + version: "3.0.2" rxdart: dependency: "direct main" description: @@ -683,6 +771,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025" + url: "https://pub.dev" + source: hosted + version: "6.6.1" yaml: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index fdfe240..8465d9f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,6 +25,8 @@ dependencies: rxdart: ^0.27.7 user_repository: path: packages/user_repository + pdf: ^3.11.1 + printing: ^5.13.1 dev_dependencies: flutter_lints: ^3.0.0 diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index bf6d21a..bd3cfd7 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -9,6 +9,7 @@ #include #include #include +#include void RegisterPlugins(flutter::PluginRegistry* registry) { CloudFirestorePluginCApiRegisterWithRegistrar( @@ -17,4 +18,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("FirebaseAuthPluginCApi")); FirebaseCorePluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); + PrintingPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("PrintingPlugin")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 37c2b78..879bac0 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST cloud_firestore firebase_auth firebase_core + printing ) list(APPEND FLUTTER_FFI_PLUGIN_LIST From cd26da3e884955d5d4b39b14cf7528fad895b876 Mon Sep 17 00:00:00 2001 From: Mochamad ongki ramadani Date: Sat, 25 Apr 2026 09:46:37 +0700 Subject: [PATCH 14/19] resolve conflict: keep deletion --- .../evaporasi_monitoring_screen.dart | 1047 +++++++++++++++++ 1 file changed, 1047 insertions(+) create mode 100644 lib/screens/monitoring/evaporasi_monitoring_screen.dart diff --git a/lib/screens/monitoring/evaporasi_monitoring_screen.dart b/lib/screens/monitoring/evaporasi_monitoring_screen.dart new file mode 100644 index 0000000..e78cb84 --- /dev/null +++ b/lib/screens/monitoring/evaporasi_monitoring_screen.dart @@ -0,0 +1,1047 @@ +import 'package:flutter/material.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:firebase_database/firebase_database.dart'; +import 'dart:async'; +import 'package:intl/intl.dart'; +import 'widgets/monitoring_shared.dart'; + +/// EVAPORASI MONITORING SCREEN +class EvaporasiMonitoringScreen extends StatefulWidget { + const EvaporasiMonitoringScreen({super.key}); + + @override + State createState() => + _EvaporasiMonitoringScreenState(); +} + +class _EvaporasiMonitoringScreenState extends State { + String _selectedPeriod = "Hari Ini"; + + final DatabaseReference _evaporationRef = + FirebaseDatabase.instance.ref('kelompok1/evaporasi'); + StreamSubscription? _evaporationSub; + + DateTime? _lastUpdateTime; + double _currentEvaporation = 0.0; + double _currentTemperature = 0.0; + double _currentWaterHeight = 0.0; + final List _dailyEvaporation = List.filled(24, 0.0); + double _hourlyTotal = 0.0; + int _hourlyCount = 0; + int _currentHour = DateTime.now().hour; + + bool get _isOnline { + if (_lastUpdateTime == null) return false; + final diff = DateTime.now().difference(_lastUpdateTime!); + return diff.inMinutes <= 5; + } + + @override + void initState() { + super.initState(); + _evaporationSub = _evaporationRef.onValue.listen(_onRealtimeData); + } + + @override + void dispose() { + _evaporationSub?.cancel(); + super.dispose(); + } + + void _onRealtimeData(DatabaseEvent event) { + final data = event.snapshot.value; + if (data is Map) { + final value = double.tryParse( + (data['evaporasi'] ?? data['nilai'] ?? 0).toString()) ?? + 0.0; + final temp = double.tryParse(data['suhu']?.toString() ?? '0') ?? 0.0; + final waterHeight = + double.tryParse(data['tinggi_air']?.toString() ?? '0') ?? 0.0; + final DateTime waktu; + + if (data.containsKey('timestamp')) { + final timestamp = + int.tryParse(data['timestamp']?.toString() ?? '0') ?? 0; + waktu = DateTime.fromMillisecondsSinceEpoch(timestamp * 1000); + } else { + final hour = int.tryParse(data['jam']?.toString() ?? '0') ?? 0; + final minute = int.tryParse(data['menit']?.toString() ?? '0') ?? 0; + final now = DateTime.now(); + waktu = DateTime(now.year, now.month, now.day, hour, minute); + } + + setState(() { + _currentEvaporation = value; + _currentTemperature = temp; + _currentWaterHeight = waterHeight; + _lastUpdateTime = waktu; + + final incomingHour = waktu.hour; + if (incomingHour != _currentHour) { + if (_hourlyCount > 0) { + _dailyEvaporation[_currentHour] = _hourlyTotal / _hourlyCount; + } + _hourlyTotal = 0.0; + _hourlyCount = 0; + _currentHour = incomingHour; + if (incomingHour == 0) { + for (int i = 0; i < 24; i++) { + _dailyEvaporation[i] = 0.0; + } + } + } + + _hourlyTotal += value; + _hourlyCount++; + _dailyEvaporation[incomingHour] = + _hourlyCount > 0 ? _hourlyTotal / _hourlyCount : value; + }); + } + } + + String _formatUpdateTime() { + if (_lastUpdateTime == null) return '-'; + return DateFormat('dd MMM yyyy • HH:mm').format(_lastUpdateTime!); + } + + bool get _hasRealtimeEvaporation => + _dailyEvaporation.any((value) => value > 0.0); + + Widget _buildDetailTile({ + required String label, + required String value, + required IconData icon, + required Color color, + }) { + return Expanded( + child: Container( + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + color: color.withOpacity(0.08), + borderRadius: BorderRadius.circular(12), + border: Border.all(color: color.withOpacity(0.2)), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon(icon, color: color, size: 16), + const SizedBox(width: 6), + Text( + label, + style: TextStyle( + fontSize: 11, + color: Colors.grey.shade700, + ), + ), + ], + ), + const SizedBox(height: 8), + Text( + value, + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + color: color, + ), + ), + ], + ), + ), + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text("Monitoring Evaporasi"), + centerTitle: true, + ), + body: Padding( + padding: const EdgeInsets.all(16), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + "Evaporasi", + style: TextStyle( + fontSize: 22, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 16), + if (_lastUpdateTime != null) + Card( + elevation: 2, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "${_currentEvaporation.toStringAsFixed(1)} mm", + style: const TextStyle( + fontSize: 28, + fontWeight: FontWeight.bold, + color: Colors.blue, + ), + ), + const SizedBox(height: 8), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + "Terakhir diperbarui", + style: TextStyle( + fontSize: 12, + color: Colors.grey, + ), + ), + const SizedBox(height: 4), + Text( + _formatUpdateTime(), + style: const TextStyle( + fontSize: 12, + color: Colors.black54, + ), + ), + ], + ), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), + decoration: BoxDecoration( + color: _isOnline + ? Colors.green.shade100 + : Colors.red.shade100, + borderRadius: BorderRadius.circular(20), + ), + child: Text( + _isOnline ? 'OFFLINE' : 'ONLINE', + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: _isOnline ? const Color.fromARGB(255, 175, 76, 76) : const Color.fromARGB(255, 89, 244, 54), + ), + ), + ), + ], + ), + ], + ), + ), + ), + const SizedBox(height: 12), + Card( + elevation: 2, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 16, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + 'Detail Sensor Evaporasi', + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 14), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + _buildDetailTile( + label: 'Jam', + value: DateFormat('HH:mm').format(_lastUpdateTime!), + icon: Icons.access_time, + color: Colors.blue, + ), + _buildDetailTile( + label: 'Suhu', + value: + '${_currentTemperature.toStringAsFixed(2)} °C', + icon: Icons.thermostat, + color: Colors.red, + ), + ], + ), + const SizedBox(height: 12), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + _buildDetailTile( + label: 'Tinggi Air', + value: '${_currentWaterHeight.toStringAsFixed(2)}', + icon: Icons.water_drop, + color: Colors.blueAccent, + ), + _buildDetailTile( + label: 'Evaporasi', + value: + '${_currentEvaporation.toStringAsFixed(1)} mm', + icon: Icons.opacity, + color: Colors.blue, + ), + ], + ), + ], + ), + ), + ), + const SizedBox(height: 20), + + /// SISTEM KONTROL AIR OTOMATIS + _buildAutomaticWaterControlSystem(), + const SizedBox(height: 25), + + /// GRAFIK MONITORING + _buildMonitoringGraphBlock(), + const SizedBox(height: 25), + + /// PENJELASAN + _buildMonitoringExplanation(), + const SizedBox(height: 25), + + /// STATISTIK TAHUNAN + _buildAnnualCombinedGraphSection(), + ], + ), + ), + ), + ); + } + + /// EXPORT FUNCTIONS + void _exportDailyData() { + final StringBuffer csvContent = StringBuffer(); + csvContent.writeln("DATA MONITORING EVAPORASI - HARIAN (24 JAM)"); + csvContent.writeln("Tanggal: ${DateTime.now().toString().split(' ')[0]}"); + csvContent.writeln(""); + csvContent.writeln("Jam,Nilai (mm)"); + + final dailyData = [ + 2.1, + 2.3, + 2.0, + 1.9, + 2.2, + 2.5, + 3.0, + 3.5, + 4.0, + 4.2, + 4.5, + 4.8, + 5.0, + 5.2, + 5.1, + 4.9, + 4.5, + 4.0, + 3.5, + 3.0, + 2.8, + 2.5, + 2.3, + 2.2 + ]; + for (int i = 0; i < dailyData.length; i++) { + csvContent.writeln("$i:00,${dailyData[i]}"); + } + + csvContent.writeln(""); + csvContent.writeln("Statistik Harian"); + csvContent.writeln("Total: 79.4 mm"); + csvContent.writeln("Rata-rata: 3.3 mm"); + csvContent.writeln("Maksimal: 5.2 mm"); + csvContent.writeln("Minimal: 1.9 mm"); + + showExportPreview(context, csvContent.toString(), "Data Harian"); + } + + void _exportWeeklyData() { + final StringBuffer csvContent = StringBuffer(); + csvContent.writeln("DATA MONITORING EVAPORASI - MINGGUAN"); + csvContent.writeln("Tanggal: ${DateTime.now().toString().split(' ')[0]}"); + csvContent.writeln(""); + csvContent.writeln("Hari,Nilai (mm)"); + + final days = [ + 'Senin', + 'Selasa', + 'Rabu', + 'Kamis', + 'Jumat', + 'Sabtu', + 'Minggu' + ]; + final weeklyData = [3.5, 3.8, 4.2, 4.5, 4.0, 3.8, 3.2]; + + for (int i = 0; i < days.length; i++) { + csvContent.writeln("${days[i]},${weeklyData[i]}"); + } + + csvContent.writeln(""); + csvContent.writeln("Statistik Mingguan"); + csvContent.writeln("Total: 27.0 mm"); + csvContent.writeln("Rata-rata: 3.86 mm"); + csvContent.writeln("Maksimal: 4.5 mm"); + csvContent.writeln("Minimal: 3.2 mm"); + + showExportPreview(context, csvContent.toString(), "Data Mingguan"); + } + + void _exportMonthlyData() { + final StringBuffer csvContent = StringBuffer(); + csvContent.writeln("DATA MONITORING EVAPORASI - BULANAN"); + csvContent.writeln( + "Bulan: ${DateTime.now().toString().split(' ')[0].substring(0, 7)}"); + csvContent.writeln(""); + csvContent.writeln("Tanggal,Nilai (mm)"); + + for (int i = 1; i <= 28; i++) { + final value = (3.0 + (i % 6) * 0.5).toStringAsFixed(1); + csvContent.writeln("$i,$value"); + } + + csvContent.writeln(""); + csvContent.writeln("Statistik Bulanan"); + csvContent.writeln("Total: 99.2 mm"); + csvContent.writeln("Rata-rata: 3.54 mm"); + csvContent.writeln("Maksimal: 5.0 mm"); + csvContent.writeln("Minimal: 2.5 mm"); + + showExportPreview(context, csvContent.toString(), "Data Bulanan"); + } + + void _exportAnnualData() { + final StringBuffer csvContent = StringBuffer(); + csvContent.writeln("DATA MONITORING EVAPORASI - TAHUNAN"); + csvContent.writeln("Tahun: 2025"); + csvContent.writeln(""); + csvContent.writeln("Bulan,Pengisian (x),Rata-rata (mm)"); + + final months = [ + 'Januari', + 'Februari', + 'Maret', + 'April', + 'Mei', + 'Juni', + 'Juli', + 'Agustus', + 'September', + 'Oktober', + 'November', + 'Desember' + ]; + final fillings = [12, 13, 15, 14, 13, 12, 14, 16, 13, 14, 15, 13]; + final averages = [ + 3.5, + 3.8, + 4.2, + 4.5, + 5.0, + 5.2, + 5.5, + 5.8, + 5.0, + 4.5, + 4.0, + 3.7 + ]; + + for (int i = 0; i < months.length; i++) { + csvContent.writeln("${months[i]},${fillings[i]},${averages[i]}"); + } + + csvContent.writeln(""); + csvContent.writeln("STATISTIK TAHUNAN"); + csvContent.writeln("Total Pengisian: 156x"); + csvContent.writeln("Rata-rata Evaporasi: 4.4 mm"); + csvContent.writeln("Total Evaporasi: 52.8 mm"); + + showExportPreview(context, csvContent.toString(), "Data Tahunan"); + } + + /// DATA GENERATORS + List _getEvaporationPeriodData() { + switch (_selectedPeriod) { + case "Hari Ini": + if (_hasRealtimeEvaporation) { + return List.generate( + _dailyEvaporation.length, + (index) => FlSpot(index.toDouble(), _dailyEvaporation[index]), + ); + } + return List.generate(24, (index) => FlSpot(index.toDouble(), 0.0)); + case "Minggu Ini": + return List.generate(7, (index) => FlSpot(index.toDouble(), 0.0)); + case "Bulan Ini": + return List.generate(12, (index) => FlSpot(index.toDouble(), 0.0)); + default: + return []; + } + } + + /// UI BUILDERS + Widget _buildAutomaticWaterControlSystem() { + bool isActive = DateTime.now().hour >= 6 && DateTime.now().hour < 7; + + return Container( + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: Colors.grey.shade50, + borderRadius: BorderRadius.circular(12), + border: Border.all(color: Colors.grey.shade300), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + "Sistem Kontrol Air Otomatis", + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 12), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + "Jadwal Operasional", + style: TextStyle( + fontSize: 12, + color: Colors.grey, + ), + ), + const SizedBox(height: 4), + const Text( + "06.00 - 07.00 WIB", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 10, + ), + decoration: BoxDecoration( + color: isActive ? Colors.blue : Colors.grey.shade300, + borderRadius: BorderRadius.circular(20), + ), + child: Text( + isActive ? "AKTIF" : "TIDAK AKTIF", + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: isActive ? Colors.white : Colors.grey.shade700, + ), + ), + ), + ], + ), + const SizedBox(height: 12), + Container( + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.blue.shade50, + borderRadius: BorderRadius.circular(8), + ), + child: const Text( + "Sistem otomatis akan mengisi air pada waktu yang telah ditentukan untuk menjaga tingkat evaporasi pada level optimal.", + style: TextStyle( + fontSize: 11, + color: Colors.blue, + height: 1.5, + ), + ), + ), + ], + ), + ); + } + + Widget _buildMonitoringGraphBlock() { + return Card( + elevation: 4, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const Text( + "Status Evaporasi", + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + ), + ), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), + decoration: BoxDecoration( + color: Colors.amber.shade100, + borderRadius: BorderRadius.circular(20), + ), + child: const Text( + "Normal", + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Colors.amber, + ), + ), + ), + ], + ), + const SizedBox(height: 16), + + /// PERIOD SELECTOR + EXPORT + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: + ["Hari Ini", "Minggu Ini", "Bulan Ini"].map((period) { + return Padding( + padding: const EdgeInsets.only(right: 8), + child: ChoiceChip( + label: Text(period), + selected: _selectedPeriod == period, + onSelected: (selected) { + setState(() { + _selectedPeriod = period; + }); + }, + selectedColor: Colors.blue, + labelStyle: TextStyle( + color: _selectedPeriod == period + ? Colors.white + : Colors.black, + ), + ), + ); + }).toList(), + ), + ), + ), + const SizedBox(width: 8), + ElevatedButton.icon( + onPressed: () { + if (_selectedPeriod == "Hari Ini") { + _exportDailyData(); + } else if (_selectedPeriod == "Minggu Ini") { + _exportWeeklyData(); + } else if (_selectedPeriod == "Bulan Ini") { + _exportMonthlyData(); + } + }, + icon: const Icon(Icons.download, size: 16), + label: const Text("Export"), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.orange, + foregroundColor: Colors.white, + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 6, + ), + textStyle: const TextStyle(fontSize: 11), + ), + ), + ], + ), + const SizedBox(height: 16), + + /// GRAPH + SizedBox( + height: 300, + child: LineChart( + LineChartData( + gridData: FlGridData( + show: true, + drawHorizontalLine: true, + drawVerticalLine: false, + horizontalInterval: 1, + getDrawingHorizontalLine: (value) { + return FlLine( + color: Colors.grey.shade300, + strokeWidth: 1, + ); + }, + ), + titlesData: FlTitlesData( + show: true, + bottomTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + interval: getPeriodInterval(_selectedPeriod), + getTitlesWidget: (value, meta) { + return Text( + getPeriodLabel(_selectedPeriod, value), + style: const TextStyle( + fontSize: 10, + color: Colors.grey, + ), + ); + }, + ), + ), + leftTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + interval: 1, + getTitlesWidget: (value, meta) { + return Text( + value.toInt().toString(), + style: const TextStyle( + fontSize: 9, + color: Colors.grey, + ), + ); + }, + reservedSize: 28, + ), + ), + topTitles: AxisTitles( + sideTitles: SideTitles(showTitles: false), + ), + rightTitles: AxisTitles( + sideTitles: SideTitles(showTitles: false), + ), + ), + borderData: FlBorderData( + show: true, + border: Border( + left: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + ), + ), + lineBarsData: [ + LineChartBarData( + spots: _getEvaporationPeriodData(), + isCurved: true, + barWidth: 2.5, + dotData: FlDotData( + show: true, + getDotPainter: (spot, percent, barData, index) { + return FlDotCirclePainter( + radius: 4, + color: Colors.blue, + strokeWidth: 0, + ); + }, + ), + color: Colors.blue, + belowBarData: BarAreaData( + show: true, + color: Colors.blue.withOpacity(0.1), + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + } + + Widget _buildMonitoringExplanation() { + return Container( + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: Colors.blue.shade50, + borderRadius: BorderRadius.circular(12), + border: Border.all(color: Colors.blue.shade200), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + "Penjelasan Evaporasi", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.blue, + ), + ), + const SizedBox(height: 10), + const Text( + "Evaporasi adalah proses penguapan air dari permukaan tanah atau air menuju atmosfer. Tingkat evaporasi dipengaruhi oleh suhu, kelembaban udara, kecepatan angin, dan intensitas cahaya matahari. Data ini penting untuk manajemen irigasi dan perencanaan kebutuhan air.", + style: TextStyle( + fontSize: 12, + height: 1.6, + color: Colors.blue, + ), + ), + ], + ), + ); + } + + Widget _buildAnnualCombinedGraphSection() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + "Statistik Tahunan & Rata-rata", + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 15), + + /// STATS + Row( + children: [ + Expanded( + child: StatCard( + title: "Total Pengisian", + value: "156x", + color: Colors.blue, + icon: Icons.water_drop, + ), + ), + const SizedBox(width: 10), + Expanded( + child: StatCard( + title: "Rata-rata", + value: "4.2 mm", + color: Colors.green, + icon: Icons.trending_up, + ), + ), + ], + ), + const SizedBox(height: 20), + + /// CHART + const Text( + "Grafik Tahunan - Pengisian Air & Rata-rata Evaporasi", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 12), + Card( + elevation: 3, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + children: [ + SizedBox( + height: 320, + child: BarChart( + BarChartData( + gridData: FlGridData( + show: true, + drawHorizontalLine: true, + drawVerticalLine: false, + horizontalInterval: 2, + getDrawingHorizontalLine: (value) { + return FlLine( + color: Colors.grey.shade300, + strokeWidth: 1, + ); + }, + ), + titlesData: FlTitlesData( + show: true, + bottomTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + getTitlesWidget: (value, meta) { + final months = [ + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'Mei', + 'Jun', + 'Jul', + 'Agu', + 'Sep', + 'Okt', + 'Nov', + 'Des' + ]; + return Text( + months[value.toInt()], + style: const TextStyle( + fontSize: 10, + color: Colors.grey, + ), + ); + }, + reservedSize: 30, + ), + ), + leftTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + getTitlesWidget: (value, meta) { + return Text( + value.toInt().toString(), + style: const TextStyle( + fontSize: 9, + color: Colors.grey, + ), + ); + }, + reservedSize: 28, + ), + ), + rightTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + getTitlesWidget: (value, meta) { + return Text( + '${value.toInt()} mm', + style: const TextStyle( + fontSize: 9, + color: Colors.green, + ), + ); + }, + reservedSize: 45, + ), + ), + topTitles: AxisTitles( + sideTitles: SideTitles(showTitles: false), + ), + ), + borderData: FlBorderData( + show: true, + border: Border( + left: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + right: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + ), + ), + barGroups: List.generate( + 12, + (index) => buildBarGroup(index, 0), + ), + rangeAnnotations: RangeAnnotations( + horizontalRangeAnnotations: [ + HorizontalRangeAnnotation( + y1: 3.5, + y2: 5.8, + color: Colors.green.withOpacity(0.1), + ), + ], + ), + ), + ), + ), + const SizedBox(height: 20), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: 16, + height: 16, + decoration: BoxDecoration( + color: Colors.blue, + borderRadius: BorderRadius.circular(3), + ), + ), + const SizedBox(width: 8), + const Text( + "Pengisian Air (kali)", + style: TextStyle(fontSize: 12), + ), + const SizedBox(width: 20), + Container( + width: 16, + height: 16, + decoration: BoxDecoration( + color: Colors.green.withOpacity(0.3), + borderRadius: BorderRadius.circular(3), + ), + ), + const SizedBox(width: 8), + const Text( + "Area Rata-rata (mm)", + style: TextStyle(fontSize: 12), + ), + ], + ), + ], + ), + ), + ), + const SizedBox(height: 15), + Center( + child: ElevatedButton.icon( + onPressed: () => _exportAnnualData(), + icon: const Icon(Icons.file_download), + label: const Text("Download Excel Tahunan"), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.green, + foregroundColor: Colors.white, + ), + ), + ), + ], + ); + } +} From aea8a7ca6fb03ba763271c1c4877e4f3162eeac8 Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Sat, 25 Apr 2026 11:48:09 +0700 Subject: [PATCH 15/19] joss --- .../views/atmospheric_screen.dart | 16 ++++++++++++++ .../evaporasi/views/evaporasi_screen.dart | 21 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart b/lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart index 611e602..da77570 100644 --- a/lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart +++ b/lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import '../blocs/atmospheric_conditions_bloc.dart'; +import '../../shared/utils/pdf/pdf_export_service.dart'; +import '../../shared/widgets/export_pdf_button.dart'; class AtmosphericScreen extends StatelessWidget { const AtmosphericScreen({super.key}); @@ -32,6 +34,20 @@ class AtmosphericScreen extends StatelessWidget { _mainTemperature(state), const SizedBox(height: 25), _gridInfo(state), + const SizedBox(height: 25), + + // ← Tombol Export PDF + ExportPdfButton( + onExport: () => PdfExportService.atmospheric( + temperature: state.temperature, + humidity: state.humidity, + pressure: state.pressure, + altitude: state.altitude, + timestamp: DateTime.now(), + // atmospheric state belum punya history, + // kalau nanti ditambah tinggal isi historyData di sini + ), + ), ], ), ); diff --git a/lib/screens/monitoring/evaporasi/views/evaporasi_screen.dart b/lib/screens/monitoring/evaporasi/views/evaporasi_screen.dart index a8214f4..e0e33d4 100644 --- a/lib/screens/monitoring/evaporasi/views/evaporasi_screen.dart +++ b/lib/screens/monitoring/evaporasi/views/evaporasi_screen.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import '../blocs/evaporasi_bloc.dart'; +import '../../shared/utils/pdf/pdf_export_service.dart'; +import '../../shared/widgets/export_pdf_button.dart'; class EvaporasiScreen extends StatelessWidget { const EvaporasiScreen({super.key}); @@ -25,6 +27,15 @@ class EvaporasiScreen extends StatelessWidget { return const Center(child: CircularProgressIndicator()); } + final historyMaps = state.history + .map((e) => { + 'timestamp': e.timestamp, + 'evaporasi': e.evaporasi, + 'suhu': e.suhu, + 'tinggiAir': e.tinggiAir, + }) + .toList(); + return SingleChildScrollView( padding: const EdgeInsets.all(20), child: Column( @@ -34,6 +45,16 @@ class EvaporasiScreen extends StatelessWidget { _infoRow(state), const SizedBox(height: 25), _trendSection(), + const SizedBox(height: 25), + ExportPdfButton( + onExport: () => PdfExportService.evaporasi( + evaporasi: state.currentValue, + suhu: state.temperature, + tinggiAir: state.waterLevel, + timestamp: DateTime.now(), + historyData: historyMaps.isNotEmpty ? historyMaps : null, + ), + ), ], ), ); From f51c40c668f3a78c7fde497a44fface1cca1f3cc Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Sat, 25 Apr 2026 11:49:46 +0700 Subject: [PATCH 16/19] joss --- .../atmospheric_conditions/views/atmospheric_screen.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart b/lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart index da77570..54ce2ac 100644 --- a/lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart +++ b/lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart @@ -56,6 +56,8 @@ class AtmosphericScreen extends StatelessWidget { ); } +// asdakksdlnadnansnknladnsn sjknakjdnjsna + /// ========================= /// 🌡️ TEMPERATURE (HERO CARD) /// ========================= From e9775b8b1453db415006d6cd0f4b5ec3e61a185f Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Sat, 25 Apr 2026 11:52:40 +0700 Subject: [PATCH 17/19] oke --- .../views/atmospheric_screen.dart | 2 - .../evaporasi_monitoring_screen.dart | 1047 ----------------- 2 files changed, 1049 deletions(-) delete mode 100644 lib/screens/monitoring/evaporasi_monitoring_screen.dart diff --git a/lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart b/lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart index 54ce2ac..da77570 100644 --- a/lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart +++ b/lib/screens/monitoring/atmospheric_conditions/views/atmospheric_screen.dart @@ -56,8 +56,6 @@ class AtmosphericScreen extends StatelessWidget { ); } -// asdakksdlnadnansnknladnsn sjknakjdnjsna - /// ========================= /// 🌡️ TEMPERATURE (HERO CARD) /// ========================= diff --git a/lib/screens/monitoring/evaporasi_monitoring_screen.dart b/lib/screens/monitoring/evaporasi_monitoring_screen.dart deleted file mode 100644 index e78cb84..0000000 --- a/lib/screens/monitoring/evaporasi_monitoring_screen.dart +++ /dev/null @@ -1,1047 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:fl_chart/fl_chart.dart'; -import 'package:firebase_database/firebase_database.dart'; -import 'dart:async'; -import 'package:intl/intl.dart'; -import 'widgets/monitoring_shared.dart'; - -/// EVAPORASI MONITORING SCREEN -class EvaporasiMonitoringScreen extends StatefulWidget { - const EvaporasiMonitoringScreen({super.key}); - - @override - State createState() => - _EvaporasiMonitoringScreenState(); -} - -class _EvaporasiMonitoringScreenState extends State { - String _selectedPeriod = "Hari Ini"; - - final DatabaseReference _evaporationRef = - FirebaseDatabase.instance.ref('kelompok1/evaporasi'); - StreamSubscription? _evaporationSub; - - DateTime? _lastUpdateTime; - double _currentEvaporation = 0.0; - double _currentTemperature = 0.0; - double _currentWaterHeight = 0.0; - final List _dailyEvaporation = List.filled(24, 0.0); - double _hourlyTotal = 0.0; - int _hourlyCount = 0; - int _currentHour = DateTime.now().hour; - - bool get _isOnline { - if (_lastUpdateTime == null) return false; - final diff = DateTime.now().difference(_lastUpdateTime!); - return diff.inMinutes <= 5; - } - - @override - void initState() { - super.initState(); - _evaporationSub = _evaporationRef.onValue.listen(_onRealtimeData); - } - - @override - void dispose() { - _evaporationSub?.cancel(); - super.dispose(); - } - - void _onRealtimeData(DatabaseEvent event) { - final data = event.snapshot.value; - if (data is Map) { - final value = double.tryParse( - (data['evaporasi'] ?? data['nilai'] ?? 0).toString()) ?? - 0.0; - final temp = double.tryParse(data['suhu']?.toString() ?? '0') ?? 0.0; - final waterHeight = - double.tryParse(data['tinggi_air']?.toString() ?? '0') ?? 0.0; - final DateTime waktu; - - if (data.containsKey('timestamp')) { - final timestamp = - int.tryParse(data['timestamp']?.toString() ?? '0') ?? 0; - waktu = DateTime.fromMillisecondsSinceEpoch(timestamp * 1000); - } else { - final hour = int.tryParse(data['jam']?.toString() ?? '0') ?? 0; - final minute = int.tryParse(data['menit']?.toString() ?? '0') ?? 0; - final now = DateTime.now(); - waktu = DateTime(now.year, now.month, now.day, hour, minute); - } - - setState(() { - _currentEvaporation = value; - _currentTemperature = temp; - _currentWaterHeight = waterHeight; - _lastUpdateTime = waktu; - - final incomingHour = waktu.hour; - if (incomingHour != _currentHour) { - if (_hourlyCount > 0) { - _dailyEvaporation[_currentHour] = _hourlyTotal / _hourlyCount; - } - _hourlyTotal = 0.0; - _hourlyCount = 0; - _currentHour = incomingHour; - if (incomingHour == 0) { - for (int i = 0; i < 24; i++) { - _dailyEvaporation[i] = 0.0; - } - } - } - - _hourlyTotal += value; - _hourlyCount++; - _dailyEvaporation[incomingHour] = - _hourlyCount > 0 ? _hourlyTotal / _hourlyCount : value; - }); - } - } - - String _formatUpdateTime() { - if (_lastUpdateTime == null) return '-'; - return DateFormat('dd MMM yyyy • HH:mm').format(_lastUpdateTime!); - } - - bool get _hasRealtimeEvaporation => - _dailyEvaporation.any((value) => value > 0.0); - - Widget _buildDetailTile({ - required String label, - required String value, - required IconData icon, - required Color color, - }) { - return Expanded( - child: Container( - padding: const EdgeInsets.all(12), - decoration: BoxDecoration( - color: color.withOpacity(0.08), - borderRadius: BorderRadius.circular(12), - border: Border.all(color: color.withOpacity(0.2)), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon(icon, color: color, size: 16), - const SizedBox(width: 6), - Text( - label, - style: TextStyle( - fontSize: 11, - color: Colors.grey.shade700, - ), - ), - ], - ), - const SizedBox(height: 8), - Text( - value, - style: TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - color: color, - ), - ), - ], - ), - ), - ); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text("Monitoring Evaporasi"), - centerTitle: true, - ), - body: Padding( - padding: const EdgeInsets.all(16), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - "Evaporasi", - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 16), - if (_lastUpdateTime != null) - Card( - elevation: 2, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "${_currentEvaporation.toStringAsFixed(1)} mm", - style: const TextStyle( - fontSize: 28, - fontWeight: FontWeight.bold, - color: Colors.blue, - ), - ), - const SizedBox(height: 8), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - "Terakhir diperbarui", - style: TextStyle( - fontSize: 12, - color: Colors.grey, - ), - ), - const SizedBox(height: 4), - Text( - _formatUpdateTime(), - style: const TextStyle( - fontSize: 12, - color: Colors.black54, - ), - ), - ], - ), - Container( - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, - ), - decoration: BoxDecoration( - color: _isOnline - ? Colors.green.shade100 - : Colors.red.shade100, - borderRadius: BorderRadius.circular(20), - ), - child: Text( - _isOnline ? 'OFFLINE' : 'ONLINE', - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: _isOnline ? const Color.fromARGB(255, 175, 76, 76) : const Color.fromARGB(255, 89, 244, 54), - ), - ), - ), - ], - ), - ], - ), - ), - ), - const SizedBox(height: 12), - Card( - elevation: 2, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 16, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - 'Detail Sensor Evaporasi', - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 14), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - _buildDetailTile( - label: 'Jam', - value: DateFormat('HH:mm').format(_lastUpdateTime!), - icon: Icons.access_time, - color: Colors.blue, - ), - _buildDetailTile( - label: 'Suhu', - value: - '${_currentTemperature.toStringAsFixed(2)} °C', - icon: Icons.thermostat, - color: Colors.red, - ), - ], - ), - const SizedBox(height: 12), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - _buildDetailTile( - label: 'Tinggi Air', - value: '${_currentWaterHeight.toStringAsFixed(2)}', - icon: Icons.water_drop, - color: Colors.blueAccent, - ), - _buildDetailTile( - label: 'Evaporasi', - value: - '${_currentEvaporation.toStringAsFixed(1)} mm', - icon: Icons.opacity, - color: Colors.blue, - ), - ], - ), - ], - ), - ), - ), - const SizedBox(height: 20), - - /// SISTEM KONTROL AIR OTOMATIS - _buildAutomaticWaterControlSystem(), - const SizedBox(height: 25), - - /// GRAFIK MONITORING - _buildMonitoringGraphBlock(), - const SizedBox(height: 25), - - /// PENJELASAN - _buildMonitoringExplanation(), - const SizedBox(height: 25), - - /// STATISTIK TAHUNAN - _buildAnnualCombinedGraphSection(), - ], - ), - ), - ), - ); - } - - /// EXPORT FUNCTIONS - void _exportDailyData() { - final StringBuffer csvContent = StringBuffer(); - csvContent.writeln("DATA MONITORING EVAPORASI - HARIAN (24 JAM)"); - csvContent.writeln("Tanggal: ${DateTime.now().toString().split(' ')[0]}"); - csvContent.writeln(""); - csvContent.writeln("Jam,Nilai (mm)"); - - final dailyData = [ - 2.1, - 2.3, - 2.0, - 1.9, - 2.2, - 2.5, - 3.0, - 3.5, - 4.0, - 4.2, - 4.5, - 4.8, - 5.0, - 5.2, - 5.1, - 4.9, - 4.5, - 4.0, - 3.5, - 3.0, - 2.8, - 2.5, - 2.3, - 2.2 - ]; - for (int i = 0; i < dailyData.length; i++) { - csvContent.writeln("$i:00,${dailyData[i]}"); - } - - csvContent.writeln(""); - csvContent.writeln("Statistik Harian"); - csvContent.writeln("Total: 79.4 mm"); - csvContent.writeln("Rata-rata: 3.3 mm"); - csvContent.writeln("Maksimal: 5.2 mm"); - csvContent.writeln("Minimal: 1.9 mm"); - - showExportPreview(context, csvContent.toString(), "Data Harian"); - } - - void _exportWeeklyData() { - final StringBuffer csvContent = StringBuffer(); - csvContent.writeln("DATA MONITORING EVAPORASI - MINGGUAN"); - csvContent.writeln("Tanggal: ${DateTime.now().toString().split(' ')[0]}"); - csvContent.writeln(""); - csvContent.writeln("Hari,Nilai (mm)"); - - final days = [ - 'Senin', - 'Selasa', - 'Rabu', - 'Kamis', - 'Jumat', - 'Sabtu', - 'Minggu' - ]; - final weeklyData = [3.5, 3.8, 4.2, 4.5, 4.0, 3.8, 3.2]; - - for (int i = 0; i < days.length; i++) { - csvContent.writeln("${days[i]},${weeklyData[i]}"); - } - - csvContent.writeln(""); - csvContent.writeln("Statistik Mingguan"); - csvContent.writeln("Total: 27.0 mm"); - csvContent.writeln("Rata-rata: 3.86 mm"); - csvContent.writeln("Maksimal: 4.5 mm"); - csvContent.writeln("Minimal: 3.2 mm"); - - showExportPreview(context, csvContent.toString(), "Data Mingguan"); - } - - void _exportMonthlyData() { - final StringBuffer csvContent = StringBuffer(); - csvContent.writeln("DATA MONITORING EVAPORASI - BULANAN"); - csvContent.writeln( - "Bulan: ${DateTime.now().toString().split(' ')[0].substring(0, 7)}"); - csvContent.writeln(""); - csvContent.writeln("Tanggal,Nilai (mm)"); - - for (int i = 1; i <= 28; i++) { - final value = (3.0 + (i % 6) * 0.5).toStringAsFixed(1); - csvContent.writeln("$i,$value"); - } - - csvContent.writeln(""); - csvContent.writeln("Statistik Bulanan"); - csvContent.writeln("Total: 99.2 mm"); - csvContent.writeln("Rata-rata: 3.54 mm"); - csvContent.writeln("Maksimal: 5.0 mm"); - csvContent.writeln("Minimal: 2.5 mm"); - - showExportPreview(context, csvContent.toString(), "Data Bulanan"); - } - - void _exportAnnualData() { - final StringBuffer csvContent = StringBuffer(); - csvContent.writeln("DATA MONITORING EVAPORASI - TAHUNAN"); - csvContent.writeln("Tahun: 2025"); - csvContent.writeln(""); - csvContent.writeln("Bulan,Pengisian (x),Rata-rata (mm)"); - - final months = [ - 'Januari', - 'Februari', - 'Maret', - 'April', - 'Mei', - 'Juni', - 'Juli', - 'Agustus', - 'September', - 'Oktober', - 'November', - 'Desember' - ]; - final fillings = [12, 13, 15, 14, 13, 12, 14, 16, 13, 14, 15, 13]; - final averages = [ - 3.5, - 3.8, - 4.2, - 4.5, - 5.0, - 5.2, - 5.5, - 5.8, - 5.0, - 4.5, - 4.0, - 3.7 - ]; - - for (int i = 0; i < months.length; i++) { - csvContent.writeln("${months[i]},${fillings[i]},${averages[i]}"); - } - - csvContent.writeln(""); - csvContent.writeln("STATISTIK TAHUNAN"); - csvContent.writeln("Total Pengisian: 156x"); - csvContent.writeln("Rata-rata Evaporasi: 4.4 mm"); - csvContent.writeln("Total Evaporasi: 52.8 mm"); - - showExportPreview(context, csvContent.toString(), "Data Tahunan"); - } - - /// DATA GENERATORS - List _getEvaporationPeriodData() { - switch (_selectedPeriod) { - case "Hari Ini": - if (_hasRealtimeEvaporation) { - return List.generate( - _dailyEvaporation.length, - (index) => FlSpot(index.toDouble(), _dailyEvaporation[index]), - ); - } - return List.generate(24, (index) => FlSpot(index.toDouble(), 0.0)); - case "Minggu Ini": - return List.generate(7, (index) => FlSpot(index.toDouble(), 0.0)); - case "Bulan Ini": - return List.generate(12, (index) => FlSpot(index.toDouble(), 0.0)); - default: - return []; - } - } - - /// UI BUILDERS - Widget _buildAutomaticWaterControlSystem() { - bool isActive = DateTime.now().hour >= 6 && DateTime.now().hour < 7; - - return Container( - padding: const EdgeInsets.all(16), - decoration: BoxDecoration( - color: Colors.grey.shade50, - borderRadius: BorderRadius.circular(12), - border: Border.all(color: Colors.grey.shade300), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - "Sistem Kontrol Air Otomatis", - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 12), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - "Jadwal Operasional", - style: TextStyle( - fontSize: 12, - color: Colors.grey, - ), - ), - const SizedBox(height: 4), - const Text( - "06.00 - 07.00 WIB", - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - ), - ), - ], - ), - Container( - padding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 10, - ), - decoration: BoxDecoration( - color: isActive ? Colors.blue : Colors.grey.shade300, - borderRadius: BorderRadius.circular(20), - ), - child: Text( - isActive ? "AKTIF" : "TIDAK AKTIF", - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: isActive ? Colors.white : Colors.grey.shade700, - ), - ), - ), - ], - ), - const SizedBox(height: 12), - Container( - padding: const EdgeInsets.all(10), - decoration: BoxDecoration( - color: Colors.blue.shade50, - borderRadius: BorderRadius.circular(8), - ), - child: const Text( - "Sistem otomatis akan mengisi air pada waktu yang telah ditentukan untuk menjaga tingkat evaporasi pada level optimal.", - style: TextStyle( - fontSize: 11, - color: Colors.blue, - height: 1.5, - ), - ), - ), - ], - ), - ); - } - - Widget _buildMonitoringGraphBlock() { - return Card( - elevation: 4, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Text( - "Status Evaporasi", - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, - ), - ), - Container( - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, - ), - decoration: BoxDecoration( - color: Colors.amber.shade100, - borderRadius: BorderRadius.circular(20), - ), - child: const Text( - "Normal", - style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.w600, - color: Colors.amber, - ), - ), - ), - ], - ), - const SizedBox(height: 16), - - /// PERIOD SELECTOR + EXPORT - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - children: - ["Hari Ini", "Minggu Ini", "Bulan Ini"].map((period) { - return Padding( - padding: const EdgeInsets.only(right: 8), - child: ChoiceChip( - label: Text(period), - selected: _selectedPeriod == period, - onSelected: (selected) { - setState(() { - _selectedPeriod = period; - }); - }, - selectedColor: Colors.blue, - labelStyle: TextStyle( - color: _selectedPeriod == period - ? Colors.white - : Colors.black, - ), - ), - ); - }).toList(), - ), - ), - ), - const SizedBox(width: 8), - ElevatedButton.icon( - onPressed: () { - if (_selectedPeriod == "Hari Ini") { - _exportDailyData(); - } else if (_selectedPeriod == "Minggu Ini") { - _exportWeeklyData(); - } else if (_selectedPeriod == "Bulan Ini") { - _exportMonthlyData(); - } - }, - icon: const Icon(Icons.download, size: 16), - label: const Text("Export"), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.orange, - foregroundColor: Colors.white, - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 6, - ), - textStyle: const TextStyle(fontSize: 11), - ), - ), - ], - ), - const SizedBox(height: 16), - - /// GRAPH - SizedBox( - height: 300, - child: LineChart( - LineChartData( - gridData: FlGridData( - show: true, - drawHorizontalLine: true, - drawVerticalLine: false, - horizontalInterval: 1, - getDrawingHorizontalLine: (value) { - return FlLine( - color: Colors.grey.shade300, - strokeWidth: 1, - ); - }, - ), - titlesData: FlTitlesData( - show: true, - bottomTitles: AxisTitles( - sideTitles: SideTitles( - showTitles: true, - interval: getPeriodInterval(_selectedPeriod), - getTitlesWidget: (value, meta) { - return Text( - getPeriodLabel(_selectedPeriod, value), - style: const TextStyle( - fontSize: 10, - color: Colors.grey, - ), - ); - }, - ), - ), - leftTitles: AxisTitles( - sideTitles: SideTitles( - showTitles: true, - interval: 1, - getTitlesWidget: (value, meta) { - return Text( - value.toInt().toString(), - style: const TextStyle( - fontSize: 9, - color: Colors.grey, - ), - ); - }, - reservedSize: 28, - ), - ), - topTitles: AxisTitles( - sideTitles: SideTitles(showTitles: false), - ), - rightTitles: AxisTitles( - sideTitles: SideTitles(showTitles: false), - ), - ), - borderData: FlBorderData( - show: true, - border: Border( - left: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - bottom: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - ), - lineBarsData: [ - LineChartBarData( - spots: _getEvaporationPeriodData(), - isCurved: true, - barWidth: 2.5, - dotData: FlDotData( - show: true, - getDotPainter: (spot, percent, barData, index) { - return FlDotCirclePainter( - radius: 4, - color: Colors.blue, - strokeWidth: 0, - ); - }, - ), - color: Colors.blue, - belowBarData: BarAreaData( - show: true, - color: Colors.blue.withOpacity(0.1), - ), - ), - ], - ), - ), - ), - ], - ), - ), - ); - } - - Widget _buildMonitoringExplanation() { - return Container( - padding: const EdgeInsets.all(16), - decoration: BoxDecoration( - color: Colors.blue.shade50, - borderRadius: BorderRadius.circular(12), - border: Border.all(color: Colors.blue.shade200), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - "Penjelasan Evaporasi", - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - color: Colors.blue, - ), - ), - const SizedBox(height: 10), - const Text( - "Evaporasi adalah proses penguapan air dari permukaan tanah atau air menuju atmosfer. Tingkat evaporasi dipengaruhi oleh suhu, kelembaban udara, kecepatan angin, dan intensitas cahaya matahari. Data ini penting untuk manajemen irigasi dan perencanaan kebutuhan air.", - style: TextStyle( - fontSize: 12, - height: 1.6, - color: Colors.blue, - ), - ), - ], - ), - ); - } - - Widget _buildAnnualCombinedGraphSection() { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text( - "Statistik Tahunan & Rata-rata", - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 15), - - /// STATS - Row( - children: [ - Expanded( - child: StatCard( - title: "Total Pengisian", - value: "156x", - color: Colors.blue, - icon: Icons.water_drop, - ), - ), - const SizedBox(width: 10), - Expanded( - child: StatCard( - title: "Rata-rata", - value: "4.2 mm", - color: Colors.green, - icon: Icons.trending_up, - ), - ), - ], - ), - const SizedBox(height: 20), - - /// CHART - const Text( - "Grafik Tahunan - Pengisian Air & Rata-rata Evaporasi", - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - ), - ), - const SizedBox(height: 12), - Card( - elevation: 3, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - children: [ - SizedBox( - height: 320, - child: BarChart( - BarChartData( - gridData: FlGridData( - show: true, - drawHorizontalLine: true, - drawVerticalLine: false, - horizontalInterval: 2, - getDrawingHorizontalLine: (value) { - return FlLine( - color: Colors.grey.shade300, - strokeWidth: 1, - ); - }, - ), - titlesData: FlTitlesData( - show: true, - bottomTitles: AxisTitles( - sideTitles: SideTitles( - showTitles: true, - getTitlesWidget: (value, meta) { - final months = [ - 'Jan', - 'Feb', - 'Mar', - 'Apr', - 'Mei', - 'Jun', - 'Jul', - 'Agu', - 'Sep', - 'Okt', - 'Nov', - 'Des' - ]; - return Text( - months[value.toInt()], - style: const TextStyle( - fontSize: 10, - color: Colors.grey, - ), - ); - }, - reservedSize: 30, - ), - ), - leftTitles: AxisTitles( - sideTitles: SideTitles( - showTitles: true, - getTitlesWidget: (value, meta) { - return Text( - value.toInt().toString(), - style: const TextStyle( - fontSize: 9, - color: Colors.grey, - ), - ); - }, - reservedSize: 28, - ), - ), - rightTitles: AxisTitles( - sideTitles: SideTitles( - showTitles: true, - getTitlesWidget: (value, meta) { - return Text( - '${value.toInt()} mm', - style: const TextStyle( - fontSize: 9, - color: Colors.green, - ), - ); - }, - reservedSize: 45, - ), - ), - topTitles: AxisTitles( - sideTitles: SideTitles(showTitles: false), - ), - ), - borderData: FlBorderData( - show: true, - border: Border( - left: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - bottom: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - right: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - ), - barGroups: List.generate( - 12, - (index) => buildBarGroup(index, 0), - ), - rangeAnnotations: RangeAnnotations( - horizontalRangeAnnotations: [ - HorizontalRangeAnnotation( - y1: 3.5, - y2: 5.8, - color: Colors.green.withOpacity(0.1), - ), - ], - ), - ), - ), - ), - const SizedBox(height: 20), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - width: 16, - height: 16, - decoration: BoxDecoration( - color: Colors.blue, - borderRadius: BorderRadius.circular(3), - ), - ), - const SizedBox(width: 8), - const Text( - "Pengisian Air (kali)", - style: TextStyle(fontSize: 12), - ), - const SizedBox(width: 20), - Container( - width: 16, - height: 16, - decoration: BoxDecoration( - color: Colors.green.withOpacity(0.3), - borderRadius: BorderRadius.circular(3), - ), - ), - const SizedBox(width: 8), - const Text( - "Area Rata-rata (mm)", - style: TextStyle(fontSize: 12), - ), - ], - ), - ], - ), - ), - ), - const SizedBox(height: 15), - Center( - child: ElevatedButton.icon( - onPressed: () => _exportAnnualData(), - icon: const Icon(Icons.file_download), - label: const Text("Download Excel Tahunan"), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.green, - foregroundColor: Colors.white, - ), - ), - ), - ], - ); - } -} From 89d638ee6d1d388e2976c2b4198f07ce585cee81 Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Sat, 25 Apr 2026 12:34:44 +0700 Subject: [PATCH 18/19] ooke --- .../lib/src/models/evaporasi.dart | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/monitoring_repository/lib/src/models/evaporasi.dart b/packages/monitoring_repository/lib/src/models/evaporasi.dart index da56dd1..907cbc5 100644 --- a/packages/monitoring_repository/lib/src/models/evaporasi.dart +++ b/packages/monitoring_repository/lib/src/models/evaporasi.dart @@ -19,18 +19,27 @@ class Evaporasi { ); factory Evaporasi.fromJson(Map json) { - final int jam = (json['jam'] ?? 0) as int; - final int menit = (json['menit'] ?? 0) as int; - final now = DateTime.now(); + DateTime timestamp = now; + + final waktuStr = json['waktu'] as String?; + if (waktuStr != null) { + final parts = waktuStr.split(':'); + if (parts.length >= 2) { + final jam = int.tryParse(parts[0]) ?? 0; + final menit = int.tryParse(parts[1]) ?? 0; + final detik = parts.length >= 3 ? (int.tryParse(parts[2]) ?? 0) : 0; + timestamp = DateTime(now.year, now.month, now.day, jam, menit, detik); + } + } return Evaporasi( evaporasi: (json['evaporasi'] ?? 0).toDouble(), - suhu: (json['suhu'] ?? 0).toDouble(), + suhu: (json['suhu_air'] ?? 0).toDouble(), tinggiAir: (json['tinggi_air'] ?? 0).toDouble(), /// 🔥 bikin timestamp dari jam & menit - timestamp: DateTime(now.year, now.month, now.day, jam, menit), + timestamp: timestamp, ); } } From c540f8276122b7739d5b2f6dc33ad0eba9467705 Mon Sep 17 00:00:00 2001 From: kleponijo <158453666+kleponijo@users.noreply.github.com> Date: Sat, 25 Apr 2026 13:03:01 +0700 Subject: [PATCH 19/19] oke --- lib/screens/monitoring/evaporasi/blocs/evaporasi_bloc.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/screens/monitoring/evaporasi/blocs/evaporasi_bloc.dart b/lib/screens/monitoring/evaporasi/blocs/evaporasi_bloc.dart index a785d90..1e49412 100644 --- a/lib/screens/monitoring/evaporasi/blocs/evaporasi_bloc.dart +++ b/lib/screens/monitoring/evaporasi/blocs/evaporasi_bloc.dart @@ -50,7 +50,7 @@ class EvaporasiBloc extends Bloc { _subscription = _repository .getSensorStream( - 'kelompok1/evaporasi', + 'Monitoring', (json) => Evaporasi.fromJson(json), ) .listen((data) {