From 81e0680cb315da3853088b0e5319f041bb83fc2a Mon Sep 17 00:00:00 2001 From: faizatflutter Date: Wed, 31 Dec 2025 17:00:37 +0300 Subject: [PATCH 1/2] fixed routing again and again. --- .../water_monitor_settings_screen.dart | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/lib/presentation/water_monitor/water_monitor_settings_screen.dart b/lib/presentation/water_monitor/water_monitor_settings_screen.dart index 45a39e6..ca42b26 100644 --- a/lib/presentation/water_monitor/water_monitor_settings_screen.dart +++ b/lib/presentation/water_monitor/water_monitor_settings_screen.dart @@ -20,22 +20,8 @@ class WaterMonitorSettingsScreen extends StatefulWidget { } class _WaterMonitorSettingsScreenState extends State { - @override - void initState() { - super.initState(); - WidgetsBinding.instance.addPostFrameCallback((_) { - context.read().initialize(); - }); - } - - void _showSnackbar(String text) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text(text), - backgroundColor: AppColors.errorColor, - ), - ); - } + // No need to call initialize() here since it's already called in water_consumption_screen + // The ViewModel is shared via Provider, so data is already loaded // Reusable method to build selection row widget Widget _buildSelectionRow({ -- 2.30.2 From 40f6cafb4870aa1958dddcfc064e40871c450ddf Mon Sep 17 00:00:00 2001 From: faizatflutter Date: Wed, 31 Dec 2025 17:10:12 +0300 Subject: [PATCH 2/2] fixed routing again and again. --- lib/features/water_monitor/water_monitor_view_model.dart | 1 - .../water_monitor/water_monitor_settings_screen.dart | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/features/water_monitor/water_monitor_view_model.dart b/lib/features/water_monitor/water_monitor_view_model.dart index 2e3dbc3..787dc05 100644 --- a/lib/features/water_monitor/water_monitor_view_model.dart +++ b/lib/features/water_monitor/water_monitor_view_model.dart @@ -641,7 +641,6 @@ class WaterMonitorViewModel extends ChangeNotifier { (apiModel) async { // Update local data with response _userDetailData = apiModel.data; - // Fetch daily progress to get the updated goal and consumed data from API await fetchUserProgressForMonitoring(); diff --git a/lib/presentation/water_monitor/water_monitor_settings_screen.dart b/lib/presentation/water_monitor/water_monitor_settings_screen.dart index ca42b26..4e89d71 100644 --- a/lib/presentation/water_monitor/water_monitor_settings_screen.dart +++ b/lib/presentation/water_monitor/water_monitor_settings_screen.dart @@ -336,9 +336,7 @@ class _WaterMonitorSettingsScreenState extends State content: Text(message), duration: const Duration(seconds: 3), behavior: SnackBarBehavior.floating, - backgroundColor: message.contains('successfully') - ? Colors.green - : AppColors.errorColor, + backgroundColor: message.contains('successfully') ? Colors.green : AppColors.errorColor, ), ); } -- 2.30.2