ente/lib/ui/viewer/gallery/state/gallery_context_state.dart

25 lines
681 B
Dart
Raw Normal View History

import "package:flutter/material.dart";
class GalleryContextState extends InheritedWidget {
2023-08-01 13:30:31 +00:00
///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;
}
}