[Message Input] fix icons padding

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2020-12-23 19:03:28 +05:30
parent 47dafef2ac
commit db7593b622
+72 -79
View File
@@ -248,7 +248,7 @@ class MessageInputState extends State<MessageInput> {
], ],
), ),
Padding( Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0), padding: const EdgeInsets.all(8.0),
child: _buildTextField(context), child: _buildTextField(context),
), ),
if (widget.parentMessage != null) if (widget.parentMessage != null)
@@ -367,17 +367,23 @@ class MessageInputState extends State<MessageInput> {
return AnimatedCrossFade( return AnimatedCrossFade(
crossFadeState: crossFadeState:
_actionsShrunk ? CrossFadeState.showFirst : CrossFadeState.showSecond, _actionsShrunk ? CrossFadeState.showFirst : CrossFadeState.showSecond,
firstChild: IconButton( firstChild: Padding(
onPressed: () { padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8),
setState(() { child: IconButton(
_actionsShrunk = false; onPressed: () {
}); setState(() {
}, _actionsShrunk = false;
visualDensity: VisualDensity.compact, });
splashRadius: 24, },
padding: const EdgeInsets.all(0), icon: StreamSvgIcon.emptyCircleLeft(
icon: StreamSvgIcon.emptyCircleLeft( color: StreamChatTheme.of(context).accentColor,
color: StreamChatTheme.of(context).accentColor, ),
padding: const EdgeInsets.all(0),
constraints: BoxConstraints.tightFor(
height: 24,
width: 24,
),
splashRadius: 24,
), ),
), ),
secondChild: Row( secondChild: Row(
@@ -456,7 +462,7 @@ class MessageInputState extends State<MessageInput> {
StreamChatTheme.of(context).accentColor, StreamChatTheme.of(context).accentColor,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
labelPadding: labelPadding:
EdgeInsets.symmetric(horizontal: 9.0), EdgeInsets.symmetric(horizontal: 8.0),
label: Row( label: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@@ -466,7 +472,7 @@ class MessageInputState extends State<MessageInput> {
size: 16.0, size: 16.0,
), ),
Text( Text(
_chosenCommand?.name?.toUpperCase() ?? "", _chosenCommand?.name?.toUpperCase() ?? '',
style: TextStyle( style: TextStyle(
color: Colors.white, fontSize: 12.0), color: Colors.white, fontSize: 12.0),
), ),
@@ -478,17 +484,12 @@ class MessageInputState extends State<MessageInput> {
suffixIcon: _commandEnabled suffixIcon: _commandEnabled
? IconButton( ? IconButton(
icon: StreamSvgIcon.close_small(), icon: StreamSvgIcon.close_small(),
splashRadius: 24,
onPressed: () { onPressed: () {
setState(() { setState(() => _commandEnabled = false);
_commandEnabled = false;
});
}, },
) )
: null, : null,
suffixIconConstraints: BoxConstraints(
maxHeight: 24.0,
maxWidth: 40.0,
),
), ),
textCapitalization: TextCapitalization.sentences, textCapitalization: TextCapitalization.sentences,
), ),
@@ -1548,7 +1549,7 @@ class MessageInputState extends State<MessageInput> {
Widget _buildCommandButton() { Widget _buildCommandButton() {
return Padding( return Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8),
child: IconButton( child: IconButton(
icon: StreamSvgIcon.lightning( icon: StreamSvgIcon.lightning(
color: _commandsOverlay != null color: _commandsOverlay != null
@@ -1588,42 +1589,38 @@ class MessageInputState extends State<MessageInput> {
} }
Widget _buildAttachmentButton() { Widget _buildAttachmentButton() {
var padding = widget.editMessage == null ? 4.0 : 8.0; return Padding(
return Center( padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8),
child: Padding( child: IconButton(
padding: icon: StreamSvgIcon.attach(
EdgeInsets.only(left: 8.0, right: padding, top: 8.0, bottom: 8.0), color: _openFilePickerSection
child: IconButton( ? StreamChatTheme.of(context).accentColor
icon: StreamSvgIcon.attach( : Color(0xFF000000).withAlpha(128),
color: _openFilePickerSection
? StreamChatTheme.of(context).accentColor
: Color(0xFF000000).withAlpha(128),
),
padding: const EdgeInsets.all(0),
constraints: BoxConstraints.tightFor(
height: 24,
width: 24,
),
splashRadius: 24,
onPressed: () async {
_emojiOverlay?.remove();
_emojiOverlay = null;
_commandsOverlay?.remove();
_commandsOverlay = null;
_mentionsOverlay?.remove();
_mentionsOverlay = null;
if (_openFilePickerSection) {
setState(() {
_animateContainer = true;
_openFilePickerSection = false;
_filePickerSize = _kMinMediaPickerSize;
});
} else {
showAttachmentModal();
}
},
), ),
padding: const EdgeInsets.all(0),
constraints: BoxConstraints.tightFor(
height: 24,
width: 24,
),
splashRadius: 24,
onPressed: () async {
_emojiOverlay?.remove();
_emojiOverlay = null;
_commandsOverlay?.remove();
_commandsOverlay = null;
_mentionsOverlay?.remove();
_mentionsOverlay = null;
if (_openFilePickerSection) {
setState(() {
_animateContainer = true;
_openFilePickerSection = false;
_filePickerSize = _kMinMediaPickerSize;
});
} else {
showAttachmentModal();
}
},
), ),
); );
} }
@@ -1924,33 +1921,29 @@ class MessageInputState extends State<MessageInput> {
Widget _buildIdleSendButton(BuildContext context) { Widget _buildIdleSendButton(BuildContext context) {
return Padding( return Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8),
child: Center( child: StreamSvgIcon(
child: StreamSvgIcon( assetName: _getIdleSendIcon(),
assetName: _getIdleSendIcon(), color: Colors.grey,
color: Colors.grey,
),
), ),
); );
} }
Widget _buildSendButton(BuildContext context) { Widget _buildSendButton(BuildContext context) {
return Center( return Padding(
child: Padding( padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8),
padding: const EdgeInsets.all(8.0), child: IconButton(
child: IconButton( onPressed: sendMessage,
onPressed: sendMessage, visualDensity: VisualDensity.compact,
visualDensity: VisualDensity.compact, padding: const EdgeInsets.all(0),
padding: const EdgeInsets.all(0), splashRadius: 24,
splashRadius: 24, constraints: BoxConstraints.tightFor(
constraints: BoxConstraints.tightFor( height: 24,
height: 24, width: 24,
width: 24, ),
), icon: StreamSvgIcon(
icon: StreamSvgIcon( assetName: _getSendIcon(),
assetName: _getSendIcon(), color: StreamChatTheme.of(context).accentColor,
color: StreamChatTheme.of(context).accentColor,
),
), ),
), ),
); );