fix padding in messages

This commit is contained in:
Salvatore Giordano
2020-05-11 16:53:07 +02:00
parent 5b29057ccb
commit 18ded607a8
4 changed files with 46 additions and 42 deletions
+24 -27
View File
@@ -43,39 +43,36 @@ class DateDivider extends StatelessWidget {
dayInfo = createdAt.format('dd/MM/yyyy').toUpperCase(); dayInfo = createdAt.format('dd/MM/yyyy').toUpperCase();
} }
return Padding( return Row(
padding: const EdgeInsets.symmetric(vertical: 12.0), crossAxisAlignment: CrossAxisAlignment.center,
child: Row( children: <Widget>[
crossAxisAlignment: CrossAxisAlignment.center, divider,
children: <Widget>[ Padding(
divider, padding: const EdgeInsets.symmetric(horizontal: 32.0),
Padding( child: Text.rich(
padding: const EdgeInsets.symmetric(horizontal: 32.0), TextSpan(
child: Text.rich( children: [
TextSpan( TextSpan(
children: [ text: dayInfo,
TextSpan( style: TextStyle(
text: dayInfo, fontWeight: FontWeight.bold,
style: TextStyle(
fontWeight: FontWeight.bold,
),
), ),
TextSpan(text: ' AT'),
TextSpan(text: ' $hourInfo'),
],
style: TextStyle(
fontWeight: FontWeight.normal,
), ),
), TextSpan(text: ' AT'),
TextSpan(text: ' $hourInfo'),
],
style: TextStyle( style: TextStyle(
fontSize: 10, fontWeight: FontWeight.normal,
color: Theme.of(context).textTheme.title.color.withOpacity(.5),
), ),
), ),
style: TextStyle(
fontSize: 10,
color: Theme.of(context).textTheme.title.color.withOpacity(.5),
),
), ),
divider, ),
], divider,
), ],
); );
} }
} }
+10 -7
View File
@@ -11,13 +11,16 @@ class DeletedMessage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Text( return Padding(
'This message was deleted...', padding: const EdgeInsets.symmetric(vertical: 8.0),
style: messageTheme.messageText.copyWith( child: Text(
fontStyle: FontStyle.italic, 'This message was deleted...',
color: Theme.of(context).brightness == Brightness.dark style: messageTheme.messageText.copyWith(
? Colors.white fontStyle: FontStyle.italic,
: Colors.black, color: Theme.of(context).brightness == Brightness.dark
? Colors.white
: Colors.black,
),
), ),
); );
} }
+10 -7
View File
@@ -232,12 +232,15 @@ class _MessageListViewState extends State<MessageListView> {
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
messageWidget, messageWidget,
widget.dateDividerBuilder != null Padding(
? widget padding: const EdgeInsets.symmetric(vertical: 12.0),
.dateDividerBuilder(nextMessage.createdAt.toLocal()) child: widget.dateDividerBuilder != null
: DateDivider( ? widget
dateTime: nextMessage.createdAt.toLocal(), .dateDividerBuilder(nextMessage.createdAt.toLocal())
), : DateDivider(
dateTime: nextMessage.createdAt.toLocal(),
),
),
], ],
); );
} }
@@ -413,7 +416,7 @@ class _MessageListViewState extends State<MessageListView> {
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 8.0, left: 8.0,
right: 8.0, right: 8.0,
bottom: index == 0 ? 30 : (isLastUser ? 5 : 10), bottom: index == 0 ? 30 : (isNextUser ? 5 : 10),
), ),
showUsername: !isMyMessage && !isNextUser, showUsername: !isMyMessage && !isNextUser,
showSendingIndicator: isMyMessage && showSendingIndicator: isMyMessage &&
+2 -1
View File
@@ -173,7 +173,8 @@ class MessageWidget extends StatelessWidget {
true && true &&
showReactions) showReactions)
? EdgeInsets.only( ? EdgeInsets.only(
top: _getReactionsTopPadding()) top: _getReactionsTopPadding(),
)
: EdgeInsets.zero, : EdgeInsets.zero,
child: PortalEntry( child: PortalEntry(
portalAnchor: Alignment(0, 1), portalAnchor: Alignment(0, 1),