From d8d3c3c79b66d3b94448e468f92dbc5e34c5f35e Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Thu, 26 Feb 2026 11:57:12 -0500 Subject: [PATCH] refactor: Remove 'Edit Profile' and 'Hubs' buttons from settings actions and migrate client hubs page to use UiAppBar. --- .../presentation/pages/client_hubs_page.dart | 102 ++++-------------- .../pages/client_settings_page.dart | 5 +- .../settings_actions.dart | 34 +----- 3 files changed, 27 insertions(+), 114 deletions(-) diff --git a/apps/mobile/packages/features/client/hubs/lib/src/presentation/pages/client_hubs_page.dart b/apps/mobile/packages/features/client/hubs/lib/src/presentation/pages/client_hubs_page.dart index 25772bc2..d120664b 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/presentation/pages/client_hubs_page.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/presentation/pages/client_hubs_page.dart @@ -56,10 +56,31 @@ class ClientHubsPage extends StatelessWidget { }, builder: (BuildContext context, ClientHubsState state) { return Scaffold( - backgroundColor: UiColors.bgMenu, + appBar: UiAppBar( + title: t.client_hubs.title, + subtitle: t.client_hubs.subtitle, + showBackButton: true, + actions: [ + Padding( + padding: const EdgeInsets.only(right: UiConstants.space5), + child: UiButton.primary( + onPressed: () async { + final bool? success = await Modular.to.toEditHub(); + if (success == true && context.mounted) { + BlocProvider.of( + context, + ).add(const ClientHubsFetched()); + } + }, + text: t.client_hubs.add_hub, + leadingIcon: UiIcons.add, + size: UiButtonSize.small, + ), + ), + ], + ), body: CustomScrollView( slivers: [ - _buildAppBar(context), SliverPadding( padding: const EdgeInsets.symmetric( horizontal: UiConstants.space5, @@ -112,81 +133,4 @@ class ClientHubsPage extends StatelessWidget { ), ); } - - Widget _buildAppBar(BuildContext context) { - return SliverAppBar( - backgroundColor: UiColors.foreground, - automaticallyImplyLeading: false, - expandedHeight: 140, - pinned: true, - flexibleSpace: FlexibleSpaceBar( - background: Container( - color: UiColors.foreground, - padding: const EdgeInsets.fromLTRB( - UiConstants.space5, - UiConstants.space12, - UiConstants.space5, - 0, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureDetector( - onTap: () => Modular.to.toClientHome(), - child: Container( - width: 40, - height: 40, - decoration: BoxDecoration( - color: UiColors.white.withValues(alpha: 0.2), - shape: BoxShape.circle, - ), - child: const Icon( - UiIcons.arrowLeft, - color: UiColors.white, - size: 20, - ), - ), - ), - const SizedBox(height: UiConstants.space4), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - t.client_hubs.title, - style: UiTypography.headline1m.white, - ), - Text( - t.client_hubs.subtitle, - style: UiTypography.body2r.copyWith( - color: UiColors.switchInactive, - ), - ), - ], - ), - ), - UiButton.primary( - onPressed: () async { - final bool? success = await Modular.to.toEditHub(); - if (success == true && context.mounted) { - BlocProvider.of( - context, - ).add(const ClientHubsFetched()); - } - }, - text: t.client_hubs.add_hub, - leadingIcon: UiIcons.add, - size: UiButtonSize.small, - ), - ], - ), - ], - ), - ), - ), - ); - } } diff --git a/apps/mobile/packages/features/client/settings/lib/src/presentation/pages/client_settings_page.dart b/apps/mobile/packages/features/client/settings/lib/src/presentation/pages/client_settings_page.dart index 508b5396..3d40f1e5 100644 --- a/apps/mobile/packages/features/client/settings/lib/src/presentation/pages/client_settings_page.dart +++ b/apps/mobile/packages/features/client/settings/lib/src/presentation/pages/client_settings_page.dart @@ -44,10 +44,7 @@ class ClientSettingsPage extends StatelessWidget { child: const Scaffold( backgroundColor: UiColors.bgMenu, body: CustomScrollView( - slivers: [ - SettingsProfileHeader(), - SettingsActions(), - ], + slivers: [SettingsProfileHeader(), SettingsActions()], ), ), ), 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 0950c573..5332fc57 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 @@ -24,36 +24,6 @@ class SettingsActions extends StatelessWidget { delegate: SliverChildListDelegate([ const SizedBox(height: UiConstants.space5), - // Edit Profile button (Yellow) - UiButton.primary( - text: labels.edit_profile, - fullWidth: true, - style: ElevatedButton.styleFrom( - backgroundColor: UiColors.accent, - foregroundColor: UiColors.accentForeground, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(UiConstants.radiusBase * 2), - ), - ), - onPressed: () => Modular.to.toClientEditProfile(), - ), - const SizedBox(height: UiConstants.space4), - - // Hubs button (Yellow) - UiButton.primary( - text: labels.hubs, - fullWidth: true, - style: ElevatedButton.styleFrom( - backgroundColor: UiColors.accent, - foregroundColor: UiColors.accentForeground, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(UiConstants.radiusBase * 2), - ), - ), - onPressed: () => Modular.to.toClientHubs(), - ), - const SizedBox(height: UiConstants.space5), - // Quick Links card _QuickLinksCard(labels: labels), const SizedBox(height: UiConstants.space5), @@ -67,7 +37,9 @@ class SettingsActions extends StatelessWidget { style: OutlinedButton.styleFrom( side: const BorderSide(color: UiColors.black), shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(UiConstants.radiusBase * 2), + borderRadius: BorderRadius.circular( + UiConstants.radiusBase * 2, + ), ), ), onPressed: state is ClientSettingsLoading