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 conversation yet

This commit is contained in:
Pierre HUBERT 2022-03-12 09:47:58 +01:00
parent a0abdc4f1b
commit 75c596226b

View File

@ -1,3 +1,5 @@
import 'dart:math';
import 'package:comunic/enums/load_error_level.dart';
import 'package:comunic/helpers/conversations_helper.dart';
import 'package:comunic/helpers/events_helper.dart';
@ -179,6 +181,14 @@ class _ConversationScreenState extends SafeState<ConversationsListScreen> {
physics: AlwaysScrollableScrollPhysics(),
controller: ScrollController(),
itemBuilder: (context, index) {
if (_list!.isEmpty)
return Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Text(
tr("You do not have any conversation yet!")!)),
);
if (_list![index].isGroupConversation &&
!_list![index].following) return Container();
@ -193,7 +203,7 @@ class _ConversationScreenState extends SafeState<ConversationsListScreen> {
onRequestLeave: _requestLeaveConversation,
);
},
itemCount: _list!.length,
itemCount: max(_list!.length, 1),
),
),
),