update chatty

This commit is contained in:
Salvatore Giordano
2021-05-20 14:40:03 +02:00
parent 5a8f84a4c2
commit 1ec08cef83
5 changed files with 24 additions and 30 deletions
@@ -84,6 +84,6 @@ class StreamApiLocalImpl extends StreamApiRepository {
User(id: userId),
token,
);
return _client.state.user!.name != null && _client.state.user!.name != userId;
return _client.state.user!.name != userId;
}
}
@@ -99,6 +99,6 @@ class StreamApiImpl extends StreamApiRepository {
User(id: userId),
token,
);
return _client.state.user!.name != null && _client.state.user!.name != userId;
return _client.state.user!.name != userId;
}
}
@@ -232,29 +232,27 @@ class MyChannelPreview extends StatelessWidget {
}
var text = lastMessage.text;
if (lastMessage.attachments != null) {
final parts = <String>[
...lastMessage.attachments.map((e) {
if (e.type == 'image') {
return '📷';
} else if (e.type == 'video') {
return '🎬';
} else if (e.type == 'giphy') {
return '[GIF]';
}
return e == lastMessage.attachments.last
? (e.title ?? 'File')
: '${e.title ?? 'File'} , ';
}).where((e) => e != null),
lastMessage.text ?? '',
];
final parts = <String>[
...lastMessage.attachments.map((e) {
if (e.type == 'image') {
return '📷';
} else if (e.type == 'video') {
return '🎬';
} else if (e.type == 'giphy') {
return '[GIF]';
}
return e == lastMessage.attachments.last
? (e.title ?? 'File')
: '${e.title ?? 'File'} , ';
}),
lastMessage.text ?? '',
];
text = parts.join(' ');
}
text = parts.join(' ');
return Text.rich(
_getDisplayText(
text!,
text,
lastMessage.mentionedUsers,
lastMessage.attachments,
StreamChatTheme.of(context).channelPreviewTheme.subtitle!.copyWith(
@@ -291,15 +289,13 @@ class MyChannelPreview extends StatelessWidget {
var textList = text.split(' ');
var resList = <TextSpan>[];
for (var e in textList) {
if (mentions != null &&
mentions.isNotEmpty &&
if (mentions.isNotEmpty &&
mentions.any((element) => '@${element.name}' == e)) {
resList.add(TextSpan(
text: '$e ',
style: mentionsTextStyle,
));
} else if (attachments != null &&
attachments.isNotEmpty &&
} else if (attachments.isNotEmpty &&
attachments
.where((e) => e.title != null)
.any((element) => element.title == e)) {
@@ -20,10 +20,8 @@ class SignInCubit extends Cubit<SignInState> {
emit(SignInState.existing_user);
}
} catch (ex) {
final result = await _loginUseCase.signIn();
if (result != null) {
emit(SignInState.none);
}
_loginUseCase.signIn();
emit(SignInState.none);
}
}
}
+1 -1
View File
@@ -44,7 +44,7 @@ class Themes {
selectedItemColor: primaryColor,
unselectedItemColor: Colors.grey[300],
),
textSelectionColor: Colors.white,
textSelectionTheme: TextSelectionThemeData(selectionColor: Colors.white),
// switch active color
toggleableActiveColor: primaryColor,
canvasColor: backgroundDarkColor,