A framework for building convergent cross-platform Nextcloud clients using Flutter.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

59 lines
1.7 KiB

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:neon/blocs.dart';
import 'package:neon/l10n/localizations.dart';
import 'package:neon/models.dart';
import 'package:neon/utils.dart';
import 'package:neon_notifications/neon_notifications.dart';
import 'package:provider/provider.dart';
part 'routes.g.dart';
@TypedGoRoute<NotificationsAppRoute>(
path: '$appsRoutePrefix${AppIDs.notifications}',
name: AppIDs.notifications,
)
@immutable
class NotificationsAppRoute extends NeonAppRoute {
const NotificationsAppRoute();
@override
Widget build(final BuildContext context, final GoRouterState state) {
final accountsBloc = Provider.of<AccountsBloc>(context, listen: false);
final appsBloc = accountsBloc.activeAppsBloc;
final app = appsBloc.notificationsAppImplementation.value.data!;
final accounts = accountsBloc.accounts.value;
final account = accountsBloc.activeAccount.value!;
Widget title = Text(AppLocalizations.of(context).appImplementationName(AppIDs.notifications));
if (accounts.length > 1) {
title = Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
title,
Text(
account.humanReadableID,
style: Theme.of(context).textTheme.bodySmall,
),
],
);
}
final page = Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
leading: BackButton(
onPressed: appsBloc.navigateActiveApp,
),
title: title,
),
body: const NotificationsMainPage(),
);
return Provider<NotificationsBlocInterface>(
create: (final context) => app.getBloc(account),
child: page,
);
}
}