refactor: Remove 'Edit Profile' and 'Hubs' buttons from settings actions and migrate client hubs page to use UiAppBar.

This commit is contained in:
Achintha Isuru
2026-02-26 11:57:12 -05:00
parent f389b6de5b
commit d8d3c3c79b
3 changed files with 27 additions and 114 deletions

View File

@@ -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: <Widget>[
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<ClientHubsBloc>(
context,
).add(const ClientHubsFetched());
}
},
text: t.client_hubs.add_hub,
leadingIcon: UiIcons.add,
size: UiButtonSize.small,
),
),
],
),
body: CustomScrollView(
slivers: <Widget>[
_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: <Widget>[
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: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
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<ClientHubsBloc>(
context,
).add(const ClientHubsFetched());
}
},
text: t.client_hubs.add_hub,
leadingIcon: UiIcons.add,
size: UiButtonSize.small,
),
],
),
],
),
),
),
);
}
}

View File

@@ -44,10 +44,7 @@ class ClientSettingsPage extends StatelessWidget {
child: const Scaffold(
backgroundColor: UiColors.bgMenu,
body: CustomScrollView(
slivers: <Widget>[
SettingsProfileHeader(),
SettingsActions(),
],
slivers: <Widget>[SettingsProfileHeader(), SettingsActions()],
),
),
),

View File

@@ -24,36 +24,6 @@ class SettingsActions extends StatelessWidget {
delegate: SliverChildListDelegate(<Widget>[
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