1
0
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:
Pierre HUBERT 2022-03-12 09:44:21 +01:00
parent 2ac5caaf96
commit a0abdc4f1b

View File

@ -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,
);
}),
),
),
],