mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:04:16 -04:00
Made memories full screen
This commit is contained in:
parent
b7a372c756
commit
aa90229c84
@ -33,6 +33,12 @@ class MemoryPage extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
const bgColor = Colors.black;
|
const bgColor = Colors.black;
|
||||||
|
|
||||||
|
useEffect(() {
|
||||||
|
// Memories is an immersive activity
|
||||||
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
toNextMemory() {
|
toNextMemory() {
|
||||||
memoryPageController.nextPage(
|
memoryPageController.nextPage(
|
||||||
duration: const Duration(milliseconds: 500),
|
duration: const Duration(milliseconds: 500),
|
||||||
@ -154,67 +160,79 @@ class MemoryPage extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: bgColor,
|
backgroundColor: bgColor,
|
||||||
body: SafeArea(
|
body: PopScope(
|
||||||
child: PageView.builder(
|
onPopInvoked: (didPop) {
|
||||||
physics: const BouncingScrollPhysics(
|
// Remove immersive mode and go back to normal mode
|
||||||
parent: AlwaysScrollableScrollPhysics(),
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||||
),
|
},
|
||||||
scrollDirection: Axis.vertical,
|
child: SafeArea(
|
||||||
controller: memoryPageController,
|
child: PageView.builder(
|
||||||
onPageChanged: (pageNumber) {
|
physics: const BouncingScrollPhysics(
|
||||||
HapticFeedback.mediumImpact();
|
parent: AlwaysScrollableScrollPhysics(),
|
||||||
if (pageNumber < memories.length) {
|
),
|
||||||
currentMemory.value = memories[pageNumber];
|
scrollDirection: Axis.vertical,
|
||||||
}
|
controller: memoryPageController,
|
||||||
|
onPageChanged: (pageNumber) {
|
||||||
|
HapticFeedback.mediumImpact();
|
||||||
|
if (pageNumber < memories.length) {
|
||||||
|
currentMemory.value = memories[pageNumber];
|
||||||
|
}
|
||||||
|
|
||||||
currentAssetPage.value = 0;
|
currentAssetPage.value = 0;
|
||||||
|
|
||||||
updateProgressText();
|
updateProgressText();
|
||||||
},
|
},
|
||||||
itemCount: memories.length + 1,
|
itemCount: memories.length + 1,
|
||||||
itemBuilder: (context, mIndex) {
|
itemBuilder: (context, mIndex) {
|
||||||
// Build last page
|
// Build last page
|
||||||
if (mIndex == memories.length) {
|
if (mIndex == memories.length) {
|
||||||
return MemoryEpilogue(
|
return MemoryEpilogue(
|
||||||
onStartOver: () => memoryPageController.animateToPage(
|
onStartOver: () => memoryPageController.animateToPage(
|
||||||
0,
|
0,
|
||||||
duration: const Duration(seconds: 1),
|
duration: const Duration(seconds: 1),
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// Build horizontal page
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: PageView.builder(
|
|
||||||
physics: const BouncingScrollPhysics(
|
|
||||||
parent: AlwaysScrollableScrollPhysics(),
|
|
||||||
),
|
|
||||||
controller: memoryAssetPageController,
|
|
||||||
onPageChanged: onAssetChanged,
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
itemCount: memories[mIndex].assets.length,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
final asset = memories[mIndex].assets[index];
|
|
||||||
return Container(
|
|
||||||
color: Colors.black,
|
|
||||||
child: MemoryCard(
|
|
||||||
asset: asset,
|
|
||||||
onTap: () => toNextAsset(index),
|
|
||||||
onClose: () => context.popRoute(),
|
|
||||||
rightCornerText: assetProgress.value,
|
|
||||||
title: memories[mIndex].title,
|
|
||||||
showTitle: index == 0,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
MemoryBottomInfo(memory: memories[mIndex]),
|
}
|
||||||
],
|
// Build horizontal page
|
||||||
);
|
return Column(
|
||||||
},
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: PageView.builder(
|
||||||
|
physics: const BouncingScrollPhysics(
|
||||||
|
parent: AlwaysScrollableScrollPhysics(),
|
||||||
|
),
|
||||||
|
controller: memoryAssetPageController,
|
||||||
|
onPageChanged: onAssetChanged,
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
itemCount: memories[mIndex].assets.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final asset = memories[mIndex].assets[index];
|
||||||
|
return Container(
|
||||||
|
color: Colors.black,
|
||||||
|
child: MemoryCard(
|
||||||
|
asset: asset,
|
||||||
|
onTap: () => toNextAsset(index),
|
||||||
|
onClose: () {
|
||||||
|
// auto_route doesn't invoke pop scope, so
|
||||||
|
// turn off full screen mode here
|
||||||
|
// https://github.com/Milad-Akarie/auto_route_library/issues/1799
|
||||||
|
context.popRoute();
|
||||||
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||||
|
},
|
||||||
|
rightCornerText: assetProgress.value,
|
||||||
|
title: memories[mIndex].title,
|
||||||
|
showTitle: index == 0,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
MemoryBottomInfo(memory: memories[mIndex]),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user