@@ -14,6 +14,8 @@ class ChannelBottomSheet extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
|
class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
|
||||||
|
bool _showActions = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var channel = StreamChannel.of(context).channel;
|
var channel = StreamChannel.of(context).channel;
|
||||||
@@ -33,7 +35,9 @@ class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
|
|||||||
topRight: Radius.circular(16.0),
|
topRight: Radius.circular(16.0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: ListView(
|
child: !_showActions
|
||||||
|
? SizedBox()
|
||||||
|
: ListView(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@@ -43,7 +47,8 @@ class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
child: ChannelName(
|
child: ChannelName(
|
||||||
textStyle: StreamChatTheme.of(context).textTheme.headlineBold,
|
textStyle:
|
||||||
|
StreamChatTheme.of(context).textTheme.headlineBold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -54,8 +59,9 @@ class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
|
|||||||
child: ChannelInfo(
|
child: ChannelInfo(
|
||||||
showTypingIndicator: false,
|
showTypingIndicator: false,
|
||||||
channel: StreamChannel.of(context).channel,
|
channel: StreamChannel.of(context).channel,
|
||||||
textStyle:
|
textStyle: StreamChatTheme.of(context)
|
||||||
StreamChatTheme.of(context).channelPreviewTheme.subtitle,
|
.channelPreviewTheme
|
||||||
|
.subtitle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@@ -66,7 +72,8 @@ class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
|
|||||||
children: [
|
children: [
|
||||||
UserAvatar(
|
UserAvatar(
|
||||||
user: members
|
user: members
|
||||||
.firstWhere((e) => e.user.id != userAsMember.user.id)
|
.firstWhere(
|
||||||
|
(e) => e.user.id != userAsMember.user.id)
|
||||||
.user,
|
.user,
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
maxHeight: 64.0,
|
maxHeight: 64.0,
|
||||||
@@ -81,10 +88,12 @@ class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
members
|
members
|
||||||
.firstWhere((e) => e.user.id != userAsMember.user.id)
|
.firstWhere(
|
||||||
|
(e) => e.user.id != userAsMember.user.id)
|
||||||
.user
|
.user
|
||||||
.name,
|
.name,
|
||||||
style: StreamChatTheme.of(context).textTheme.footnoteBold,
|
style:
|
||||||
|
StreamChatTheme.of(context).textTheme.footnoteBold,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
@@ -153,7 +162,13 @@ class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
|
|||||||
),
|
),
|
||||||
title: 'Leave Group',
|
title: 'Leave Group',
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
_showLeaveDialog();
|
setState(() {
|
||||||
|
_showActions = false;
|
||||||
|
});
|
||||||
|
await _showLeaveDialog();
|
||||||
|
setState(() {
|
||||||
|
_showActions = true;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (isOwner)
|
if (isOwner)
|
||||||
@@ -165,9 +180,16 @@ class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
title: 'Delete Conversation',
|
title: 'Delete Conversation',
|
||||||
titleColor: StreamChatTheme.of(context).colorTheme.accentRed,
|
titleColor:
|
||||||
|
StreamChatTheme.of(context).colorTheme.accentRed,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
_showDeleteDialog();
|
setState(() {
|
||||||
|
_showActions = false;
|
||||||
|
});
|
||||||
|
await _showDeleteDialog();
|
||||||
|
setState(() {
|
||||||
|
_showActions = true;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
OptionListTile(
|
OptionListTile(
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ class MessageActionsModal extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MessageActionsModalState extends State<MessageActionsModal> {
|
class _MessageActionsModalState extends State<MessageActionsModal> {
|
||||||
|
bool _showActions = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return _showMessageOptionsModal();
|
return _showMessageOptionsModal();
|
||||||
@@ -87,13 +89,9 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
|
|||||||
? 1
|
? 1
|
||||||
: (roughSentenceSize == 0 ? 1 : (roughSentenceSize / roughMaxSize));
|
: (roughSentenceSize == 0 ? 1 : (roughSentenceSize / roughMaxSize));
|
||||||
|
|
||||||
return TweenAnimationBuilder<double>(
|
|
||||||
tween: Tween(begin: 0.0, end: 1.0),
|
|
||||||
duration: Duration(milliseconds: 300),
|
|
||||||
curve: Curves.easeInOutBack,
|
|
||||||
builder: (context, val, snapshot) {
|
|
||||||
final hasFileAttachment =
|
final hasFileAttachment =
|
||||||
widget.message.attachments?.any((it) => it.type == 'file') == true;
|
widget.message.attachments?.any((it) => it.type == 'file') == true;
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.translucent,
|
||||||
onTap: () => Navigator.maybePop(context),
|
onTap: () => Navigator.maybePop(context),
|
||||||
@@ -110,7 +108,13 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Transform.scale(
|
if (_showActions)
|
||||||
|
TweenAnimationBuilder<double>(
|
||||||
|
tween: Tween(begin: 0.0, end: 1.0),
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
curve: Curves.easeInOutBack,
|
||||||
|
builder: (context, val, snapshot) {
|
||||||
|
return Transform.scale(
|
||||||
scale: val,
|
scale: val,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
@@ -164,8 +168,9 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
|
|||||||
padding: const EdgeInsets.all(0),
|
padding: const EdgeInsets.all(0),
|
||||||
textPadding: EdgeInsets.symmetric(
|
textPadding: EdgeInsets.symmetric(
|
||||||
vertical: 8.0,
|
vertical: 8.0,
|
||||||
horizontal:
|
horizontal: widget.message.text.isOnlyEmoji
|
||||||
widget.message.text.isOnlyEmoji ? 0 : 16.0,
|
? 0
|
||||||
|
: 16.0,
|
||||||
),
|
),
|
||||||
showReactionPickerIndicator:
|
showReactionPickerIndicator:
|
||||||
widget.showReactions &&
|
widget.showReactions &&
|
||||||
@@ -236,12 +241,12 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showFlagDialog() async {
|
void _showFlagDialog() async {
|
||||||
@@ -273,6 +278,9 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _showDeleteDialog() async {
|
void _showDeleteDialog() async {
|
||||||
|
setState(() {
|
||||||
|
_showActions = false;
|
||||||
|
});
|
||||||
var answer = await showConfirmationDialog(context,
|
var answer = await showConfirmationDialog(context,
|
||||||
title: 'Delete message',
|
title: 'Delete message',
|
||||||
icon: StreamSvgIcon.flag(
|
icon: StreamSvgIcon.flag(
|
||||||
@@ -293,6 +301,10 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
_showErrorAlert();
|
_showErrorAlert();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_showActions = true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1026,7 +1026,11 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
_attachments.add(attachment);
|
_attachments.add(attachment);
|
||||||
});
|
});
|
||||||
final mediaFile = await medium.originFile;
|
|
||||||
|
final mediaFile = await medium.originFile.timeout(
|
||||||
|
Duration(seconds: 5),
|
||||||
|
onTimeout: () => medium.originFile,
|
||||||
|
);
|
||||||
|
|
||||||
var file = PlatformFile(
|
var file = PlatformFile(
|
||||||
path: mediaFile.path,
|
path: mediaFile.path,
|
||||||
|
|||||||
@@ -813,9 +813,7 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
final readList = channel.state?.read?.where((read) {
|
final readList = channel.state?.read?.where((read) {
|
||||||
if (read.user.id == userId) return false;
|
if (read.user.id == userId) return false;
|
||||||
return (read.lastRead.isAfter(message.createdAt) ||
|
return (read.lastRead.isAfter(message.createdAt) ||
|
||||||
read.lastRead.isAtSameMomentAs(message.createdAt)) &&
|
read.lastRead.isAtSameMomentAs(message.createdAt));
|
||||||
(index == 0 ||
|
|
||||||
read.lastRead.isBefore(messages[index - 1].createdAt));
|
|
||||||
})?.toList() ??
|
})?.toList() ??
|
||||||
[];
|
[];
|
||||||
|
|
||||||
|
|||||||
@@ -381,12 +381,14 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
elevation: 0.0,
|
elevation: 0.0,
|
||||||
margin: EdgeInsets.symmetric(
|
margin: EdgeInsets.symmetric(
|
||||||
horizontal:
|
horizontal: (isFailedState
|
||||||
widget.showUserAvatar ==
|
? 15.0
|
||||||
|
: 0.0) +
|
||||||
|
(widget.showUserAvatar ==
|
||||||
DisplayWidget
|
DisplayWidget
|
||||||
.gone
|
.gone
|
||||||
? 0
|
? 0
|
||||||
: 4.0,
|
: 4.0),
|
||||||
),
|
),
|
||||||
shape: widget.shape ??
|
shape: widget.shape ??
|
||||||
RoundedRectangleBorder(
|
RoundedRectangleBorder(
|
||||||
@@ -453,17 +455,11 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
),
|
),
|
||||||
if (isFailedState)
|
if (isFailedState)
|
||||||
Positioned(
|
Positioned(
|
||||||
left: widget.reverse ? -3 : null,
|
left: widget.reverse ? 0 : null,
|
||||||
right: widget.reverse ? null : -9,
|
right: widget.reverse ? null : 0,
|
||||||
bottom: showBottomRow ? 20 : 0,
|
bottom: showBottomRow ? 18 : -2,
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
child: StreamSvgIcon.error(size: 20),
|
child: StreamSvgIcon.error(size: 20),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ class StreamChatState extends State<StreamChat> with WidgetsBindingObserver {
|
|||||||
primaryIconTheme: streamTheme.primaryIconTheme,
|
primaryIconTheme: streamTheme.primaryIconTheme,
|
||||||
accentColor: streamTheme.colorTheme.accentBlue,
|
accentColor: streamTheme.colorTheme.accentBlue,
|
||||||
scaffoldBackgroundColor: streamTheme.colorTheme.white,
|
scaffoldBackgroundColor: streamTheme.colorTheme.white,
|
||||||
buttonTheme: streamTheme.buttonTheme,
|
|
||||||
),
|
),
|
||||||
child: widget.child,
|
child: widget.child,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user