feat: wip message input

This commit is contained in:
Deven Joshi
2020-10-16 17:32:59 +05:30
parent ef7e224c9e
commit 21f22f65d6
+10 -54
View File
@@ -202,7 +202,7 @@ class MessageInputState extends State<MessageInput> {
Flex _buildTextField(BuildContext context) {
return Flex(
direction: Axis.horizontal,
crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
if (!widget.disableAttachments) _buildAttachmentButton(),
if (widget.actionsLocation == ActionsLocation.left)
@@ -222,7 +222,7 @@ class MessageInputState extends State<MessageInput> {
? CrossFadeState.showFirst
: CrossFadeState.showSecond,
firstChild: _buildSendButton(context),
secondChild: _buildIdleSendButton(context),
secondChild: SizedBox(),
duration: Duration(milliseconds: 300),
alignment: Alignment.center,
);
@@ -230,7 +230,6 @@ class MessageInputState extends State<MessageInput> {
Expanded _buildTextInput(BuildContext context) {
return Expanded(
child: Center(
child: LimitedBox(
maxHeight: widget.maxHeight,
child: TextField(
@@ -282,14 +281,11 @@ class MessageInputState extends State<MessageInput> {
decoration: InputDecoration(
hintText: 'Write a message',
prefixText: ' ',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32),
),
border: OutlineInputBorder(),
),
textCapitalization: TextCapitalization.sentences,
),
),
),
);
}
@@ -447,9 +443,7 @@ class MessageInputState extends State<MessageInput> {
leading: UserAvatar(
user: m.user,
),
title: Text('${m.user.name}', style: TextStyle(fontWeight: FontWeight.bold),),
subtitle: Text('${m.userId}'),
trailing: Icon(Icons.alternate_email, color: StreamChatTheme.of(context).accentColor,),
title: Text('${m.user.name}'),
onTap: () {
_mentionedUsers.add(m.user);
@@ -608,9 +602,8 @@ class MessageInputState extends State<MessageInput> {
}
}
Widget _buildAttachmentButton() {
return Center(
child: Material(
Material _buildAttachmentButton() {
return Material(
clipBehavior: Clip.hardEdge,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(32),
@@ -624,8 +617,7 @@ class MessageInputState extends State<MessageInput> {
child: Icon(
Icons.attach_file_sharp,
),
angle: 0.4,
),
angle: - 0.3,
),
),
);
@@ -843,60 +835,24 @@ class MessageInputState extends State<MessageInput> {
return res.file;
}
Widget _buildIdleSendButton(BuildContext context) {
return IconTheme(
data:
StreamChatTheme.of(context).channelTheme.messageInputButtonIconTheme,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Material(
clipBehavior: Clip.hardEdge,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(32),
),
color: Colors.grey,
child: IconButton(
key: Key('sendButton'),
onPressed: () {
sendMessage();
},
icon: Icon(
Icons.arrow_forward,
color: Colors.white,
size: 16.0,
),
),
),
),
),
);
}
Widget _buildSendButton(BuildContext context) {
return IconTheme(
data:
StreamChatTheme.of(context).channelTheme.messageInputButtonIconTheme,
child: Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Material(
clipBehavior: Clip.hardEdge,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(32),
),
color: StreamChatTheme.of(context).accentColor,
color: Colors.transparent,
child: IconButton(
key: Key('sendButton'),
onPressed: () {
sendMessage();
},
icon: Icon(
Icons.arrow_upward,
color: Colors.white,
size: 16.0,
),
),
Icons.send,
color: StreamChatTheme.of(context).accentColor,
),
),
),