Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Added messages for emtpy chat list and empty chats #115 #116
Browse files Browse the repository at this point in the history
  • Loading branch information
Boehrsi committed Jun 3, 2019
1 parent 930751c commit 1792127
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
14 changes: 13 additions & 1 deletion lib/src/chat/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,19 @@ class _ChatState extends State<Chat> with ChatComposer {
bloc: _messagesBloc,
builder: (context, state) {
if (state is MessagesStateSuccess) {
return buildListItems(state);
if (state.messageIds.length > 0) {
return buildListItems(state);
} else {
return Padding(
padding: const EdgeInsets.all(listItemPaddingBig),
child: Center(
child: Text(
AppLocalizations.of(context).chatEmpty,
textAlign: TextAlign.center,
),
),
);
}
} else {
return Center(
child: CircularProgressIndicator(),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/chat/chat_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class ChatBloc extends Bloc<ChatEvent, ChatState> {
bool isVerified = await chat.isVerified();
Color color = rgbColorFromInt(colorValue);
var chatSummary = chat.get(ChatExtension.chatSummary);
dispatch(ChatLoaded(name, subTitle, color, freshMessageCount, isSelfTalk, _isGroup, chatSummary.preview, chatSummary.timestamp, isVerified));
dispatch(ChatLoaded(name, subTitle, color, freshMessageCount, isSelfTalk, _isGroup, chatSummary?.preview, chatSummary?.timestamp, isVerified));
}

}
12 changes: 8 additions & 4 deletions lib/src/chatlist/chat_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ class _ChatListState extends State<ChatList> {
if (state.chatIds.length > 0) {
return buildListItems(state);
} else {
return Center(
child: Text(AppLocalizations
.of(context)
.chatListEmpty),
return Padding(
padding: const EdgeInsets.all(listItemPaddingBig),
child: Center(
child: Text(
AppLocalizations.of(context).chatListEmpty,
textAlign: TextAlign.center,
),
),
);
}
} else if (state is! ChatListStateFailure) {
Expand Down
5 changes: 4 additions & 1 deletion lib/src/l10n/localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ class AppLocalizations {
// Chat list / invite list
String get inviteEmptyList => Intl.message('No invites', name: 'inviteEmptyList');

String get chatListEmpty => Intl.message('No chats', name: 'chatListEmpty');
String get chatListEmpty => Intl.message('Welcome to OX Coi!\nPlease start a new chat by tapping the pen icon.', name: 'chatListEmpty');

String get chatListDeleteChatsDialogTitleText => Intl.message('Delete chats', name: 'chatListDeleteChatsDialogTitleText');

Expand All @@ -313,6 +313,9 @@ class AppLocalizations {

String get recordingVideoMessageFailure => Intl.message('Video recording failed, missing permissions', name: 'recordingVideoMessageFailure');

String get chatEmpty => Intl.message('This is a new chat. Send a message to connect!', name: 'chatEmpty');


// Chat profile view
String get chatProfileBlockContactInfoText => Intl.message('Do you want to block the contact?', name: 'chatProfileBlockContactInfoText');

Expand Down

0 comments on commit 1792127

Please sign in to comment.