build method
dynamic
build( - dynamic context,
- dynamic ref
)
Implementation
@override
Widget build(BuildContext context, WidgetRef ref) {
final usersLoader = ref.watch(ignoredUsersProvider);
return WithSidebar(
sidebar: const SettingsPage(),
child: Scaffold(
appBar: AppBar(
automaticallyImplyLeading: !context.isLargeScreen,
title: Text(L10n.of(context).blockedUsers),
centerTitle: true,
actions: [
IconButton(
icon: const Icon(Atlas.plus_circle_thin),
iconSize: 28,
color: Theme.of(context).colorScheme.surface,
onPressed: () async => await onAdd(context, ref),
),
],
),
body: usersLoader.when(
data: (users) {
if (users.isEmpty) {
return Center(
child: Text(L10n.of(context).hereYouCanSeeAllUsersYouBlocked),
);
}
return CustomScrollView(
slivers: [
SliverList.builder(
itemBuilder: (BuildContext context, int index) {
final userId = users[index].toString();
return Card(
margin: const EdgeInsets.all(5),
child: ListTile(
title: Padding(
padding: const EdgeInsets.all(10),
child: Text(userId),
),
trailing: OutlinedButton(
child: Text(L10n.of(context).unblock),
onPressed: () async => await onDelete(
context,
ref,
userId,
),
),
),
);
},
itemCount: users.length,
),
],
);
},
error: (e, s) {
_log.severe('Failed to load the ignored users', e, s);
return Center(
child: Text(L10n.of(context).loadingFailed(e)),
);
},
loading: () => const Center(
child: CircularProgressIndicator(),
),
),
),
);
}