From a7540954cb42857ecca83981055084fe50029ff9 Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Thu, 22 Jan 2026 13:49:00 -0500 Subject: [PATCH] chore: Refactor navigation and button actions in settings page Replaced Navigator calls with Modular navigation for consistency. Updated button order and styling in the logout dialog, and added comments for clarity. The Hubs button now uses Modular navigation to push the Hubs page. --- .../settings_actions.dart | 45 +++++++++++++------ 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_actions.dart b/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_actions.dart index f7fd3dbb..b906f258 100644 --- a/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_actions.dart +++ b/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_actions.dart @@ -1,7 +1,9 @@ +import 'package:client_settings/src/presentation/navigation/client_settings_navigator.dart'; import 'package:core_localization/core_localization.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_modular/flutter_modular.dart'; import '../../blocs/client_settings_bloc.dart'; /// A widget that displays the primary actions for the settings page. @@ -11,19 +13,31 @@ class SettingsActions extends StatelessWidget { @override Widget build(BuildContext context) { - final labels = t.client_settings.profile; + // Get the translations for the client settings profile. + final TranslationsClientSettingsProfileEn labels = + t.client_settings.profile; return SliverPadding( padding: const EdgeInsets.symmetric(horizontal: UiConstants.space5), sliver: SliverList( - delegate: SliverChildListDelegate([ + delegate: SliverChildListDelegate([ const SizedBox(height: UiConstants.space5), + + // Edit profile button UiButton.primary(text: labels.edit_profile, onPressed: () {}), + const SizedBox(height: UiConstants.space4), - UiButton.primary(text: labels.hubs, onPressed: () {}), + + // Hubs button + UiButton.primary( + text: labels.hubs, + onPressed: () => Modular.to.pushHubs(), + ), const SizedBox(height: UiConstants.space4), + + // Log out button BlocBuilder( - builder: (context, state) { + builder: (BuildContext context, ClientSettingsState state) { return UiButton.secondary( text: labels.log_out, onPressed: state is ClientSettingsLoading @@ -53,24 +67,27 @@ class SettingsActions extends StatelessWidget { 'Are you sure you want to log out?', style: UiTypography.body2r.textSecondary, ), - actions: [ - TextButton( - onPressed: () => Navigator.of(context).pop(), - child: Text( - t.common.cancel, - style: UiTypography.buttonM.textSecondary, - ), - ), + actions: [ + // Log out button TextButton( onPressed: () { - Navigator.of(context).pop(); + Modular.to.pop(); BlocProvider.of( context, ).add(const ClientSettingsSignOutRequested()); }, child: Text( t.client_settings.profile.log_out, - style: UiTypography.buttonM.textError, + style: UiTypography.buttonM.textSecondary, + ), + ), + + // Cancel button + TextButton( + onPressed: () => Modular.to.pop(), + child: Text( + t.common.cancel, + style: UiTypography.buttonM.textPrimary, ), ), ],