fix message widget
This commit is contained in:
@@ -30,7 +30,7 @@ void main() async {
|
|||||||
final client = Client(
|
final client = Client(
|
||||||
's2dxdhpxd94g',
|
's2dxdhpxd94g',
|
||||||
logLevel: Level.INFO,
|
logLevel: Level.INFO,
|
||||||
notificationHandler: _handleBackgroundNotification,
|
customAndroidNotificationHandler: _handleBackgroundNotification,
|
||||||
);
|
);
|
||||||
|
|
||||||
await client.setUser(
|
await client.setUser(
|
||||||
@@ -51,7 +51,7 @@ class MyApp extends StatelessWidget {
|
|||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData.light(),
|
theme: ThemeData.light(),
|
||||||
darkTheme: ThemeData.dark(),
|
darkTheme: ThemeData.dark(),
|
||||||
themeMode: ThemeMode.system,
|
themeMode: ThemeMode.dark,
|
||||||
home: Container(
|
home: Container(
|
||||||
child: StreamChat(
|
child: StreamChat(
|
||||||
client: client,
|
client: client,
|
||||||
|
|||||||
+18
-55
@@ -481,7 +481,9 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
Text(
|
Text(
|
||||||
'MESSAGE FAILED · CLICK TO TRY AGAIN',
|
'MESSAGE FAILED · CLICK TO TRY AGAIN',
|
||||||
style: _messageTheme.messageText.copyWith(
|
style: _messageTheme.messageText.copyWith(
|
||||||
color: Colors.black.withOpacity(.5),
|
color: Theme.of(context).brightness == Brightness.dark
|
||||||
|
? Colors.white.withOpacity(.5)
|
||||||
|
: Colors.black.withOpacity(.5),
|
||||||
fontSize: 11,
|
fontSize: 11,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -489,7 +491,9 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
Text(
|
Text(
|
||||||
'MESSAGE UPDATE FAILED · CLICK TO TRY AGAIN',
|
'MESSAGE UPDATE FAILED · CLICK TO TRY AGAIN',
|
||||||
style: _messageTheme.messageText.copyWith(
|
style: _messageTheme.messageText.copyWith(
|
||||||
color: Colors.black.withOpacity(.5),
|
color: Theme.of(context).brightness == Brightness.dark
|
||||||
|
? Colors.white.withOpacity(.5)
|
||||||
|
: Colors.black.withOpacity(.5),
|
||||||
fontSize: 11,
|
fontSize: 11,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -497,7 +501,9 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
Text(
|
Text(
|
||||||
'MESSAGE DELETE FAILED · CLICK TO TRY AGAIN',
|
'MESSAGE DELETE FAILED · CLICK TO TRY AGAIN',
|
||||||
style: _messageTheme.messageText.copyWith(
|
style: _messageTheme.messageText.copyWith(
|
||||||
color: Colors.black.withOpacity(.5),
|
color: Theme.of(context).brightness == Brightness.dark
|
||||||
|
? Colors.white.withOpacity(.5)
|
||||||
|
: Colors.black.withOpacity(.5),
|
||||||
fontSize: 11,
|
fontSize: 11,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -521,7 +527,6 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
_buildBoxDecoration(_isLastUser || nOfAttachmentWidgets > 0),
|
_buildBoxDecoration(_isLastUser || nOfAttachmentWidgets > 0),
|
||||||
padding: EdgeInsets.all(10),
|
padding: EdgeInsets.all(10),
|
||||||
constraints: BoxConstraints.loose(
|
constraints: BoxConstraints.loose(
|
||||||
<<<<<<< HEAD
|
|
||||||
Size.fromWidth(MediaQuery.of(context).size.width * 0.7),
|
Size.fromWidth(MediaQuery.of(context).size.width * 0.7),
|
||||||
),
|
),
|
||||||
child: _buildSendingError(
|
child: _buildSendingError(
|
||||||
@@ -536,38 +541,6 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
|
|
||||||
if (widget.onMentionTap != null) {
|
if (widget.onMentionTap != null) {
|
||||||
widget.onMentionTap(mentionedUser);
|
widget.onMentionTap(mentionedUser);
|
||||||
=======
|
|
||||||
Size.fromWidth(MediaQuery.of(context).size.width * 0.7)),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
if (widget.message.status == MessageSendingStatus.FAILED)
|
|
||||||
Text(
|
|
||||||
'MESSAGE FAILED · CLICK TO TRY AGAIN',
|
|
||||||
style: _messageTheme.messageText.copyWith(
|
|
||||||
color: Theme.of(context).brightness == Brightness.dark
|
|
||||||
? Colors.white.withOpacity(.5)
|
|
||||||
: Colors.black.withOpacity(.5),
|
|
||||||
fontSize: 11,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
MarkdownBody(
|
|
||||||
data: text,
|
|
||||||
onTapLink: (link) {
|
|
||||||
if (link.startsWith('@')) {
|
|
||||||
final mentionedUser =
|
|
||||||
widget.message.mentionedUsers.firstWhere(
|
|
||||||
(u) => '@${u.name.replaceAll(' ', '')}' == link,
|
|
||||||
orElse: () => null,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (widget.onMentionTap != null) {
|
|
||||||
widget.onMentionTap(mentionedUser);
|
|
||||||
} else {
|
|
||||||
print('tap on ${mentionedUser.name}');
|
|
||||||
}
|
|
||||||
>>>>>>> master
|
|
||||||
} else {
|
} else {
|
||||||
print('tap on ${mentionedUser.name}');
|
print('tap on ${mentionedUser.name}');
|
||||||
}
|
}
|
||||||
@@ -987,7 +960,12 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
Widget _buildImage(
|
Widget _buildImage(
|
||||||
Attachment attachment,
|
Attachment attachment,
|
||||||
) {
|
) {
|
||||||
<<<<<<< HEAD
|
if (attachment.thumbUrl == null &&
|
||||||
|
attachment.imageUrl == null &&
|
||||||
|
attachment.assetUrl == null) {
|
||||||
|
return _buildErrorImage(attachment);
|
||||||
|
}
|
||||||
|
|
||||||
return Hero(
|
return Hero(
|
||||||
tag: attachment.imageUrl ?? attachment.assetUrl ?? attachment.thumbUrl,
|
tag: attachment.imageUrl ?? attachment.assetUrl ?? attachment.thumbUrl,
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
@@ -1015,17 +993,6 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
attachment.thumbUrl ?? attachment.imageUrl ?? attachment.assetUrl,
|
attachment.thumbUrl ?? attachment.imageUrl ?? attachment.assetUrl,
|
||||||
errorWidget: (context, url, error) => _buildErrorImage(attachment),
|
errorWidget: (context, url, error) => _buildErrorImage(attachment),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
=======
|
|
||||||
final errorWidget = Container(
|
|
||||||
width: 200,
|
|
||||||
height: 140,
|
|
||||||
color: Color(0xffd0021B).withOpacity(.1),
|
|
||||||
child: Center(
|
|
||||||
child: Icon(
|
|
||||||
Icons.error_outline,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
>>>>>>> master
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1040,7 +1007,7 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
child: Container(
|
child: Container(
|
||||||
width: 200,
|
width: 200,
|
||||||
height: 140,
|
height: 140,
|
||||||
color: Color(0xffd0021B).withAlpha(26),
|
color: Color(0xffd0021B).withOpacity(.1),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.error_outline,
|
Icons.error_outline,
|
||||||
@@ -1154,22 +1121,18 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
: Border.all(
|
: Border.all(
|
||||||
color: Theme.of(context).brightness == Brightness.dark
|
color: Theme.of(context).brightness == Brightness.dark
|
||||||
? Colors.white.withAlpha(24)
|
? Colors.white.withAlpha(24)
|
||||||
: Colors.black.withAlpha(24)),
|
: Colors.black.withAlpha(24),
|
||||||
|
),
|
||||||
borderRadius: BorderRadius.only(
|
borderRadius: BorderRadius.only(
|
||||||
topLeft: Radius.circular((_isMyMessage || !rectBorders) ? 16 : 2),
|
topLeft: Radius.circular((_isMyMessage || !rectBorders) ? 16 : 2),
|
||||||
bottomLeft: Radius.circular(_isMyMessage ? 16 : 2),
|
bottomLeft: Radius.circular(_isMyMessage ? 16 : 2),
|
||||||
topRight: Radius.circular((_isMyMessage && rectBorders) ? 2 : 16),
|
topRight: Radius.circular((_isMyMessage && rectBorders) ? 2 : 16),
|
||||||
bottomRight: Radius.circular(_isMyMessage ? 2 : 16),
|
bottomRight: Radius.circular(_isMyMessage ? 2 : 16),
|
||||||
),
|
),
|
||||||
<<<<<<< HEAD
|
|
||||||
color: (widget.message.status == MessageSendingStatus.FAILED ||
|
color: (widget.message.status == MessageSendingStatus.FAILED ||
|
||||||
widget.message.status == MessageSendingStatus.FAILED_UPDATE ||
|
widget.message.status == MessageSendingStatus.FAILED_UPDATE ||
|
||||||
widget.message.status == MessageSendingStatus.FAILED_DELETE)
|
widget.message.status == MessageSendingStatus.FAILED_DELETE)
|
||||||
? Color(0xffd0021B).withAlpha(26)
|
|
||||||
=======
|
|
||||||
color: widget.message.status == MessageSendingStatus.FAILED
|
|
||||||
? Color(0xffd0021B).withOpacity(.1)
|
? Color(0xffd0021B).withOpacity(.1)
|
||||||
>>>>>>> master
|
|
||||||
: _messageTheme.messageBackgroundColor,
|
: _messageTheme.messageBackgroundColor,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user