forked from Nexus/nexus
notif fixups
This commit is contained in:
parent
78c6b2ef46
commit
1c533b5330
1 changed files with 38 additions and 14 deletions
|
|
@ -3,6 +3,7 @@ import "package:flutter_riverpod/flutter_riverpod.dart";
|
|||
import "package:flutter_riverpod/misc.dart";
|
||||
import "package:material_ui/material_ui.dart";
|
||||
import "package:nexus/controllers/active_account.dart";
|
||||
import "package:nexus/controllers/launch_scope.dart";
|
||||
import "package:nexus/controllers/notification_request.dart";
|
||||
|
||||
/// Runs [child] as one account, in a [ProviderScope] of its own that's
|
||||
|
|
@ -23,6 +24,7 @@ class const AccountScope({
|
|||
accountId: initialAccountId,
|
||||
notificationRowId: null,
|
||||
));
|
||||
final isLaunch = useState(true);
|
||||
|
||||
return ProviderScope(
|
||||
key: ValueKey(active.value.accountId),
|
||||
|
|
@ -30,14 +32,17 @@ class const AccountScope({
|
|||
observers: observers,
|
||||
overrides: [
|
||||
ActiveAccountController.provider.overrideWith(
|
||||
() => ActiveAccountController(
|
||||
active.value.accountId,
|
||||
(next) => active.value = next,
|
||||
),
|
||||
() => ActiveAccountController(active.value.accountId, (next) {
|
||||
isLaunch.value = false;
|
||||
active.value = next;
|
||||
}),
|
||||
),
|
||||
NotificationRequestController.provider.overrideWithBuild(
|
||||
(_, _) => active.value.notificationRowId,
|
||||
),
|
||||
LaunchScopeController.provider.overrideWithBuild(
|
||||
(_, _) => isLaunch.value,
|
||||
),
|
||||
...overrides,
|
||||
],
|
||||
child: child,
|
||||
|
|
|
|||
Loading…
Reference in a new issue