Message formatting tweaks

This commit is contained in:
Hanh 2023-03-14 00:28:46 +10:00
parent aa8753a2d7
commit e82f9ffa26
3 changed files with 27 additions and 18 deletions

View File

@ -17,7 +17,8 @@ class MessageItem extends StatelessWidget {
final width = MediaQuery.of(context).size.width - 96;
final dateString = humanizeDateTime(message.timestamp);
final unreadStyle = (TextStyle? s) => message.read ? s : s?.copyWith(fontWeight: FontWeight.bold);
final unreadStyle = (TextStyle? s) =>
message.read ? s : s?.copyWith(fontWeight: FontWeight.bold);
return GestureDetector(
onTap: () {
@ -49,27 +50,35 @@ class MessageItem extends StatelessWidget {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(width: width,
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Text(message.fromto(), style: unreadStyle(textTheme.bodySmall)),
Text(dateString)
])),
Container(
width: width,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(message.fromto(),
style: unreadStyle(textTheme.bodySmall)),
Text(dateString)
])),
SizedBox(
height: 5.0,
),
Container(
width: width,
child: Text(
message.subject,
style: unreadStyle(textTheme.titleMedium), overflow: TextOverflow.ellipsis)),
SizedBox(
height: 4.0,
),
if (message.subject.isNotEmpty)
Container(
width: width,
child: Text(message.subject,
style: unreadStyle(textTheme.titleMedium),
overflow: TextOverflow.ellipsis)),
if (message.subject.isNotEmpty)
SizedBox(
height: 4.0,
),
Container(
width: width,
child: Text(
message.body,
softWrap: true, maxLines: 5, overflow: TextOverflow.ellipsis,
softWrap: true,
maxLines: 5,
overflow: TextOverflow.ellipsis,
),
),
],
@ -116,7 +125,7 @@ final defaultColor = const Color(0xFF717171);
Color initialToColor(String s) {
final i = s.toUpperCase().codeUnitAt(0);
if (i >= 65 && i < 91) {
return colors[i-65];
return colors[i - 65];
}
return defaultColor;
}

@ -1 +1 @@
Subproject commit f11cbdb28eb190f9fc2e50ba6984e55fc1e9a506
Subproject commit a2f6917ce8de03ee6a4ec5a0564163d59f84da9e

View File

@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.3.6+410
version: 1.3.6+411
environment:
sdk: ">=2.12.0 <3.0.0"