better message_item layout
This commit is contained in:
parent
8126327b95
commit
9c366399df
@ -48,10 +48,6 @@ class MessageListItem extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
if (message.priority == 2) FaIcon(FontAwesomeIcons.solidTriangleExclamation, size: 16, color: Colors.red[900]),
|
|
||||||
if (message.priority == 2) SizedBox(width: 4),
|
|
||||||
if (message.priority == 0) FaIcon(FontAwesomeIcons.solidDown, size: 16, color: Colors.lightBlue[900]),
|
|
||||||
if (message.priority == 0) SizedBox(width: 4),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
processTitle(message.title),
|
processTitle(message.title),
|
||||||
@ -69,11 +65,22 @@ class MessageListItem extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
Text(
|
Row(
|
||||||
processContent(message.content),
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
style: TextStyle(color: Theme.of(context).textTheme.bodyLarge?.color?.withAlpha(160)),
|
children: [
|
||||||
overflow: TextOverflow.ellipsis,
|
Expanded(
|
||||||
maxLines: _lineCount,
|
child: Text(
|
||||||
|
processContent(message.content),
|
||||||
|
style: TextStyle(color: Theme.of(context).textTheme.bodyLarge?.color?.withAlpha(160)),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: _lineCount,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (message.priority == 2) SizedBox(width: 4),
|
||||||
|
if (message.priority == 2) FaIcon(FontAwesomeIcons.solidTriangleExclamation, size: 16, color: Colors.red[900]),
|
||||||
|
if (message.priority == 0) SizedBox(width: 4),
|
||||||
|
if (message.priority == 0) FaIcon(FontAwesomeIcons.solidDown, size: 16, color: Colors.lightBlue[900]),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -99,10 +106,6 @@ class MessageListItem extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
if (message.priority == 2) FaIcon(FontAwesomeIcons.solidTriangleExclamation, size: 16, color: Colors.red[900]),
|
|
||||||
if (message.priority == 2) SizedBox(width: 4),
|
|
||||||
if (message.priority == 0) FaIcon(FontAwesomeIcons.solidDown, size: 16, color: Colors.lightBlue[900]),
|
|
||||||
if (message.priority == 0) SizedBox(width: 4),
|
|
||||||
UI.channelChip(
|
UI.channelChip(
|
||||||
context: context,
|
context: context,
|
||||||
text: resolveChannelName(message),
|
text: resolveChannelName(message),
|
||||||
@ -124,11 +127,22 @@ class MessageListItem extends StatelessWidget {
|
|||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
),
|
),
|
||||||
Text(
|
Row(
|
||||||
processContent(message.content),
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
style: TextStyle(color: Theme.of(context).textTheme.bodyLarge?.color?.withAlpha(160)),
|
children: [
|
||||||
overflow: TextOverflow.ellipsis,
|
Expanded(
|
||||||
maxLines: _lineCount,
|
child: Text(
|
||||||
|
processContent(message.content),
|
||||||
|
style: TextStyle(color: Theme.of(context).textTheme.bodyLarge?.color?.withAlpha(160)),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: _lineCount,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (message.priority == 2) SizedBox(width: 4),
|
||||||
|
if (message.priority == 2) FaIcon(FontAwesomeIcons.solidTriangleExclamation, size: 16, color: Colors.red[900]),
|
||||||
|
if (message.priority == 0) SizedBox(width: 4),
|
||||||
|
if (message.priority == 0) FaIcon(FontAwesomeIcons.solidDown, size: 16, color: Colors.lightBlue[900]),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -163,7 +163,7 @@ class _MessageViewPageState extends State<MessageViewPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
Text(message.title, style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
Text(_preformatTitle(message), style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,4 +248,8 @@ class _MessageViewPageState extends State<MessageViewPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String _preformatTitle(Message message) {
|
||||||
|
return message.title.replaceAll('\n', '').replaceAll('\r', '').replaceAll('\t', ' ');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,6 +130,8 @@ class _SendRootPageState extends State<SendRootPage> {
|
|||||||
try {
|
try {
|
||||||
final Uri uri = Uri.parse(url);
|
final Uri uri = Uri.parse(url);
|
||||||
|
|
||||||
|
ApplicationLog.debug('Opening URL: [ ${uri.toString()} ]');
|
||||||
|
|
||||||
if (await canLaunchUrl(uri)) {
|
if (await canLaunchUrl(uri)) {
|
||||||
await launchUrl(uri);
|
await launchUrl(uri);
|
||||||
} else {
|
} else {
|
||||||
|
@ -6,7 +6,7 @@ part 'application_log.g.dart';
|
|||||||
|
|
||||||
class ApplicationLog {
|
class ApplicationLog {
|
||||||
static void debug(String message, {String? additional, StackTrace? trace}) {
|
static void debug(String message, {String? additional, StackTrace? trace}) {
|
||||||
print('[DEBUG] ${message}: ${additional ?? ''}');
|
(additional != null && additional != '') ? print('[DEBUG] ${message}: ${additional}') : print('[DEBUG] ${message}');
|
||||||
|
|
||||||
Hive.box<SCNLog>('scn-logs').add(SCNLog(
|
Hive.box<SCNLog>('scn-logs').add(SCNLog(
|
||||||
id: Xid().toString(),
|
id: Xid().toString(),
|
||||||
@ -19,7 +19,7 @@ class ApplicationLog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void info(String message, {String? additional, StackTrace? trace}) {
|
static void info(String message, {String? additional, StackTrace? trace}) {
|
||||||
print('[INFO] ${message}: ${additional ?? ''}');
|
(additional != null && additional != '') ? print('[INFO] ${message}: ${additional}') : print('[INFO] ${message}');
|
||||||
|
|
||||||
Hive.box<SCNLog>('scn-logs').add(SCNLog(
|
Hive.box<SCNLog>('scn-logs').add(SCNLog(
|
||||||
id: Xid().toString(),
|
id: Xid().toString(),
|
||||||
@ -32,7 +32,7 @@ class ApplicationLog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void warn(String message, {String? additional, StackTrace? trace}) {
|
static void warn(String message, {String? additional, StackTrace? trace}) {
|
||||||
print('[WARN] ${message}: ${additional ?? ''}');
|
(additional != null && additional != '') ? print('[WARN] ${message}: ${additional}') : print('[WARN] ${message}');
|
||||||
|
|
||||||
Hive.box<SCNLog>('scn-logs').add(SCNLog(
|
Hive.box<SCNLog>('scn-logs').add(SCNLog(
|
||||||
id: Xid().toString(),
|
id: Xid().toString(),
|
||||||
@ -45,7 +45,7 @@ class ApplicationLog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void error(String message, {String? additional, StackTrace? trace}) {
|
static void error(String message, {String? additional, StackTrace? trace}) {
|
||||||
print('[ERROR] ${message}: ${additional ?? ''}');
|
(additional != null && additional != '') ? print('[ERROR] ${message}: ${additional}') : print('[ERROR] ${message}');
|
||||||
|
|
||||||
Hive.box<SCNLog>('scn-logs').add(SCNLog(
|
Hive.box<SCNLog>('scn-logs').add(SCNLog(
|
||||||
id: Xid().toString(),
|
id: Xid().toString(),
|
||||||
@ -58,7 +58,7 @@ class ApplicationLog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void fatal(String message, {String? additional, StackTrace? trace}) {
|
static void fatal(String message, {String? additional, StackTrace? trace}) {
|
||||||
print('[FATAL] ${message}: ${additional ?? ''}');
|
(additional != null && additional != '') ? print('[FATAL] ${message}: ${additional}') : print('[FATAL] ${message}');
|
||||||
|
|
||||||
Hive.box<SCNLog>('scn-logs').add(SCNLog(
|
Hive.box<SCNLog>('scn-logs').add(SCNLog(
|
||||||
id: Xid().toString(),
|
id: Xid().toString(),
|
||||||
|
Loading…
Reference in New Issue
Block a user