mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Show a notification when the user has no notification to show
This commit is contained in:
parent
0b204afff9
commit
32c15ae915
@ -42,6 +42,8 @@ class _NotificationsScreenState extends State<NotificationsScreen> {
|
|||||||
_users = users;
|
_users = users;
|
||||||
_groups = groups;
|
_groups = groups;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setStatus(_Status.NONE);
|
||||||
} on Exception catch (e) {
|
} on Exception catch (e) {
|
||||||
print("Exception while getting the list of notifications!");
|
print("Exception while getting the list of notifications!");
|
||||||
print(e);
|
print(e);
|
||||||
@ -59,6 +61,28 @@ class _NotificationsScreenState extends State<NotificationsScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
// Loading status
|
||||||
|
if (_list == null || _status == _Status.LOADING)
|
||||||
|
return Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
);
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: RefreshIndicator(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
physics: AlwaysScrollableScrollPhysics(),
|
||||||
|
child: _buildBody(),
|
||||||
|
),
|
||||||
|
onRefresh: _loadList),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Build body
|
||||||
|
Widget _buildBody() {
|
||||||
// In case of error
|
// In case of error
|
||||||
if (_status == _Status.ERROR)
|
if (_status == _Status.ERROR)
|
||||||
return buildErrorCard(tr("Could not get the list of notifications!"),
|
return buildErrorCard(tr("Could not get the list of notifications!"),
|
||||||
@ -69,10 +93,13 @@ class _NotificationsScreenState extends State<NotificationsScreen> {
|
|||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Loading status
|
// When there is no notification
|
||||||
if (_list == null || _status == _Status.LOADING)
|
if (_list.length == 0)
|
||||||
return Center(
|
return Padding(
|
||||||
child: CircularProgressIndicator(),
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Center(
|
||||||
|
child: Text(tr("You do not have any notification now.")),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user