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), User(id: userId),
token, 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), User(id: userId),
token, 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; var text = lastMessage.text;
if (lastMessage.attachments != null) { final parts = <String>[
final parts = <String>[ ...lastMessage.attachments.map((e) {
...lastMessage.attachments.map((e) { if (e.type == 'image') {
if (e.type == 'image') { return '📷';
return '📷'; } else if (e.type == 'video') {
} else if (e.type == 'video') { return '🎬';
return '🎬'; } else if (e.type == 'giphy') {
} else if (e.type == 'giphy') { return '[GIF]';
return '[GIF]'; }
} return e == lastMessage.attachments.last
return e == lastMessage.attachments.last ? (e.title ?? 'File')
? (e.title ?? 'File') : '${e.title ?? 'File'} , ';
: '${e.title ?? 'File'} , '; }),
}).where((e) => e != null), lastMessage.text ?? '',
lastMessage.text ?? '', ];
];
text = parts.join(' '); text = parts.join(' ');
}
return Text.rich( return Text.rich(
_getDisplayText( _getDisplayText(
text!, text,
lastMessage.mentionedUsers, lastMessage.mentionedUsers,
lastMessage.attachments, lastMessage.attachments,
StreamChatTheme.of(context).channelPreviewTheme.subtitle!.copyWith( StreamChatTheme.of(context).channelPreviewTheme.subtitle!.copyWith(
@@ -291,15 +289,13 @@ class MyChannelPreview extends StatelessWidget {
var textList = text.split(' '); var textList = text.split(' ');
var resList = <TextSpan>[]; var resList = <TextSpan>[];
for (var e in textList) { for (var e in textList) {
if (mentions != null && if (mentions.isNotEmpty &&
mentions.isNotEmpty &&
mentions.any((element) => '@${element.name}' == e)) { mentions.any((element) => '@${element.name}' == e)) {
resList.add(TextSpan( resList.add(TextSpan(
text: '$e ', text: '$e ',
style: mentionsTextStyle, style: mentionsTextStyle,
)); ));
} else if (attachments != null && } else if (attachments.isNotEmpty &&
attachments.isNotEmpty &&
attachments attachments
.where((e) => e.title != null) .where((e) => e.title != null)
.any((element) => element.title == e)) { .any((element) => element.title == e)) {
@@ -20,10 +20,8 @@ class SignInCubit extends Cubit<SignInState> {
emit(SignInState.existing_user); emit(SignInState.existing_user);
} }
} catch (ex) { } catch (ex) {
final result = await _loginUseCase.signIn(); _loginUseCase.signIn();
if (result != null) { emit(SignInState.none);
emit(SignInState.none);
}
} }
} }
} }
+1 -1
View File
@@ -44,7 +44,7 @@ class Themes {
selectedItemColor: primaryColor, selectedItemColor: primaryColor,
unselectedItemColor: Colors.grey[300], unselectedItemColor: Colors.grey[300],
), ),
textSelectionColor: Colors.white, textSelectionTheme: TextSelectionThemeData(selectionColor: Colors.white),
// switch active color // switch active color
toggleableActiveColor: primaryColor, toggleableActiveColor: primaryColor,
canvasColor: backgroundDarkColor, canvasColor: backgroundDarkColor,