[mob][photos] Handle if InheritedWidget is not an ancestor (#5399)
This commit is contained in:
@@ -11,6 +11,9 @@ class InheritedDetailPageState extends InheritedWidget {
|
||||
static InheritedDetailPageState of(BuildContext context) =>
|
||||
context.dependOnInheritedWidgetOfExactType<InheritedDetailPageState>()!;
|
||||
|
||||
static InheritedDetailPageState? maybeOf(BuildContext context) =>
|
||||
context.dependOnInheritedWidgetOfExactType<InheritedDetailPageState>();
|
||||
|
||||
void toggleFullScreen({bool? shouldEnable}) {
|
||||
if (shouldEnable != null) {
|
||||
if (enableFullScreenNotifier.value == shouldEnable) return;
|
||||
|
||||
@@ -194,8 +194,9 @@ class _ZoomableImageState extends State<ZoomableImage> {
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: ValueListenableBuilder<bool>(
|
||||
valueListenable: InheritedDetailPageState.of(context)
|
||||
.enableFullScreenNotifier,
|
||||
valueListenable: InheritedDetailPageState.maybeOf(context)
|
||||
?.enableFullScreenNotifier ??
|
||||
ValueNotifier(false),
|
||||
builder: (context, doNotShowCaption, _) {
|
||||
return AnimatedOpacity(
|
||||
opacity: doNotShowCaption ? 0.0 : 1.0,
|
||||
|
||||
Reference in New Issue
Block a user