kopia lustrzana https://gitlab.com/mysocialportal/relatica
Fix behavior on following notifications and inconsistent click/tap regions on notifications
rodzic
7fe16f44a9
commit
04add9a31c
|
@ -67,37 +67,50 @@ class NotificationControl extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
|
||||
Function()? onTap;
|
||||
switch (notification.type) {
|
||||
case NotificationType.follow:
|
||||
onTap = () {
|
||||
context.pushNamed(ScreenPaths.userProfile,
|
||||
params: {'id': notification.fromId});
|
||||
};
|
||||
break;
|
||||
case NotificationType.follow_request:
|
||||
onTap = () {
|
||||
context.push('/connect/${notification.fromId}');
|
||||
};
|
||||
break;
|
||||
case NotificationType.unknown:
|
||||
buildSnackbar(context, 'Unknown message type, nothing to do');
|
||||
break;
|
||||
case NotificationType.favourite:
|
||||
case NotificationType.mention:
|
||||
case NotificationType.reshare:
|
||||
case NotificationType.reblog:
|
||||
case NotificationType.status:
|
||||
onTap = () {
|
||||
_goToStatus(context);
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
return ListTile(
|
||||
tileColor: notification.dismissed ? null : Colors.black12,
|
||||
leading: fromIcon,
|
||||
title: GestureDetector(
|
||||
onTap: () async {
|
||||
switch (notification.type) {
|
||||
case NotificationType.follow:
|
||||
context.push('/connect/${notification.fromId}');
|
||||
break;
|
||||
case NotificationType.follow_request:
|
||||
context.push('/connect/${notification.fromId}');
|
||||
break;
|
||||
case NotificationType.unknown:
|
||||
buildSnackbar(context, 'Unknown message type, nothing to do');
|
||||
break;
|
||||
case NotificationType.favourite:
|
||||
case NotificationType.mention:
|
||||
case NotificationType.reshare:
|
||||
case NotificationType.reblog:
|
||||
case NotificationType.status:
|
||||
_goToStatus(context);
|
||||
break;
|
||||
}
|
||||
},
|
||||
child: HtmlWidget(notification.content),
|
||||
onTap: onTap == null ? null : () async => onTap!(),
|
||||
child: HtmlWidget(
|
||||
notification.content,
|
||||
onTapUrl: onTap == null ? null : (_) async => onTap!(),
|
||||
),
|
||||
),
|
||||
subtitle:
|
||||
Text(ElapsedDateUtils.epochSecondsToString(notification.timestamp)),
|
||||
trailing: notification.dismissed ||
|
||||
(notification.type == NotificationType.follow ||
|
||||
notification.type == NotificationType.follow_request)
|
||||
subtitle: GestureDetector(
|
||||
onTap: onTap == null ? null : () async => onTap!(),
|
||||
child: Text(
|
||||
ElapsedDateUtils.epochSecondsToString(notification.timestamp),
|
||||
),
|
||||
),
|
||||
trailing: notification.dismissed
|
||||
? null
|
||||
: IconButton(
|
||||
onPressed: () async {
|
||||
|
|
|
@ -29,7 +29,7 @@ extension NotificationMastodonExtension on UserNotification {
|
|||
var content = '';
|
||||
switch (type) {
|
||||
case NotificationType.follow:
|
||||
content = '${from.name} wants to follow you';
|
||||
content = '${from.name} is now following you';
|
||||
break;
|
||||
case NotificationType.follow_request:
|
||||
content = '${from.name} submitted a follow request ';
|
||||
|
|
Ładowanie…
Reference in New Issue