forked from eatvio/eatvio_app
feat(notifications): support payment-required and start-date-set types (#3054)
This commit is contained in:
@@ -134,11 +134,54 @@ class NotificationWidget extends StatelessWidget {
|
||||
CommentComplaintNotification() => _CommentComplaintWidget(notification: notification as CommentComplaintNotification),
|
||||
CommentDeletedNotification() => _CommentDeletedWidget(notification: notification as CommentDeletedNotification),
|
||||
UserSubscribedNotification() => _UserSubscribedWidget(notification: notification as UserSubscribedNotification),
|
||||
ClientPlanPaymentRequiredNotification() => _ClientPlanPaymentRequiredWidget(
|
||||
notification: notification as ClientPlanPaymentRequiredNotification,
|
||||
),
|
||||
ConsultantPlanStartDateSetNotification() => _ConsultantPlanStartDateSetWidget(
|
||||
notification: notification as ConsultantPlanStartDateSetNotification,
|
||||
),
|
||||
UnknownNotification() => const SizedBox.shrink(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
VoidCallback? _chatTap(BuildContext context, String chatUrl) {
|
||||
final uri = Uri.tryParse(chatUrl);
|
||||
final uuid = (uri != null && uri.pathSegments.isNotEmpty) ? uri.pathSegments.last : '';
|
||||
if (uuid.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
return () => context.push('${RouteConstants.chatScreen}?uuid=$uuid');
|
||||
}
|
||||
|
||||
class _ClientPlanPaymentRequiredWidget extends StatelessWidget {
|
||||
const _ClientPlanPaymentRequiredWidget({required this.notification});
|
||||
final ClientPlanPaymentRequiredNotification notification;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return _BaseNotificationWidget(
|
||||
isRead: notification.isRead,
|
||||
notificationsText: 'Необходимо оплатить консультацию «${notification.planName}» у консультанта ${notification.authorName}',
|
||||
createdAt: notification.createdAt,
|
||||
onTap: _chatTap(context, notification.chatUrl),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ConsultantPlanStartDateSetWidget extends StatelessWidget {
|
||||
const _ConsultantPlanStartDateSetWidget({required this.notification});
|
||||
final ConsultantPlanStartDateSetNotification notification;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return _BaseNotificationWidget(
|
||||
isRead: notification.isRead,
|
||||
notificationsText: 'Дата старта установлена: «${notification.planName}». Клиент ${notification.clientName} ещё не оплатил',
|
||||
createdAt: notification.createdAt,
|
||||
onTap: _chatTap(context, notification.chatUrl),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _navigateToBottomNavRoute(BuildContext context, String path, [Object? extra]) {
|
||||
final controller = BottomNavScope.maybeOf(context);
|
||||
if (controller != null) {
|
||||
|
||||
Reference in New Issue
Block a user