ente/mobile/lib/ui/viewer/gallery/state/gallery_context_state.dart
2024-03-01 12:25:37 +05:30

25 lines
681 B
Dart

import "package:flutter/material.dart";
class GalleryContextState extends InheritedWidget {
///Sorting by creation time
final bool sortOrderAsc;
final bool inSelectionMode;
const GalleryContextState({
this.inSelectionMode = false,
required this.sortOrderAsc,
required Widget child,
Key? key,
}) : super(key: key, child: child);
static GalleryContextState? of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<GalleryContextState>();
}
@override
bool updateShouldNotify(GalleryContextState oldWidget) {
return sortOrderAsc != oldWidget.sortOrderAsc ||
inSelectionMode != oldWidget.inSelectionMode;
}
}