mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 04:04:18 +00:00 
			
		
		
		
	Show a notification when the user has no notification to show
This commit is contained in:
		@@ -42,6 +42,8 @@ class _NotificationsScreenState extends State<NotificationsScreen> {
 | 
			
		||||
        _users = users;
 | 
			
		||||
        _groups = groups;
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      setStatus(_Status.NONE);
 | 
			
		||||
    } on Exception catch (e) {
 | 
			
		||||
      print("Exception while getting the list of notifications!");
 | 
			
		||||
      print(e);
 | 
			
		||||
@@ -59,6 +61,28 @@ class _NotificationsScreenState extends State<NotificationsScreen> {
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  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
 | 
			
		||||
    if (_status == _Status.ERROR)
 | 
			
		||||
      return buildErrorCard(tr("Could not get the list of notifications!"),
 | 
			
		||||
@@ -69,10 +93,13 @@ class _NotificationsScreenState extends State<NotificationsScreen> {
 | 
			
		||||
            )
 | 
			
		||||
          ]);
 | 
			
		||||
 | 
			
		||||
    // Loading status
 | 
			
		||||
    if (_list == null || _status == _Status.LOADING)
 | 
			
		||||
      return Center(
 | 
			
		||||
        child: CircularProgressIndicator(),
 | 
			
		||||
    // When there is no notification
 | 
			
		||||
    if (_list.length == 0)
 | 
			
		||||
      return Padding(
 | 
			
		||||
        padding: const EdgeInsets.all(8.0),
 | 
			
		||||
        child: Center(
 | 
			
		||||
          child: Text(tr("You do not have any notification now.")),
 | 
			
		||||
        ),
 | 
			
		||||
      );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user