feat: Add UiEmptyState widget and integrate it into BankAccountPage and WorkerHomePage for improved empty state handling

This commit is contained in:
Achintha Isuru
2026-03-01 03:22:48 -05:00
parent 015f1fbc1b
commit 2c61baaaa9
5 changed files with 240 additions and 183 deletions

View File

@@ -28,10 +28,7 @@ class BankAccountPage extends StatelessWidget {
final dynamic strings = t.staff.profile.bank_account_page;
return Scaffold(
appBar: UiAppBar(
title: strings.title,
showBackButton: true,
),
appBar: UiAppBar(title: strings.title, showBackButton: true),
body: BlocConsumer<BankAccountCubit, BankAccountState>(
bloc: cubit,
listener: (BuildContext context, BankAccountState state) {
@@ -81,34 +78,13 @@ class BankAccountPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SecurityNotice(strings: strings),
const SizedBox(height: UiConstants.space6),
const SizedBox(height: UiConstants.space32),
if (state.accounts.isEmpty)
Center(
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: UiConstants.space10,
),
child: Column(
children: <Widget>[
const Icon(
UiIcons.building,
size: 48,
color: UiColors.iconSecondary,
),
const SizedBox(height: UiConstants.space4),
Text(
'No accounts yet',
style: UiTypography.headline4m,
textAlign: TextAlign.center,
),
Text(
'Add your first bank account to get started',
style: UiTypography.body2m.textSecondary,
textAlign: TextAlign.center,
),
],
),
),
const UiEmptyState(
icon: UiIcons.building,
title: 'No accounts yet',
description:
'Add your first bank account to get started',
)
else ...<Widget>[
Text(
@@ -119,10 +95,8 @@ class BankAccountPage extends StatelessWidget {
),
const SizedBox(height: UiConstants.space3),
...state.accounts.map<Widget>(
(StaffBankAccount account) => AccountCard(
account: account,
strings: strings,
),
(StaffBankAccount account) =>
AccountCard(account: account, strings: strings),
),
],
// Add extra padding at bottom