This repository has been archived on 2023-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
imagini/web_native/lib/core/app_provider.dart

28 lines
783 B
Dart
Raw Normal View History

2021-02-11 20:47:42 +00:00
import 'package:flutter/material.dart';
import 'package:fluro/fluro.dart';
import 'package:imagini/core/imagini_application.dart';
class AppProvider extends InheritedWidget {
final ImaginiApplication application;
AppProvider({Key key, Widget child, this.application})
: super(key: key, child: child);
bool updateShouldNotify(_) => true;
static AppProvider of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<AppProvider>();
}
static FluroRouter getRouter(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<AppProvider>().application.router;
}
static ImaginiApplication getApplication(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<AppProvider>().application;
}
}