@@ -70,6 +70,10 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var userMember = snapshot.data
|
||||||
|
.firstWhere((e) => e.user.id == StreamChat.of(context).user.id);
|
||||||
|
var isOwner = userMember.role == 'owner';
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow,
|
backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
@@ -161,7 +165,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
height: 8.0,
|
height: 8.0,
|
||||||
color: StreamChatTheme.of(context).colorTheme.greyGainsboro,
|
color: StreamChatTheme.of(context).colorTheme.greyGainsboro,
|
||||||
),
|
),
|
||||||
_buildNameTile(),
|
if (isOwner) _buildNameTile(),
|
||||||
_buildOptionListTiles(),
|
_buildOptionListTiles(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -156,6 +156,9 @@ class _HomePageState extends State<HomePage> {
|
|||||||
onNewChatButtonTap: () {
|
onNewChatButtonTap: () {
|
||||||
Navigator.pushNamed(context, Routes.NEW_CHAT);
|
Navigator.pushNamed(context, Routes.NEW_CHAT);
|
||||||
},
|
},
|
||||||
|
preNavigationCallback: () {
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
|
},
|
||||||
),
|
),
|
||||||
drawer: _buildDrawer(context, user),
|
drawer: _buildDrawer(context, user),
|
||||||
drawerEdgeDragWidth: 50,
|
drawerEdgeDragWidth: 50,
|
||||||
@@ -519,6 +522,7 @@ class _ChannelListPageState extends State<ChannelListPage> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
onItemTap: (messageResponse) async {
|
onItemTap: (messageResponse) async {
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
final client = StreamChat.of(context).client;
|
final client = StreamChat.of(context).client;
|
||||||
final message = messageResponse.message;
|
final message = messageResponse.message;
|
||||||
final channel = client.channel(
|
final channel = client.channel(
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
this.onUserAvatarTap,
|
this.onUserAvatarTap,
|
||||||
this.onNewChatButtonTap,
|
this.onNewChatButtonTap,
|
||||||
this.showConnectionStateTile = false,
|
this.showConnectionStateTile = false,
|
||||||
|
this.preNavigationCallback,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
/// Pass this if you don't have a [Client] in your widget tree.
|
/// Pass this if you don't have a [Client] in your widget tree.
|
||||||
@@ -72,6 +73,8 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
|
|
||||||
final bool showConnectionStateTile;
|
final bool showConnectionStateTile;
|
||||||
|
|
||||||
|
final VoidCallback preNavigationCallback;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final _client = client ?? StreamChat.of(context).client;
|
final _client = client ?? StreamChat.of(context).client;
|
||||||
@@ -110,8 +113,13 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
child: UserAvatar(
|
child: UserAvatar(
|
||||||
user: user,
|
user: user,
|
||||||
showOnlineStatus: false,
|
showOnlineStatus: false,
|
||||||
onTap:
|
onTap: onUserAvatarTap ??
|
||||||
onUserAvatarTap ?? (_) => Scaffold.of(context).openDrawer(),
|
(_) {
|
||||||
|
if (preNavigationCallback != null) {
|
||||||
|
preNavigationCallback();
|
||||||
|
}
|
||||||
|
Scaffold.of(context).openDrawer();
|
||||||
|
},
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
constraints: BoxConstraints.tightFor(
|
constraints: BoxConstraints.tightFor(
|
||||||
height: 40,
|
height: 40,
|
||||||
|
|||||||
@@ -433,83 +433,80 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
_buildAttachments(),
|
_buildAttachments(),
|
||||||
LimitedBox(
|
LimitedBox(
|
||||||
maxHeight: widget.maxHeight,
|
maxHeight: widget.maxHeight,
|
||||||
child: SizedBox(
|
child: TextField(
|
||||||
height: 40,
|
key: Key('messageInputText'),
|
||||||
child: TextField(
|
enabled: _inputEnabled,
|
||||||
key: Key('messageInputText'),
|
minLines: null,
|
||||||
enabled: _inputEnabled,
|
maxLines: null,
|
||||||
minLines: null,
|
onSubmitted: (_) => sendMessage(),
|
||||||
maxLines: null,
|
keyboardType: widget.keyboardType,
|
||||||
onSubmitted: (_) => sendMessage(),
|
controller: textEditingController,
|
||||||
keyboardType: widget.keyboardType,
|
focusNode: _focusNode,
|
||||||
controller: textEditingController,
|
style: theme.textTheme.body,
|
||||||
focusNode: _focusNode,
|
autofocus: false,
|
||||||
style: theme.textTheme.body,
|
textAlignVertical: TextAlignVertical.center,
|
||||||
autofocus: false,
|
decoration: InputDecoration(
|
||||||
textAlignVertical: TextAlignVertical.center,
|
isDense: true,
|
||||||
decoration: InputDecoration(
|
hintText: _getHint(),
|
||||||
isDense: true,
|
hintStyle: theme.textTheme.body.copyWith(
|
||||||
hintText: _getHint(),
|
color: theme.colorTheme.grey,
|
||||||
hintStyle: theme.textTheme.body.copyWith(
|
|
||||||
color: theme.colorTheme.grey,
|
|
||||||
),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Colors.transparent)),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Colors.transparent)),
|
|
||||||
enabledBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Colors.transparent)),
|
|
||||||
errorBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Colors.transparent)),
|
|
||||||
disabledBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Colors.transparent)),
|
|
||||||
contentPadding: const EdgeInsets.fromLTRB(16, 12, 13, 11),
|
|
||||||
prefixIcon: _commandEnabled
|
|
||||||
? Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
color: theme.colorTheme.accentBlue,
|
|
||||||
),
|
|
||||||
height: 24,
|
|
||||||
margin: const EdgeInsets.all(8.0),
|
|
||||||
padding: const EdgeInsets.only(right: 8, left: 4),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
StreamSvgIcon.lightning(
|
|
||||||
color: Colors.white,
|
|
||||||
size: 16.0,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
_chosenCommand?.name?.toUpperCase() ?? '',
|
|
||||||
style: StreamChatTheme.of(context)
|
|
||||||
.textTheme
|
|
||||||
.footnoteBold
|
|
||||||
.copyWith(
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
suffixIcon: _commandEnabled
|
|
||||||
? IconButton(
|
|
||||||
icon: StreamSvgIcon.close_small(),
|
|
||||||
splashRadius: 24,
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
constraints: BoxConstraints.tightFor(
|
|
||||||
height: 24,
|
|
||||||
width: 24,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
setState(() => _commandEnabled = false);
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
),
|
),
|
||||||
textCapitalization: TextCapitalization.sentences,
|
border: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.transparent)),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.transparent)),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.transparent)),
|
||||||
|
errorBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.transparent)),
|
||||||
|
disabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.transparent)),
|
||||||
|
contentPadding: const EdgeInsets.fromLTRB(16, 12, 13, 11),
|
||||||
|
prefixIcon: _commandEnabled
|
||||||
|
? Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: theme.colorTheme.accentBlue,
|
||||||
|
),
|
||||||
|
height: 24,
|
||||||
|
margin: const EdgeInsets.all(8.0),
|
||||||
|
padding: const EdgeInsets.only(right: 8, left: 4),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
StreamSvgIcon.lightning(
|
||||||
|
color: Colors.white,
|
||||||
|
size: 16.0,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
_chosenCommand?.name?.toUpperCase() ?? '',
|
||||||
|
style: StreamChatTheme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.footnoteBold
|
||||||
|
.copyWith(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
suffixIcon: _commandEnabled
|
||||||
|
? IconButton(
|
||||||
|
icon: StreamSvgIcon.close_small(),
|
||||||
|
splashRadius: 24,
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
constraints: BoxConstraints.tightFor(
|
||||||
|
height: 24,
|
||||||
|
width: 24,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
setState(() => _commandEnabled = false);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: null,
|
||||||
),
|
),
|
||||||
|
textCapitalization: TextCapitalization.sentences,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@@ -1042,15 +1039,9 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
final mediaInfo = await CompressVideoService.compressVideo(file.path);
|
final mediaInfo = await CompressVideoService.compressVideo(file.path);
|
||||||
|
|
||||||
if (mediaInfo.filesize / (1024 * 1024) > _kMaxAttachmentSize) {
|
if (mediaInfo.filesize / (1024 * 1024) > _kMaxAttachmentSize) {
|
||||||
// ignore: deprecated_member_use
|
_showErrorAlert(
|
||||||
Scaffold.of(context).showSnackBar(
|
'The file is too large to upload. The file size limit is 20MB. We tried compressing it, but it was not enough.',
|
||||||
SnackBar(
|
|
||||||
content: Text(
|
|
||||||
'The file is too large to upload. The file size limit is 20MB. We tried compressing it, but it was not enough.',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_attachments.remove(attachment);
|
_attachments.remove(attachment);
|
||||||
});
|
});
|
||||||
@@ -1063,13 +1054,8 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
path: mediaInfo.path,
|
path: mediaInfo.path,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// ignore: deprecated_member_use
|
_showErrorAlert(
|
||||||
Scaffold.of(context).showSnackBar(
|
'The file is too large to upload. The file size limit is 20MB.',
|
||||||
SnackBar(
|
|
||||||
content: Text(
|
|
||||||
'The file is too large to upload. The file size limit is 20MB',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2021,12 +2007,8 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// ignore: deprecated_member_use
|
// ignore: deprecated_member_use
|
||||||
Scaffold.of(context).showSnackBar(
|
_showErrorAlert(
|
||||||
SnackBar(
|
'The file is too large to upload. The file size limit is 20MB.',
|
||||||
content: Text(
|
|
||||||
'The file is too large to upload. The file size limit is 20MB',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
setState(() {
|
setState(() {
|
||||||
_attachments.remove(attachment);
|
_attachments.remove(attachment);
|
||||||
@@ -2279,6 +2261,77 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _showErrorAlert(String description) {
|
||||||
|
showModalBottomSheet(
|
||||||
|
backgroundColor: StreamChatTheme.of(context).colorTheme.white,
|
||||||
|
context: context,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(16.0),
|
||||||
|
topRight: Radius.circular(16.0),
|
||||||
|
)),
|
||||||
|
builder: (context) {
|
||||||
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 26.0,
|
||||||
|
),
|
||||||
|
StreamSvgIcon.error(
|
||||||
|
color: StreamChatTheme.of(context).colorTheme.accentRed,
|
||||||
|
size: 24.0,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 26.0,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Something went wrong',
|
||||||
|
style: StreamChatTheme.of(context).textTheme.headlineBold,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 7.0,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
|
child: Text(
|
||||||
|
description,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 36.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
color:
|
||||||
|
StreamChatTheme.of(context).colorTheme.black.withOpacity(.08),
|
||||||
|
height: 1.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
FlatButton(
|
||||||
|
child: Text(
|
||||||
|
'OK',
|
||||||
|
style: StreamChatTheme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.bodyBold
|
||||||
|
.copyWith(
|
||||||
|
color: StreamChatTheme.of(context)
|
||||||
|
.colorTheme
|
||||||
|
.accentBlue),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void _parseExistingMessage(Message message) {
|
void _parseExistingMessage(Message message) {
|
||||||
textEditingController.text = message.text;
|
textEditingController.text = message.text;
|
||||||
|
|
||||||
|
|||||||
@@ -956,7 +956,10 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
end: colorTheme.white.withOpacity(0),
|
end: colorTheme.white.withOpacity(0),
|
||||||
),
|
),
|
||||||
duration: const Duration(seconds: 3),
|
duration: const Duration(seconds: 3),
|
||||||
child: child,
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 4.0),
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
onEnd: () => initialMessageHighlightComplete = true,
|
onEnd: () => initialMessageHighlightComplete = true,
|
||||||
builder: (_, color, child) {
|
builder: (_, color, child) {
|
||||||
return Container(
|
return Container(
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ class ThreadHeader extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AppBar(
|
return AppBar(
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
|
brightness: Theme.of(context).brightness,
|
||||||
elevation: 1,
|
elevation: 1,
|
||||||
leading: showBackButton
|
leading: showBackButton
|
||||||
? StreamBackButton(
|
? StreamBackButton(
|
||||||
|
|||||||
Reference in New Issue
Block a user