Merge pull request #221 from GetStream/hotfix/qa5.1

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