mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-12-25 04:18:51 +00:00
Show a message if user has no friend yet
This commit is contained in:
parent
2ac5caaf96
commit
a0abdc4f1b
@ -1,3 +1,5 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:comunic/helpers/friends_helper.dart';
|
||||
import 'package:comunic/helpers/users_helper.dart';
|
||||
import 'package:comunic/lists/friends_list.dart';
|
||||
@ -133,20 +135,29 @@ class _FriendsListScreenState extends SafeState<FriendsListScreen> {
|
||||
onRefresh: () => _loadList(true),
|
||||
child: ListView.builder(
|
||||
physics: AlwaysScrollableScrollPhysics(),
|
||||
itemCount: _friendsList!.length,
|
||||
itemBuilder: (c, i) => _friendsList![i].accepted
|
||||
? AcceptedFriendTile(
|
||||
friend: _friendsList![i],
|
||||
user: _usersInfo.getUser(_friendsList![i].id),
|
||||
onOpenPrivateConversation: _openPrivateConversation,
|
||||
onSetFollowing: _setFollowingFriend,
|
||||
onRequestDelete: _deleteFriend,
|
||||
)
|
||||
: PendingFriendTile(
|
||||
friend: _friendsList![i],
|
||||
user: _usersInfo.getUser(_friendsList![i].id),
|
||||
onRespond: _respondRequest,
|
||||
)),
|
||||
itemCount: max(_friendsList!.length, 1),
|
||||
itemBuilder: (c, i) {
|
||||
if (_friendsList!.isEmpty)
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: Text(tr("You do not have any friend yet!")!)),
|
||||
);
|
||||
|
||||
return _friendsList![i].accepted
|
||||
? AcceptedFriendTile(
|
||||
friend: _friendsList![i],
|
||||
user: _usersInfo.getUser(_friendsList![i].id),
|
||||
onOpenPrivateConversation: _openPrivateConversation,
|
||||
onSetFollowing: _setFollowingFriend,
|
||||
onRequestDelete: _deleteFriend,
|
||||
)
|
||||
: PendingFriendTile(
|
||||
friend: _friendsList![i],
|
||||
user: _usersInfo.getUser(_friendsList![i].id),
|
||||
onRespond: _respondRequest,
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user