Fix behavior on following notifications and inconsistent click/tap regions on notifications

merge-requests/67/merge
Hank Grabowski 2023-01-23 16:25:14 -05:00
rodzic 7fe16f44a9
commit 04add9a31c
2 zmienionych plików z 40 dodań i 27 usunięć

Wyświetl plik

@ -67,17 +67,18 @@ class NotificationControl extends StatelessWidget {
), ),
); );
return ListTile( Function()? onTap;
tileColor: notification.dismissed ? null : Colors.black12,
leading: fromIcon,
title: GestureDetector(
onTap: () async {
switch (notification.type) { switch (notification.type) {
case NotificationType.follow: case NotificationType.follow:
context.push('/connect/${notification.fromId}'); onTap = () {
context.pushNamed(ScreenPaths.userProfile,
params: {'id': notification.fromId});
};
break; break;
case NotificationType.follow_request: case NotificationType.follow_request:
onTap = () {
context.push('/connect/${notification.fromId}'); context.push('/connect/${notification.fromId}');
};
break; break;
case NotificationType.unknown: case NotificationType.unknown:
buildSnackbar(context, 'Unknown message type, nothing to do'); buildSnackbar(context, 'Unknown message type, nothing to do');
@ -87,17 +88,29 @@ class NotificationControl extends StatelessWidget {
case NotificationType.reshare: case NotificationType.reshare:
case NotificationType.reblog: case NotificationType.reblog:
case NotificationType.status: case NotificationType.status:
onTap = () {
_goToStatus(context); _goToStatus(context);
};
break; break;
} }
},
child: HtmlWidget(notification.content), return ListTile(
tileColor: notification.dismissed ? null : Colors.black12,
leading: fromIcon,
title: GestureDetector(
onTap: onTap == null ? null : () async => onTap!(),
child: HtmlWidget(
notification.content,
onTapUrl: onTap == null ? null : (_) async => onTap!(),
), ),
subtitle: ),
Text(ElapsedDateUtils.epochSecondsToString(notification.timestamp)), subtitle: GestureDetector(
trailing: notification.dismissed || onTap: onTap == null ? null : () async => onTap!(),
(notification.type == NotificationType.follow || child: Text(
notification.type == NotificationType.follow_request) ElapsedDateUtils.epochSecondsToString(notification.timestamp),
),
),
trailing: notification.dismissed
? null ? null
: IconButton( : IconButton(
onPressed: () async { onPressed: () async {

Wyświetl plik

@ -29,7 +29,7 @@ extension NotificationMastodonExtension on UserNotification {
var content = ''; var content = '';
switch (type) { switch (type) {
case NotificationType.follow: case NotificationType.follow:
content = '${from.name} wants to follow you'; content = '${from.name} is now following you';
break; break;
case NotificationType.follow_request: case NotificationType.follow_request:
content = '${from.name} submitted a follow request '; content = '${from.name} submitted a follow request ';