fix linebreaks in message.title in channel_list_item
This commit is contained in:
parent
59d28d3c49
commit
9542405512
@ -76,7 +76,7 @@ class _ChannelListItemState extends State<ChannelListItem> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
lastMessage?.title ?? '...',
|
_preformatTitle(lastMessage),
|
||||||
style: TextStyle(color: Theme.of(context).textTheme.bodyLarge?.color?.withAlpha(160)),
|
style: TextStyle(color: Theme.of(context).textTheme.bodyLarge?.color?.withAlpha(160)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -89,4 +89,9 @@ class _ChannelListItemState extends State<ChannelListItem> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String _preformatTitle(SCNMessage? message) {
|
||||||
|
if (message == null) return '...';
|
||||||
|
return message.title.replaceAll('\n', '').replaceAll('\r', '').replaceAll('\t', ' ');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hive_flutter/hive_flutter.dart';
|
|
||||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:simplecloudnotifier/api/api_client.dart';
|
import 'package:simplecloudnotifier/api/api_client.dart';
|
||||||
@ -21,9 +20,6 @@ class MessageListPage extends StatefulWidget {
|
|||||||
|
|
||||||
final bool isVisiblePage;
|
final bool isVisiblePage;
|
||||||
|
|
||||||
//TODO reload on switch to tab
|
|
||||||
//TODO reload on app to foreground
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MessageListPage> createState() => _MessageListPageState();
|
State<MessageListPage> createState() => _MessageListPageState();
|
||||||
}
|
}
|
||||||
@ -111,16 +107,18 @@ class _MessageListPageState extends State<MessageListPage> with RouteAware {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void didPopNext() {
|
void didPopNext() {
|
||||||
if (AppSettings().alwaysBackgroundRefreshMessageListOnPop) {
|
if (AppSettings().backgroundRefreshMessageListOnPop) {
|
||||||
ApplicationLog.debug('[MessageList::RouteObserver] --> didPopNext (will background-refresh)');
|
ApplicationLog.debug('[MessageList::RouteObserver] --> didPopNext (will background-refresh)');
|
||||||
_backgroundRefresh(false);
|
_backgroundRefresh(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onLifecycleResume() {
|
void _onLifecycleResume() {
|
||||||
|
if (AppSettings().alwaysBackgroundRefreshMessageListOnLifecycleResume) {
|
||||||
ApplicationLog.debug('[MessageList::_onLifecycleResume] --> (will background-refresh)');
|
ApplicationLog.debug('[MessageList::_onLifecycleResume] --> (will background-refresh)');
|
||||||
_backgroundRefresh(false);
|
_backgroundRefresh(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _fetchPage(String thisPageToken) async {
|
Future<void> _fetchPage(String thisPageToken) async {
|
||||||
final acc = Provider.of<AppAuth>(context, listen: false);
|
final acc = Provider.of<AppAuth>(context, listen: false);
|
||||||
|
@ -4,7 +4,8 @@ class AppSettings extends ChangeNotifier {
|
|||||||
bool groupNotifications = true;
|
bool groupNotifications = true;
|
||||||
int messagePageSize = 128;
|
int messagePageSize = 128;
|
||||||
bool showDebugButton = true;
|
bool showDebugButton = true;
|
||||||
bool alwaysBackgroundRefreshMessageListOnPop = false;
|
bool backgroundRefreshMessageListOnPop = false;
|
||||||
|
bool alwaysBackgroundRefreshMessageListOnLifecycleResume = true;
|
||||||
|
|
||||||
static AppSettings? _singleton = AppSettings._internal();
|
static AppSettings? _singleton = AppSettings._internal();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user