Merge branch 'feature/new-ui' into hotfix/media-picker

This commit is contained in:
Salvatore Giordano
2020-11-25 16:17:58 +01:00
121 changed files with 1374 additions and 1468 deletions
+72 -93
View File
@@ -1,6 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'dart:math';
import 'package:emojis/emoji.dart';
import 'package:file_picker/file_picker.dart';
@@ -18,6 +17,7 @@ import 'package:stream_chat/stream_chat.dart';
import 'package:stream_chat_flutter/src/media_list_view.dart';
import 'package:stream_chat_flutter/src/message_list_view.dart';
import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
import 'package:stream_chat_flutter/src/stream_svg_icon.dart';
import 'package:stream_chat_flutter/src/user_avatar.dart';
import 'package:stream_chat_flutter/src/video_thumbnail.dart';
import 'package:substring_highlight/substring_highlight.dart';
@@ -287,8 +287,7 @@ class MessageInputState extends State<MessageInput> {
crossFadeState: _sendAsDm
? CrossFadeState.showFirst
: CrossFadeState.showSecond,
firstChild: Icon(
StreamIcons.check,
firstChild: StreamSvgIcon.check(
size: 16.0,
color: Colors.white,
),
@@ -333,8 +332,7 @@ class MessageInputState extends State<MessageInput> {
_actionsShrunk = false;
});
},
icon: Icon(
StreamIcons.circle_left,
icon: StreamSvgIcon.emptyCircleLeft(
color: StreamChatTheme.of(context).accentColor,
),
),
@@ -406,8 +404,7 @@ class MessageInputState extends State<MessageInput> {
_chosenCommand?.name ?? "",
style: TextStyle(color: Colors.white),
),
avatar: Icon(
StreamIcons.lightning,
avatar: StreamSvgIcon.lightning(
color: Colors.white,
),
),
@@ -434,26 +431,36 @@ class MessageInputState extends State<MessageInput> {
);
}
Timer _debounce;
void _onChanged(BuildContext context, String s) {
StreamChannel.of(context).channel.keyStroke().catchError((e) {});
if (_debounce?.isActive == true) _debounce.cancel();
_debounce = Timer(
const Duration(milliseconds: 350),
() {
if (!mounted) {
return;
}
StreamChannel.of(context).channel.keyStroke().catchError((e) {});
setState(() {
_messageIsPresent = s.trim().isNotEmpty;
_actionsShrunk = s.trim().isNotEmpty;
});
setState(() {
_messageIsPresent = s.trim().isNotEmpty;
_actionsShrunk = s.trim().isNotEmpty;
});
_commandsOverlay?.remove();
_commandsOverlay = null;
_mentionsOverlay?.remove();
_mentionsOverlay = null;
_emojiOverlay?.remove();
_emojiOverlay = null;
_commandsOverlay?.remove();
_commandsOverlay = null;
_mentionsOverlay?.remove();
_mentionsOverlay = null;
_emojiOverlay?.remove();
_emojiOverlay = null;
_checkCommands(s.trim(), context);
_checkCommands(s.trim(), context);
_checkMentions(s, context);
_checkMentions(s, context);
_checkEmoji(s, context);
_checkEmoji(s, context);
},
);
}
String _getHint() {
@@ -582,9 +589,9 @@ class MessageInputState extends State<MessageInput> {
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8.0),
child: Icon(
StreamIcons.lightning,
horizontal: 8.0,
),
child: StreamSvgIcon.lightning(
color: StreamChatTheme.of(context)
.accentColor,
),
@@ -622,8 +629,7 @@ class MessageInputState extends State<MessageInput> {
trailing: CircleAvatar(
backgroundColor:
StreamChatTheme.of(context).accentColor,
child: Icon(
StreamIcons.lightning,
child: StreamSvgIcon.lightning(
color: Colors.white,
size: 12.5,
),
@@ -659,8 +665,7 @@ class MessageInputState extends State<MessageInput> {
mainAxisAlignment: MainAxisAlignment.start,
children: [
IconButton(
icon: Icon(
StreamIcons.picture,
icon: StreamSvgIcon.pictures(
size: 24,
color: _filePickerIndex == 0
? StreamChatTheme.of(context).accentColor
@@ -673,8 +678,7 @@ class MessageInputState extends State<MessageInput> {
},
),
IconButton(
icon: Icon(
StreamIcons.folder,
icon: StreamSvgIcon.files(
size: 24,
color: _filePickerIndex == 1
? StreamChatTheme.of(context).accentColor
@@ -685,11 +689,8 @@ class MessageInputState extends State<MessageInput> {
},
),
IconButton(
icon: SvgPicture.asset(
'svgs/icon_camera.svg',
package: 'stream_chat_flutter',
height: 24,
width: 24,
icon: StreamSvgIcon.camera(
size: 24,
color: _filePickerIndex == 2
? StreamChatTheme.of(context).accentColor
: Colors.black.withOpacity(0.5),
@@ -699,10 +700,9 @@ class MessageInputState extends State<MessageInput> {
},
),
IconButton(
icon: Icon(
StreamIcons.record,
icon: StreamSvgIcon.record(
size: 24,
color: _filePickerIndex == 2
color: _filePickerIndex == 3
? StreamChatTheme.of(context).accentColor
: Colors.black.withOpacity(0.5),
),
@@ -1054,8 +1054,7 @@ class MessageInputState extends State<MessageInput> {
fontWeight: FontWeight.bold),
),
subtitle: Text('@${m.userId}'),
trailing: Icon(
StreamIcons.at_mention,
trailing: StreamSvgIcon.mentions(
color: StreamChatTheme.of(context)
.accentColor,
),
@@ -1152,8 +1151,7 @@ class MessageInputState extends State<MessageInput> {
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 8.0),
child: Icon(
StreamIcons.smile,
child: StreamSvgIcon.smile(
color: StreamChatTheme.of(context).accentColor,
),
),
@@ -1288,8 +1286,7 @@ class MessageInputState extends State<MessageInput> {
},
fillColor: Colors.black.withOpacity(.5),
child: Center(
child: Icon(
StreamIcons.close,
child: StreamSvgIcon.close(
size: 24,
color: Colors.white,
),
@@ -1361,8 +1358,7 @@ class MessageInputState extends State<MessageInput> {
child: Padding(
padding:
const EdgeInsets.only(left: 4.0, right: 8.0, top: 8.0, bottom: 8.0),
child: Icon(
StreamIcons.lightning,
child: StreamSvgIcon.lightning(
color: Color(0xFF000000).withAlpha(128),
),
),
@@ -1385,8 +1381,7 @@ class MessageInputState extends State<MessageInput> {
child: Padding(
padding:
EdgeInsets.only(left: 8.0, right: padding, top: 8.0, bottom: 8.0),
child: Icon(
StreamIcons.attach,
child: StreamSvgIcon.attach(
color: _openFilePickerSection
? StreamChatTheme.of(context).accentColor
: Color(0xFF000000).withAlpha(128),
@@ -1675,69 +1670,53 @@ class MessageInputState extends State<MessageInput> {
}
Widget _buildIdleSendButton(BuildContext context) {
return IconTheme(
data:
StreamChatTheme.of(context).channelTheme.messageInputButtonIconTheme,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: InkWell(
onTap: () {
sendMessage();
},
child: Icon(
_getIdleSendIcon(),
color: Colors.grey,
),
)),
),
return Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: InkWell(
onTap: () {
sendMessage();
},
child: StreamSvgIcon(
assetName: _getIdleSendIcon(),
color: Colors.grey,
),
)),
);
}
Widget _buildSendButton(BuildContext context) {
return IconTheme(
data:
StreamChatTheme.of(context).channelTheme.messageInputButtonIconTheme,
child: Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: InkWell(
onTap: () {
sendMessage();
},
child: _getSendIcon(),
return Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: InkWell(
onTap: () {
sendMessage();
},
child: StreamSvgIcon(
assetName: _getSendIcon(),
color: StreamChatTheme.of(context).accentColor,
),
),
),
);
}
IconData _getIdleSendIcon() {
String _getIdleSendIcon() {
if (_commandEnabled) {
return StreamIcons.search;
return 'Icon_search.svg';
} else {
return StreamIcons.send_message;
return 'Icon_circle_up.svg';
}
}
Widget _getSendIcon() {
String _getSendIcon() {
if (widget.editMessage != null) {
return Icon(
StreamIcons.check_send,
color: StreamChatTheme.of(context).accentColor,
);
return 'Icon_circle_right.svg';
} else if (_commandEnabled) {
return Icon(
StreamIcons.search,
color: StreamChatTheme.of(context).accentColor,
);
return 'Icon_search.svg';
} else {
return Transform.rotate(
angle: -pi / 2,
child: Icon(
StreamIcons.send_message,
color: StreamChatTheme.of(context).accentColor,
));
return 'Icon_circle_right.svg';
}
}