32 lines
789 B
Dart
32 lines
789 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'inbox.dart';
|
|
import 'session.dart';
|
|
|
|
class AppScope extends InheritedWidget {
|
|
const AppScope({
|
|
super.key,
|
|
required this.session,
|
|
required this.inbox,
|
|
required this.routeObserver,
|
|
required super.child,
|
|
});
|
|
|
|
final SessionController session;
|
|
final InboxController inbox;
|
|
final RouteObserver<ModalRoute<void>> routeObserver;
|
|
|
|
static AppScope of(BuildContext context) {
|
|
final scope = context.dependOnInheritedWidgetOfExactType<AppScope>();
|
|
assert(scope != null, 'AppScope is missing');
|
|
return scope!;
|
|
}
|
|
|
|
@override
|
|
bool updateShouldNotify(AppScope oldWidget) {
|
|
return session != oldWidget.session ||
|
|
inbox != oldWidget.inbox ||
|
|
routeObserver != oldWidget.routeObserver;
|
|
}
|
|
}
|