mirror of
https://github.com/immich-app/immich.git
synced 2025-07-08 18:54:18 -04:00
Fixes an issue with initial index set and adds hero / proper padding
This commit is contained in:
parent
b8edc7114e
commit
04350f262a
@ -77,13 +77,16 @@ class MemoryCard extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ImmichImage(
|
return Hero(
|
||||||
asset,
|
tag: 'memory-${asset.id}',
|
||||||
fit: fit,
|
child: ImmichImage(
|
||||||
height: double.infinity,
|
asset,
|
||||||
width: double.infinity,
|
fit: fit,
|
||||||
type: ThumbnailFormat.JPEG,
|
height: double.infinity,
|
||||||
preferredLocalAssetSize: 2048,
|
width: double.infinity,
|
||||||
|
type: ThumbnailFormat.JPEG,
|
||||||
|
preferredLocalAssetSize: 2048,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -55,7 +55,7 @@ class MemoryLane extends HookConsumerWidget {
|
|||||||
BlendMode.darken,
|
BlendMode.darken,
|
||||||
),
|
),
|
||||||
child: Hero(
|
child: Hero(
|
||||||
tag: memory.assets[0].id,
|
tag: 'memory-${memory.assets[0].id}',
|
||||||
child: ImmichImage(
|
child: ImmichImage(
|
||||||
memory.assets[0],
|
memory.assets[0],
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
|
@ -27,7 +27,7 @@ class MemoryPage extends HookConsumerWidget {
|
|||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final currentMemory = useState(memories[memoryIndex]);
|
final currentMemory = useState(memories[memoryIndex]);
|
||||||
final currentAssetPage = useState(0);
|
final currentAssetPage = useState(0);
|
||||||
final currentMemoryIndex = useState(0);
|
final currentMemoryIndex = useState(memoryIndex);
|
||||||
final assetProgress = useState(
|
final assetProgress = useState(
|
||||||
"${currentAssetPage.value + 1}|${currentMemory.value.assets.length}",
|
"${currentAssetPage.value + 1}|${currentMemory.value.assets.length}",
|
||||||
);
|
);
|
||||||
@ -41,9 +41,6 @@ class MemoryPage extends HookConsumerWidget {
|
|||||||
final memoryPageController = usePageController(initialPage: memoryIndex);
|
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 =
|
|
||||||
memoryAssetPageControllers[currentMemoryIndex.value];
|
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
// Memories is an immersive activity
|
// Memories is an immersive activity
|
||||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
|
||||||
@ -60,7 +57,10 @@ class MemoryPage extends HookConsumerWidget {
|
|||||||
toNextAsset(int currentAssetIndex) {
|
toNextAsset(int currentAssetIndex) {
|
||||||
if (currentAssetIndex + 1 < currentMemory.value.assets.length) {
|
if (currentAssetIndex + 1 < currentMemory.value.assets.length) {
|
||||||
// Go to the next asset
|
// Go to the next asset
|
||||||
currentMemoryAssetPageController.nextPage(
|
PageController controller =
|
||||||
|
memoryAssetPageControllers[currentMemoryIndex.value];
|
||||||
|
|
||||||
|
controller.nextPage(
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
duration: const Duration(milliseconds: 500),
|
duration: const Duration(milliseconds: 500),
|
||||||
);
|
);
|
||||||
@ -207,6 +207,7 @@ class MemoryPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Build horizontal page
|
// Build horizontal page
|
||||||
|
final assetController = memoryAssetPageControllers[mIndex];
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
@ -217,12 +218,12 @@ class MemoryPage extends HookConsumerWidget {
|
|||||||
bottom: 2.0,
|
bottom: 2.0,
|
||||||
),
|
),
|
||||||
child: AnimatedBuilder(
|
child: AnimatedBuilder(
|
||||||
animation: currentMemoryAssetPageController,
|
animation: assetController,
|
||||||
builder: (context, child) {
|
builder: (context, child) {
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
if (currentMemoryAssetPageController.hasClients) {
|
if (assetController.hasClients) {
|
||||||
// We can only access [page] if this has clients
|
// We can only access [page] if this has clients
|
||||||
value = currentMemoryAssetPageController.page ?? 0;
|
value = assetController.page ?? 0;
|
||||||
}
|
}
|
||||||
return MemoryProgressIndicator(
|
return MemoryProgressIndicator(
|
||||||
ticks: memories[mIndex].assets.length,
|
ticks: memories[mIndex].assets.length,
|
||||||
@ -238,7 +239,7 @@ class MemoryPage extends HookConsumerWidget {
|
|||||||
physics: const BouncingScrollPhysics(
|
physics: const BouncingScrollPhysics(
|
||||||
parent: AlwaysScrollableScrollPhysics(),
|
parent: AlwaysScrollableScrollPhysics(),
|
||||||
),
|
),
|
||||||
controller: memoryAssetPageControllers[mIndex],
|
controller: assetController,
|
||||||
onPageChanged: onAssetChanged,
|
onPageChanged: onAssetChanged,
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
itemCount: memories[mIndex].assets.length,
|
itemCount: memories[mIndex].assets.length,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user