Merge pull request #116 from GetStream/qa-fix-dj

Qa fix dj
This commit is contained in:
Salvatore Giordano
2020-10-29 15:18:51 +01:00
committed by GitHub
3 changed files with 90 additions and 36 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

+88 -36
View File
@@ -223,10 +223,14 @@ class MessageInputState extends State<MessageInput> {
return Row( return Row(
children: [ children: [
Checkbox( Checkbox(
value: _sendAsDm, value: _sendAsDm,
onChanged: (val) => setState(() { onChanged: (val) => setState(
_sendAsDm = val; () {
})), _sendAsDm = val;
},
),
activeColor: StreamChatTheme.of(context).accentColor,
),
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Text('Send also as direct message'), child: Text('Send also as direct message'),
@@ -278,21 +282,21 @@ class MessageInputState extends State<MessageInput> {
Expanded _buildTextInput(BuildContext context) { Expanded _buildTextInput(BuildContext context) {
return Expanded( return Expanded(
child: Center( child: Center(
child: LimitedBox( child: Container(
maxHeight: widget.maxHeight, clipBehavior: Clip.antiAlias,
child: Container( decoration: BoxDecoration(
clipBehavior: Clip.antiAlias, borderRadius: BorderRadius.circular(32.0),
decoration: BoxDecoration( border: Border.all(
borderRadius: BorderRadius.circular(32.0), color: Colors.grey,
border: Border.all(
color: Colors.grey,
),
), ),
child: Column( ),
mainAxisSize: MainAxisSize.min, child: Column(
children: [ mainAxisSize: MainAxisSize.min,
_buildAttachments(), children: [
TextField( _buildAttachments(),
LimitedBox(
maxHeight: widget.maxHeight,
child: TextField(
key: Key('messageInputText'), key: Key('messageInputText'),
enabled: _inputEnabled, enabled: _inputEnabled,
minLines: null, minLines: null,
@@ -360,7 +364,10 @@ class MessageInputState extends State<MessageInput> {
autofocus: false, autofocus: false,
textAlignVertical: TextAlignVertical.center, textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration( decoration: InputDecoration(
hintText: 'Write a message', hintText:
(_commandEnabled && _chosenCommand.name == 'giphy')
? 'Search GIFs'
: 'Write a message',
prefixText: _commandEnabled ? null : ' ', prefixText: _commandEnabled ? null : ' ',
border: OutlineInputBorder( border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent)), borderSide: BorderSide(color: Colors.transparent)),
@@ -404,8 +411,8 @@ class MessageInputState extends State<MessageInput> {
), ),
textCapitalization: TextCapitalization.sentences, textCapitalization: TextCapitalization.sentences,
), ),
], )
), ],
), ),
), ),
), ),
@@ -467,6 +474,9 @@ class MessageInputState extends State<MessageInput> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Card( child: Card(
elevation: 2.0, elevation: 2.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
color: StreamChatTheme.of(context).primaryColor, color: StreamChatTheme.of(context).primaryColor,
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: Container( child: Container(
@@ -503,6 +513,18 @@ class MessageInputState extends State<MessageInput> {
...commands ...commands
.map( .map(
(c) => ListTile( (c) => ListTile(
leading: c.name == 'giphy'
? CircleAvatar(
backgroundColor: Colors.black,
child: Image.asset(
'images/giphy_icon.png',
package: 'stream_chat_flutter',
width: 16.0,
height: 16.0,
),
maxRadius: 12.0,
)
: null,
title: Text.rich( title: Text.rich(
TextSpan( TextSpan(
text: '${c.name.capitalize()}', text: '${c.name.capitalize()}',
@@ -525,7 +547,7 @@ class MessageInputState extends State<MessageInput> {
color: Colors.white, color: Colors.white,
size: 12.5, size: 12.5,
), ),
maxRadius: 15, maxRadius: 12,
), ),
//subtitle: Text(c.description), //subtitle: Text(c.description),
onTap: () { onTap: () {
@@ -576,6 +598,9 @@ class MessageInputState extends State<MessageInput> {
margin: EdgeInsets.all(8.0), margin: EdgeInsets.all(8.0),
elevation: 2.0, elevation: 2.0,
color: StreamChatTheme.of(context).primaryColor, color: StreamChatTheme.of(context).primaryColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: Container( child: Container(
constraints: BoxConstraints.loose(Size.fromHeight(400)), constraints: BoxConstraints.loose(Size.fromHeight(400)),
@@ -605,9 +630,9 @@ class MessageInputState extends State<MessageInput> {
'${m.user.name}', '${m.user.name}',
style: TextStyle(fontWeight: FontWeight.bold), style: TextStyle(fontWeight: FontWeight.bold),
), ),
subtitle: Text('${m.userId}'), subtitle: Text('@${m.userId}'),
trailing: Icon( trailing: Icon(
Icons.alternate_email, StreamIcons.at_mention,
color: StreamChatTheme.of(context).accentColor, color: StreamChatTheme.of(context).accentColor,
), ),
onTap: () { onTap: () {
@@ -782,7 +807,10 @@ class MessageInputState extends State<MessageInput> {
child: Padding( child: Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 4.0, right: 8.0, top: 8.0, bottom: 8.0), left: 4.0, right: 8.0, top: 8.0, bottom: 8.0),
child: Icon(StreamIcons.lightning), child: Icon(
StreamIcons.lightning,
color: Color(0xFF000000).withAlpha(128),
),
), ),
onTap: () { onTap: () {
if (_commandsOverlay == null) { if (_commandsOverlay == null) {
@@ -804,7 +832,10 @@ class MessageInputState extends State<MessageInput> {
child: Padding( child: Padding(
padding: padding:
EdgeInsets.only(left: 8.0, right: padding, top: 8.0, bottom: 8.0), EdgeInsets.only(left: 8.0, right: padding, top: 8.0, bottom: 8.0),
child: Icon(StreamIcons.attach), child: Icon(
StreamIcons.attach,
color: Color(0xFF000000).withAlpha(128),
),
), ),
onTap: () { onTap: () {
showAttachmentModal(); showAttachmentModal();
@@ -1037,7 +1068,7 @@ class MessageInputState extends State<MessageInput> {
sendMessage(); sendMessage();
}, },
child: Icon( child: Icon(
StreamIcons.send_message, _getIdleSendIcon(),
color: Colors.grey, color: Colors.grey,
), ),
)), )),
@@ -1056,21 +1087,42 @@ class MessageInputState extends State<MessageInput> {
onTap: () { onTap: () {
sendMessage(); sendMessage();
}, },
child: Transform.rotate( child: _getSendIcon(),
angle: widget.editMessage == null ? -pi / 2 : 0,
child: Icon(
widget.editMessage == null
? StreamIcons.send_message
: StreamIcons.check_send,
color: StreamChatTheme.of(context).accentColor,
),
),
), ),
), ),
), ),
); );
} }
IconData _getIdleSendIcon() {
if (_commandEnabled) {
return StreamIcons.search;
} else {
return StreamIcons.send_message;
}
}
Widget _getSendIcon() {
if (widget.editMessage != null) {
return Icon(
StreamIcons.check_send,
color: StreamChatTheme.of(context).accentColor,
);
} else if (_commandEnabled) {
return Icon(
StreamIcons.search,
color: StreamChatTheme.of(context).accentColor,
);
} else {
return Transform.rotate(
angle: -pi / 2,
child: Icon(
StreamIcons.send_message,
color: StreamChatTheme.of(context).accentColor,
));
}
}
/// Sends the current message /// Sends the current message
void sendMessage() async { void sendMessage() async {
var text = textEditingController.text.trim(); var text = textEditingController.text.trim();
+2
View File
@@ -34,6 +34,8 @@ dependencies:
widgets_visibility_provider: ^2.0.2 widgets_visibility_provider: ^2.0.2
flutter: flutter:
assets:
- images/giphy_icon.png
fonts: fonts:
- family: stream-icons - family: stream-icons
fonts: fonts: