mirror of
https://github.com/ente-io/ente.git
synced 2025-07-26 03:25:52 +00:00
[mob][photos] Create an inherited widget to store searchFilterDataProvider for gallery screens
This commit is contained in:
parent
6a735e1a6a
commit
72a40a63d9
@ -0,0 +1,27 @@
|
|||||||
|
import "package:flutter/material.dart";
|
||||||
|
import "package:photos/ui/viewer/gallery/state/search_filter_data_provider.dart";
|
||||||
|
|
||||||
|
class InheritedSearchFilterData extends InheritedWidget {
|
||||||
|
const InheritedSearchFilterData({
|
||||||
|
super.key,
|
||||||
|
required this.searchFilterDataProvider,
|
||||||
|
required super.child,
|
||||||
|
});
|
||||||
|
|
||||||
|
final SearchFilterDataProvider? searchFilterDataProvider;
|
||||||
|
|
||||||
|
static InheritedSearchFilterData? maybeOf(BuildContext context) {
|
||||||
|
return context
|
||||||
|
.dependOnInheritedWidgetOfExactType<InheritedSearchFilterData>();
|
||||||
|
}
|
||||||
|
|
||||||
|
static InheritedSearchFilterData of(BuildContext context) {
|
||||||
|
final InheritedSearchFilterData? result = maybeOf(context);
|
||||||
|
assert(result != null, 'No InheritedSearchFilterData found in context');
|
||||||
|
return result!;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool updateShouldNotify(InheritedSearchFilterData oldWidget) =>
|
||||||
|
searchFilterDataProvider != oldWidget.searchFilterDataProvider;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user