Browse Source

neon: fix blocProvider of notifications app

pull/371/head
Nikolas Rimikis 2 years ago
parent
commit
81fd46a707
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 39
      packages/neon/neon/lib/src/pages/home.dart
  2. 2
      packages/neon/neon_notifications/lib/pages/main.dart

39
packages/neon/neon/lib/src/pages/home.dart

@ -132,25 +132,30 @@ class _HomePageState extends State<HomePage> {
final List<Account> accounts,
final Account account,
) async {
final page = Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(app.name(context)),
if (accounts.length > 1) ...[
Text(
account.client.humanReadableID,
style: Theme.of(context).textTheme.bodySmall,
),
],
],
),
),
body: app.page,
);
await Navigator.of(context).push(
MaterialPageRoute(
builder: (final context) => Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(app.name(context)),
if (accounts.length > 1) ...[
Text(
account.client.humanReadableID,
style: Theme.of(context).textTheme.bodySmall,
),
],
],
),
),
body: app.page,
builder: (final context) => Provider<NotificationsBlocInterface>(
create: (final context) => app.getBloc(account),
child: page,
),
),
);

2
packages/neon/neon_notifications/lib/pages/main.dart

@ -16,7 +16,7 @@ class _NotificationsMainPageState extends State<NotificationsMainPage> {
void initState() {
super.initState();
bloc = Provider.of<NotificationsBloc>(context, listen: false);
bloc = Provider.of<NotificationsBlocInterface>(context, listen: false) as NotificationsBloc;
bloc.errors.listen((final error) {
NeonException.showSnackbar(context, error);

Loading…
Cancel
Save