init
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user