oke
This commit is contained in:
parent
80016bd1ef
commit
53c01e694f
|
|
@ -5,6 +5,7 @@ import '../../../blocs/authentication_bloc/authentication_bloc.dart';
|
||||||
import '../../../blocs/notification_bloc/notification_bloc.dart';
|
import '../../../blocs/notification_bloc/notification_bloc.dart';
|
||||||
import '../../monitoring/wind_speed/blocs/wind_speed_bloc.dart';
|
import '../../monitoring/wind_speed/blocs/wind_speed_bloc.dart';
|
||||||
import '../../monitoring/atmospheric_conditions/blocs/atmospheric_conditions_bloc.dart';
|
import '../../monitoring/atmospheric_conditions/blocs/atmospheric_conditions_bloc.dart';
|
||||||
|
import '../../monitoring/evaporasi/blocs/evaporasi_bloc.dart';
|
||||||
import '../../auth/views/welcome_screen.dart';
|
import '../../auth/views/welcome_screen.dart';
|
||||||
import '../widgets/notification_panel.dart';
|
import '../widgets/notification_panel.dart';
|
||||||
import '../widgets/sensor_grid.dart';
|
import '../widgets/sensor_grid.dart';
|
||||||
|
|
@ -69,6 +70,12 @@ class _HomeScreenState extends State<HomeScreen>
|
||||||
repository: context.read<MonitoringRepository>(),
|
repository: context.read<MonitoringRepository>(),
|
||||||
)..add(WatchAtmosphericConditionsStarted()),
|
)..add(WatchAtmosphericConditionsStarted()),
|
||||||
),
|
),
|
||||||
|
BlocProvider<EvaporasiBloc>(
|
||||||
|
create: (context) => EvaporasiBloc(
|
||||||
|
repository: context.read<MonitoringRepository>(),
|
||||||
|
notificationBloc: context.read<NotificationBloc>(),
|
||||||
|
)..add(WatchEvaporasiStarted()),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: BlocListener<AuthenticationBloc, AuthenticationState>(
|
child: BlocListener<AuthenticationBloc, AuthenticationState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import '../../monitoring/wind_speed/views/wind_speed_screen.dart';
|
||||||
import '../../monitoring/wind_speed/blocs/wind_speed_bloc.dart';
|
import '../../monitoring/wind_speed/blocs/wind_speed_bloc.dart';
|
||||||
import '../../monitoring/atmospheric_conditions/blocs/atmospheric_conditions_bloc.dart';
|
import '../../monitoring/atmospheric_conditions/blocs/atmospheric_conditions_bloc.dart';
|
||||||
import '../../monitoring/atmospheric_conditions/views/atmospheric_screen.dart';
|
import '../../monitoring/atmospheric_conditions/views/atmospheric_screen.dart';
|
||||||
|
import '../../monitoring/evaporasi/blocs/evaporasi_bloc.dart';
|
||||||
|
import '../../monitoring/evaporasi/views/evaporasi_screen.dart';
|
||||||
import '../../../blocs/notification_bloc/notification_bloc.dart';
|
import '../../../blocs/notification_bloc/notification_bloc.dart';
|
||||||
|
|
||||||
class MainDrawer extends StatelessWidget {
|
class MainDrawer extends StatelessWidget {
|
||||||
|
|
@ -89,6 +91,26 @@ class MainDrawer extends StatelessWidget {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
leading:
|
||||||
|
Icon(Icons.water_drop, color: Colors.teal.shade600, size: 20),
|
||||||
|
title: const Text("Evaporasi"),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => BlocProvider<EvaporasiBloc>(
|
||||||
|
create: (context) => EvaporasiBloc(
|
||||||
|
repository: context.read<MonitoringRepository>(),
|
||||||
|
notificationBloc: context.read<NotificationBloc>(),
|
||||||
|
)..add(WatchEvaporasiStarted()),
|
||||||
|
child: const EvaporasiScreen(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
const Spacer(), // Dorong menu logout ke paling bawah
|
const Spacer(), // Dorong menu logout ke paling bawah
|
||||||
const Divider(),
|
const Divider(),
|
||||||
ListTile(
|
ListTile(
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import '../../monitoring/wind_speed/blocs/wind_speed_bloc.dart';
|
import '../../monitoring/wind_speed/blocs/wind_speed_bloc.dart';
|
||||||
import '../../monitoring/atmospheric_conditions/blocs/atmospheric_conditions_bloc.dart';
|
import '../../monitoring/atmospheric_conditions/blocs/atmospheric_conditions_bloc.dart';
|
||||||
|
import '../../monitoring/evaporasi/blocs/evaporasi_bloc.dart';
|
||||||
|
|
||||||
/// Period selector khusus untuk dashboard
|
/// Period selector khusus untuk dashboard
|
||||||
class DashboardPeriodSelector extends StatelessWidget {
|
class DashboardPeriodSelector extends StatelessWidget {
|
||||||
|
|
@ -128,6 +129,24 @@ class _DashboardChartsState extends State<DashboardCharts> {
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
|
|
||||||
|
// 2. Evaporasi
|
||||||
|
BlocBuilder<EvaporasiBloc, EvaporasiState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
return _SensorChartCard(
|
||||||
|
title: 'Evaporasi',
|
||||||
|
unit: 'mm',
|
||||||
|
color: Colors.teal.shade600,
|
||||||
|
bgColor: Colors.teal.shade50,
|
||||||
|
icon: Icons.water_drop,
|
||||||
|
currentValue: state.currentValue,
|
||||||
|
data: state.chartValues,
|
||||||
|
period: _period,
|
||||||
|
isLoading: state.isLoading,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
|
||||||
// 3. Tekanan Udara — hanya realtime (tidak ada history)
|
// 3. Tekanan Udara — hanya realtime (tidak ada history)
|
||||||
BlocBuilder<AtmosphericConditionsBloc,
|
BlocBuilder<AtmosphericConditionsBloc,
|
||||||
AtmosphericConditionsState>(
|
AtmosphericConditionsState>(
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import '../../monitoring/wind_speed/blocs/wind_speed_bloc.dart';
|
import '../../monitoring/wind_speed/blocs/wind_speed_bloc.dart';
|
||||||
import '../../monitoring/atmospheric_conditions/blocs/atmospheric_conditions_bloc.dart';
|
import '../../monitoring/atmospheric_conditions/blocs/atmospheric_conditions_bloc.dart';
|
||||||
|
import '../../monitoring/evaporasi/blocs/evaporasi_bloc.dart';
|
||||||
|
|
||||||
class SensorGrid extends StatelessWidget {
|
class SensorGrid extends StatelessWidget {
|
||||||
const SensorGrid({super.key});
|
const SensorGrid({super.key});
|
||||||
|
|
@ -47,6 +48,22 @@ class SensorGrid extends StatelessWidget {
|
||||||
isLoading: state.isLoading,
|
isLoading: state.isLoading,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// --- EVAPORASI ---
|
||||||
|
BlocBuilder<EvaporasiBloc, EvaporasiState>(
|
||||||
|
builder: (context, state) => SensorCard(
|
||||||
|
width: cardWidth,
|
||||||
|
icon: Icons.water_drop,
|
||||||
|
iconColor: Colors.teal.shade600,
|
||||||
|
iconBgColor: Colors.teal.shade50,
|
||||||
|
label: 'Evaporasi',
|
||||||
|
value: state.isLoading
|
||||||
|
? '—'
|
||||||
|
: state.currentValue.toStringAsFixed(1),
|
||||||
|
unit: 'mm',
|
||||||
|
isLoading: state.isLoading,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue