refactor: Remove 'Edit Profile' and 'Hubs' buttons from settings actions and migrate client hubs page to use UiAppBar.
This commit is contained in:
@@ -56,10 +56,31 @@ class ClientHubsPage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
builder: (BuildContext context, ClientHubsState state) {
|
builder: (BuildContext context, ClientHubsState state) {
|
||||||
return Scaffold(
|
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(
|
body: CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
_buildAppBar(context),
|
|
||||||
SliverPadding(
|
SliverPadding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: UiConstants.space5,
|
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,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,10 +44,7 @@ class ClientSettingsPage extends StatelessWidget {
|
|||||||
child: const Scaffold(
|
child: const Scaffold(
|
||||||
backgroundColor: UiColors.bgMenu,
|
backgroundColor: UiColors.bgMenu,
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[SettingsProfileHeader(), SettingsActions()],
|
||||||
SettingsProfileHeader(),
|
|
||||||
SettingsActions(),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -24,36 +24,6 @@ class SettingsActions extends StatelessWidget {
|
|||||||
delegate: SliverChildListDelegate(<Widget>[
|
delegate: SliverChildListDelegate(<Widget>[
|
||||||
const SizedBox(height: UiConstants.space5),
|
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
|
// Quick Links card
|
||||||
_QuickLinksCard(labels: labels),
|
_QuickLinksCard(labels: labels),
|
||||||
const SizedBox(height: UiConstants.space5),
|
const SizedBox(height: UiConstants.space5),
|
||||||
@@ -67,7 +37,9 @@ class SettingsActions extends StatelessWidget {
|
|||||||
style: OutlinedButton.styleFrom(
|
style: OutlinedButton.styleFrom(
|
||||||
side: const BorderSide(color: UiColors.black),
|
side: const BorderSide(color: UiColors.black),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(UiConstants.radiusBase * 2),
|
borderRadius: BorderRadius.circular(
|
||||||
|
UiConstants.radiusBase * 2,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: state is ClientSettingsLoading
|
onPressed: state is ClientSettingsLoading
|
||||||
|
|||||||
Reference in New Issue
Block a user