Minor ui fixes

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-01-13 18:21:02 +05:30
parent 3b0c2a9a73
commit ab29edd89e
4 changed files with 56 additions and 45 deletions
+10 -3
View File
@@ -90,6 +90,8 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
curve: Curves.easeInOutBack, curve: Curves.easeInOutBack,
builder: (context, val, snapshot) { builder: (context, val, snapshot) {
final hasFileAttachment =
widget.message.attachments?.any((it) => it.type == 'file') == true;
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.translucent, behavior: HitTestBehavior.translucent,
onTap: () => Navigator.maybePop(context), onTap: () => Navigator.maybePop(context),
@@ -111,7 +113,7 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
child: Center( child: Center(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0), padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
crossAxisAlignment: widget.reverse crossAxisAlignment: widget.reverse
? CrossAxisAlignment.end ? CrossAxisAlignment.end
@@ -136,6 +138,7 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
messageTheme: widget.messageTheme, messageTheme: widget.messageTheme,
), ),
), ),
SizedBox(height: 8),
IgnorePointer( IgnorePointer(
child: MessageWidget( child: MessageWidget(
key: Key('MessageWidget'), key: Key('MessageWidget'),
@@ -151,8 +154,12 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
showThreadReplyIndicator: false, showThreadReplyIndicator: false,
showReplyMessage: false, showReplyMessage: false,
showUserAvatar: widget.showUserAvatar, showUserAvatar: widget.showUserAvatar,
attachmentPadding: EdgeInsets.all(
hasFileAttachment ? 4 : 2,
),
showTimestamp: false, showTimestamp: false,
translateUserAvatar: false, translateUserAvatar: false,
padding: const EdgeInsets.all(0),
textPadding: EdgeInsets.symmetric( textPadding: EdgeInsets.symmetric(
vertical: 8.0, vertical: 8.0,
horizontal: horizontal:
@@ -168,10 +175,10 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
shape: widget.messageShape, shape: widget.messageShape,
), ),
), ),
SizedBox(height: 8),
Padding( Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
right: widget.reverse ? 8 : 0, left: widget.reverse ? 0 : 40,
left: widget.reverse ? 0 : 48,
), ),
child: SizedBox( child: SizedBox(
width: MediaQuery.of(context).size.width * 0.75, width: MediaQuery.of(context).size.width * 0.75,
+1 -1
View File
@@ -783,7 +783,7 @@ class _MessageListViewState extends State<MessageListView> {
final allRead = readList.length >= (channel.memberCount ?? 0) - 1; final allRead = readList.length >= (channel.memberCount ?? 0) - 1;
final hasFileAttachment = final hasFileAttachment =
message.attachments.any((it) => it.type == 'file'); message.attachments?.any((it) => it.type == 'file') == true;
final isThreadMessage = final isThreadMessage =
message?.parentId != null && message?.showInChannel == true; message?.parentId != null && message?.showInChannel == true;
+43 -39
View File
@@ -62,6 +62,8 @@ class MessageReactionsModal extends StatelessWidget {
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
curve: Curves.easeInOutBack, curve: Curves.easeInOutBack,
builder: (context, val, snapshot) { builder: (context, val, snapshot) {
final hasFileAttachment =
message.attachments?.any((it) => it.type == 'file') == true;
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.translucent, behavior: HitTestBehavior.translucent,
onTap: () => Navigator.maybePop(context), onTap: () => Navigator.maybePop(context),
@@ -83,7 +85,7 @@ class MessageReactionsModal extends StatelessWidget {
child: Center( child: Center(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0), padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -106,6 +108,7 @@ class MessageReactionsModal extends StatelessWidget {
messageTheme: messageTheme, messageTheme: messageTheme,
), ),
), ),
const SizedBox(height: 8),
IgnorePointer( IgnorePointer(
child: MessageWidget( child: MessageWidget(
key: Key('MessageWidget'), key: Key('MessageWidget'),
@@ -124,6 +127,10 @@ class MessageReactionsModal extends StatelessWidget {
translateUserAvatar: false, translateUserAvatar: false,
showSendingIndicator: false, showSendingIndicator: false,
shape: messageShape, shape: messageShape,
padding: const EdgeInsets.all(0),
attachmentPadding: EdgeInsets.all(
hasFileAttachment ? 4 : 2,
),
showInChannelIndicator: false, showInChannelIndicator: false,
textPadding: EdgeInsets.symmetric( textPadding: EdgeInsets.symmetric(
vertical: 8.0, vertical: 8.0,
@@ -135,8 +142,10 @@ class MessageReactionsModal extends StatelessWidget {
message.status == null), message.status == null),
), ),
), ),
if (message.latestReactions?.isNotEmpty == true) if (message.latestReactions?.isNotEmpty == true) ...[
const SizedBox(height: 8),
_buildReactionCard(context), _buildReactionCard(context),
]
], ],
), ),
), ),
@@ -150,47 +159,42 @@ class MessageReactionsModal extends StatelessWidget {
); );
} }
Padding _buildReactionCard(BuildContext context) { Widget _buildReactionCard(BuildContext context) {
final currentUser = StreamChat.of(context).user; final currentUser = StreamChat.of(context).user;
return Padding( return Card(
padding: const EdgeInsets.symmetric( color: StreamChatTheme.of(context).colorTheme.white,
horizontal: 8.0, clipBehavior: Clip.hardEdge,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
), ),
child: Card( margin: EdgeInsets.zero,
color: StreamChatTheme.of(context).colorTheme.white, child: Padding(
clipBehavior: Clip.hardEdge, padding: const EdgeInsets.all(16),
shape: RoundedRectangleBorder( child: Column(
borderRadius: BorderRadius.circular(16), mainAxisSize: MainAxisSize.min,
), children: [
margin: EdgeInsets.zero, Text(
child: Padding( 'Message Reactions',
padding: const EdgeInsets.all(16), style: StreamChatTheme.of(context).textTheme.headlineBold,
child: Column( ),
mainAxisSize: MainAxisSize.min, const SizedBox(height: 16),
children: [ Flexible(
Text( child: SingleChildScrollView(
'Message Reactions', child: Wrap(
style: StreamChatTheme.of(context).textTheme.headlineBold, spacing: 16,
), runSpacing: 16,
const SizedBox(height: 16), alignment: WrapAlignment.start,
Flexible( children: message.latestReactions
child: SingleChildScrollView( .map((e) => _buildReaction(
child: Wrap( e,
spacing: 16, currentUser,
runSpacing: 16, context,
alignment: WrapAlignment.start, ))
children: message.latestReactions .toList(),
.map((e) => _buildReaction(
e,
currentUser,
context,
))
.toList(),
),
), ),
), ),
], ),
), ],
), ),
), ),
); );
+2 -2
View File
@@ -434,8 +434,8 @@ class _MessageWidgetState extends State<MessageWidget> {
), ),
if (widget.showReactionPickerIndicator) if (widget.showReactionPickerIndicator)
Positioned( Positioned(
right: 0, right: widget.reverse ? -6 : 6,
top: -8, top: -6,
child: Transform( child: Transform(
transform: Matrix4.rotationY( transform: Matrix4.rotationY(
widget.reverse ? pi : 0), widget.reverse ? pi : 0),