You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
import 'package:thesis_shop/stores/cart_store.dart';
|
|
|
|
import 'package:thesis_shop/stores/product_store.dart';
|
|
|
|
import 'package:thesis_shop/stores/user_store.dart';
|
|
|
|
|
|
|
|
class StoreInjector extends InheritedWidget {
|
|
|
|
final UserStore userStore;
|
|
|
|
final CartStore cartStore;
|
|
|
|
final ProductStore productStore;
|
|
|
|
|
|
|
|
const StoreInjector({
|
|
|
|
Key? key,
|
|
|
|
required this.userStore,
|
|
|
|
required this.cartStore,
|
|
|
|
required this.productStore,
|
|
|
|
required Widget child,
|
|
|
|
}) : super(key: key, child: child);
|
|
|
|
|
|
|
|
static StoreInjector of(BuildContext context) {
|
|
|
|
final StoreInjector? result =
|
|
|
|
context.dependOnInheritedWidgetOfExactType<StoreInjector>();
|
|
|
|
assert(result != null, 'No StoreInjector found in context');
|
|
|
|
return result!;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool updateShouldNotify(StoreInjector oldWidget) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|