mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:04:16 -04:00
Uses hooks instead of stateful components
This commit is contained in:
parent
bfab33f9d4
commit
d21964c0cc
@ -16,19 +16,12 @@ class MemoryPage extends HookConsumerWidget {
|
|||||||
final List<Memory> memories;
|
final List<Memory> memories;
|
||||||
final int memoryIndex;
|
final int memoryIndex;
|
||||||
|
|
||||||
MemoryPage({
|
const MemoryPage({
|
||||||
required this.memories,
|
required this.memories,
|
||||||
required this.memoryIndex,
|
required this.memoryIndex,
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// The list of all of the asset page controllers
|
|
||||||
late final memoryAssetPageControllers =
|
|
||||||
List.generate(memories.length, (i) => PageController());
|
|
||||||
|
|
||||||
/// The main vertically scrolling page controller with each list of memories
|
|
||||||
late final memoryPageController = PageController(initialPage: memoryIndex);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final currentMemory = useState(memories[memoryIndex]);
|
final currentMemory = useState(memories[memoryIndex]);
|
||||||
@ -39,6 +32,13 @@ class MemoryPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
const bgColor = Colors.black;
|
const bgColor = Colors.black;
|
||||||
|
|
||||||
|
/// The list of all of the asset page controllers
|
||||||
|
final memoryAssetPageControllers =
|
||||||
|
List.generate(memories.length, (i) => usePageController());
|
||||||
|
|
||||||
|
/// The main vertically scrolling page controller with each list of memories
|
||||||
|
final memoryPageController = usePageController(initialPage: memoryIndex);
|
||||||
|
|
||||||
// The Page Controller that scrolls horizontally with all of the assets
|
// The Page Controller that scrolls horizontally with all of the assets
|
||||||
PageController currentMemoryAssetPageController =
|
PageController currentMemoryAssetPageController =
|
||||||
memoryAssetPageControllers[currentMemoryIndex.value];
|
memoryAssetPageControllers[currentMemoryIndex.value];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user