Empty state for Recipient Adress Book
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class AddressBookPlaceholder extends StatelessWidget {
|
||||
final String text;
|
||||
|
||||
const AddressBookPlaceholder({required this.text});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Center(
|
||||
child: Text(
|
||||
text,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import 'package:pshared/provider/recipient/provider.dart';
|
||||
|
||||
import 'package:pweb/pages/address_book/page/search.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/single/adress_book/long_list/widget.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/single/adress_book/placeholder.dart';
|
||||
import 'package:pweb/pages/dashboard/payouts/single/adress_book/short_list.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
@@ -58,6 +59,8 @@ class _AdressBookPayoutState extends State<AdressBookPayout> {
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
final provider = context.watch<RecipientsProvider>();
|
||||
final recipients = provider.recipients;
|
||||
final filteredRecipients = provider.filteredRecipients;
|
||||
|
||||
if (provider.isLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
@@ -87,15 +90,19 @@ class _AdressBookPayoutState extends State<AdressBookPayout> {
|
||||
),
|
||||
const SizedBox(height: _spacingBetween),
|
||||
Expanded(
|
||||
child: _isExpanded
|
||||
? LongListAdressBookPayout(
|
||||
filteredRecipients: provider.filteredRecipients,
|
||||
onSelected: widget.onSelected,
|
||||
)
|
||||
: ShortListAdressBookPayout(
|
||||
recipients: provider.recipients,
|
||||
onSelected: widget.onSelected,
|
||||
),
|
||||
child: recipients.isEmpty
|
||||
? AddressBookPlaceholder(text: loc.noRecipientsYet)
|
||||
: _isExpanded && filteredRecipients.isEmpty
|
||||
? AddressBookPlaceholder(text: loc.noRecipientsFound)
|
||||
: _isExpanded
|
||||
? LongListAdressBookPayout(
|
||||
filteredRecipients: filteredRecipients,
|
||||
onSelected: widget.onSelected,
|
||||
)
|
||||
: ShortListAdressBookPayout(
|
||||
recipients: recipients,
|
||||
onSelected: widget.onSelected,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -103,4 +110,4 @@ class _AdressBookPayoutState extends State<AdressBookPayout> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user