Compare commits

...

12 Commits

Author SHA1 Message Date
Marty Fuhry fa7745194a Remove auto video advance 2024-02-05 10:07:11 -05:00
Marty Fuhry f14295e107 Videos play in memories now 2024-02-05 10:07:11 -05:00
Marty Fuhry b0ff859cd6 Fixes aspect ratio calculation 2024-02-04 20:38:01 -05:00
Marty Fuhry 04350f262a Fixes an issue with initial index set and adds hero / proper padding 2024-02-04 14:08:35 -05:00
Marty Fuhry b8edc7114e Adds padding and hero to memories 2024-02-04 14:00:44 -05:00
Marty Fuhry 4fa55f0e0b Fixes trailing comma analyze error 2024-02-04 13:33:21 -05:00
Marty Fuhry fde8026253 Rounds the edges of the progress bar 2024-02-02 09:32:59 -05:00
Marty Fuhry edba462faf Adds ticks to the progress indicator 2024-02-01 13:52:08 -05:00
Marty Fuhry d21964c0cc Uses hooks instead of stateful components 2024-01-31 12:13:00 -05:00
Marty Fuhry bfab33f9d4 Fixes pageview close button moving with pages 2024-01-31 12:13:00 -05:00
Marty Fuhry 0c36eb1f8b Uses linear bar and fits the card better for memories 2024-01-31 12:13:00 -05:00
Marty Fuhry aa90229c84 Made memories full screen 2024-01-31 12:12:59 -05:00
6 changed files with 420 additions and 231 deletions
@@ -21,40 +21,45 @@ class VideoViewerPage extends HookConsumerWidget {
final Asset asset; final Asset asset;
final bool isMotionVideo; final bool isMotionVideo;
final Widget? placeholder; final Widget? placeholder;
final VoidCallback onVideoEnded; final VoidCallback? onVideoEnded;
final VoidCallback? onPlaying; final VoidCallback? onPlaying;
final VoidCallback? onPaused; final VoidCallback? onPaused;
final Duration hideControlsTimer;
final bool showControls;
final bool showDownloadingIndicator;
const VideoViewerPage({ const VideoViewerPage({
super.key, super.key,
required this.asset, required this.asset,
required this.isMotionVideo, this.isMotionVideo = false,
required this.onVideoEnded, this.onVideoEnded,
this.onPlaying, this.onPlaying,
this.onPaused, this.onPaused,
this.placeholder, this.placeholder,
this.showControls = true,
this.hideControlsTimer = const Duration(seconds: 5),
this.showDownloadingIndicator = true,
}); });
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
if (asset.isLocal && asset.livePhotoVideoId == null) { if (asset.isLocal && asset.livePhotoVideoId == null) {
final AsyncValue<File> videoFile = ref.watch(_fileFamily(asset.local!)); final AsyncValue<File> videoFile = ref.watch(_fileFamily(asset.local!));
return videoFile.when( return AnimatedSwitcher(
data: (data) => VideoPlayer( duration: const Duration(milliseconds: 200),
file: data, child: videoFile.when(
isMotionVideo: false, data: (data) => VideoPlayer(
onVideoEnded: () {}, file: data,
), isMotionVideo: false,
error: (error, stackTrace) => Icon( onVideoEnded: () {},
Icons.image_not_supported_outlined,
color: context.primaryColor,
),
loading: () => const Center(
child: SizedBox(
width: 75,
height: 75,
child: CircularProgressIndicator.adaptive(),
), ),
error: (error, stackTrace) => Icon(
Icons.image_not_supported_outlined,
color: context.primaryColor,
),
loading: () => showDownloadingIndicator
? const Center(child: ImmichLoadingIndicator())
: Container(),
), ),
); );
} }
@@ -74,15 +79,24 @@ class VideoViewerPage extends HookConsumerWidget {
onPaused: onPaused, onPaused: onPaused,
onPlaying: onPlaying, onPlaying: onPlaying,
placeholder: placeholder, placeholder: placeholder,
hideControlsTimer: hideControlsTimer,
showControls: showControls,
showDownloadingIndicator: showDownloadingIndicator,
), ),
if (downloadAssetStatus == DownloadAssetStatus.loading) AnimatedOpacity(
SizedBox( duration: const Duration(milliseconds: 400),
opacity: (downloadAssetStatus == DownloadAssetStatus.loading &&
showDownloadingIndicator)
? 1.0
: 0.0,
child: SizedBox(
height: context.height, height: context.height,
width: context.width, width: context.width,
child: const Center( child: const Center(
child: ImmichLoadingIndicator(), child: ImmichLoadingIndicator(),
), ),
), ),
),
], ],
); );
} }
@@ -102,7 +116,9 @@ class VideoPlayer extends StatefulWidget {
final String? jwtToken; final String? jwtToken;
final File? file; final File? file;
final bool isMotionVideo; final bool isMotionVideo;
final VoidCallback onVideoEnded; final VoidCallback? onVideoEnded;
final Duration hideControlsTimer;
final bool showControls;
final Function()? onPlaying; final Function()? onPlaying;
final Function()? onPaused; final Function()? onPaused;
@@ -111,16 +127,23 @@ class VideoPlayer extends StatefulWidget {
/// usually, a thumbnail of the video /// usually, a thumbnail of the video
final Widget? placeholder; final Widget? placeholder;
final bool showDownloadingIndicator;
const VideoPlayer({ const VideoPlayer({
super.key, super.key,
this.url, this.url,
this.jwtToken, this.jwtToken,
this.file, this.file,
required this.onVideoEnded, this.onVideoEnded,
required this.isMotionVideo, required this.isMotionVideo,
this.onPlaying, this.onPlaying,
this.onPaused, this.onPaused,
this.placeholder, this.placeholder,
this.hideControlsTimer = const Duration(
seconds: 5,
),
this.showControls = true,
this.showDownloadingIndicator = true,
}); });
@override @override
@@ -149,7 +172,7 @@ class _VideoPlayerState extends State<VideoPlayer> {
if (videoPlayerController.value.position == if (videoPlayerController.value.position ==
videoPlayerController.value.duration) { videoPlayerController.value.duration) {
WakelockPlus.disable(); WakelockPlus.disable();
widget.onVideoEnded(); widget.onVideoEnded?.call();
} }
} }
}); });
@@ -184,9 +207,9 @@ class _VideoPlayerState extends State<VideoPlayer> {
autoInitialize: true, autoInitialize: true,
allowFullScreen: false, allowFullScreen: false,
allowedScreenSleep: false, allowedScreenSleep: false,
showControls: !widget.isMotionVideo, showControls: widget.showControls && !widget.isMotionVideo,
customControls: const VideoPlayerControls(), customControls: const VideoPlayerControls(),
hideControlsTimer: const Duration(seconds: 5), hideControlsTimer: widget.hideControlsTimer,
); );
} }
@@ -214,9 +237,10 @@ class _VideoPlayerState extends State<VideoPlayer> {
child: Stack( child: Stack(
children: [ children: [
if (widget.placeholder != null) widget.placeholder!, if (widget.placeholder != null) widget.placeholder!,
const Center( if (widget.showDownloadingIndicator)
child: ImmichLoadingIndicator(), const Center(
), child: ImmichLoadingIndicator(),
),
], ],
), ),
), ),
+50 -37
View File
@@ -3,6 +3,7 @@ import 'dart:ui';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart'; import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/modules/asset_viewer/views/video_viewer_page.dart';
import 'package:immich_mobile/shared/models/asset.dart'; import 'package:immich_mobile/shared/models/asset.dart';
import 'package:immich_mobile/shared/models/store.dart'; import 'package:immich_mobile/shared/models/store.dart';
import 'package:immich_mobile/shared/ui/immich_image.dart'; import 'package:immich_mobile/shared/ui/immich_image.dart';
@@ -11,19 +12,15 @@ import 'package:openapi/api.dart';
class MemoryCard extends StatelessWidget { class MemoryCard extends StatelessWidget {
final Asset asset; final Asset asset;
final void Function() onTap;
final void Function() onClose;
final String title; final String title;
final String? rightCornerText;
final bool showTitle; final bool showTitle;
final Function()? onVideoEnded;
const MemoryCard({ const MemoryCard({
required this.asset, required this.asset,
required this.onTap,
required this.onClose,
required this.title, required this.title,
required this.showTitle, required this.showTitle,
this.rightCornerText, this.onVideoEnded,
super.key, super.key,
}); });
@@ -63,37 +60,53 @@ class MemoryCard extends StatelessWidget {
child: Container(color: Colors.black.withOpacity(0.2)), child: Container(color: Colors.black.withOpacity(0.2)),
), ),
), ),
GestureDetector( LayoutBuilder(
onTap: onTap, builder: (context, constraints) {
child: ImmichImage( // Determine the fit using the aspect ratio
asset, BoxFit fit = BoxFit.fitWidth;
fit: BoxFit.fitWidth, if (asset.width != null && asset.height != null) {
height: double.infinity, final aspectRatio = asset.height! / asset.width!;
width: double.infinity, final phoneAspectRatio =
type: ThumbnailFormat.JPEG, constraints.maxWidth / constraints.maxHeight;
preferredLocalAssetSize: 2048, // Look for a 25% difference in either direction
), if (phoneAspectRatio * .75 < aspectRatio &&
), phoneAspectRatio * 1.25 > aspectRatio) {
Positioned( // Cover to look nice if we have nearly the same aspect ratio
top: 2.0, fit = BoxFit.cover;
left: 2.0, }
child: IconButton( }
onPressed: onClose,
icon: const Icon(Icons.close_rounded), if (asset.isImage) {
color: Colors.grey[400], return Hero(
), tag: 'memory-${asset.id}',
), child: ImmichImage(
Positioned( asset,
right: 18.0, fit: fit,
top: 18.0, height: double.infinity,
child: Text( width: double.infinity,
rightCornerText ?? "", type: ThumbnailFormat.JPEG,
style: TextStyle( preferredLocalAssetSize: 2048,
color: Colors.grey[200], ),
fontSize: 12.0, );
fontWeight: FontWeight.bold, } else {
), return Hero(
), tag: 'memory-${asset.id}',
child: VideoViewerPage(
asset: asset,
showDownloadingIndicator: false,
placeholder: ImmichImage(
asset,
fit: fit,
type: ThumbnailFormat.JPEG,
preferredLocalAssetSize: 2048,
),
hideControlsTimer: const Duration(seconds: 2),
onVideoEnded: onVideoEnded,
showControls: false,
),
);
}
},
), ),
if (showTitle) if (showTitle)
Positioned( Positioned(
@@ -16,7 +16,7 @@ class _MemoryEpilogueState extends State<MemoryEpilogue>
late final _animationController = AnimationController( late final _animationController = AnimationController(
vsync: this, vsync: this,
duration: const Duration( duration: const Duration(
seconds: 3, seconds: 2,
), ),
)..repeat( )..repeat(
reverse: true, reverse: true,
@@ -29,7 +29,7 @@ class _MemoryEpilogueState extends State<MemoryEpilogue>
super.initState(); super.initState();
_animation = CurvedAnimation( _animation = CurvedAnimation(
parent: _animationController, parent: _animationController,
curve: Curves.easeInOut, curve: Curves.easeIn,
); );
} }
@@ -41,74 +41,82 @@ class _MemoryEpilogueState extends State<MemoryEpilogue>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return SafeArea(
crossAxisAlignment: CrossAxisAlignment.center, child: Stack(
mainAxisAlignment: MainAxisAlignment.center, children: [
children: [ Positioned.fill(
Expanded( child: Column(
child: Column( mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, children: [
children: [ const Icon(
const Icon( Icons.check_circle_outline_sharp,
Icons.check_circle_outline_sharp, color: immichDarkThemePrimaryColor,
color: immichDarkThemePrimaryColor, size: 64.0,
size: 64.0, ),
), const SizedBox(height: 16.0),
const SizedBox(height: 16.0), Text(
Text( 'All caught up',
'All caught up', style: Theme.of(context).textTheme.headlineMedium?.copyWith(
style: Theme.of(context).textTheme.headlineMedium?.copyWith( color: Colors.white,
color: Colors.white, ),
),
const SizedBox(height: 16.0),
Text(
'Check back tomorrow for more memories',
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Colors.white,
),
),
const SizedBox(height: 16.0),
TextButton(
onPressed: widget.onStartOver,
child: Text(
'Start Over',
style: context.textTheme.displayMedium?.copyWith(
color: immichDarkThemePrimaryColor,
), ),
),
const SizedBox(height: 16.0),
Text(
'Check back tomorrow for more memories',
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Colors.white,
),
),
const SizedBox(height: 16.0),
TextButton(
onPressed: widget.onStartOver,
child: Text(
'Start Over',
style: context.textTheme.displayMedium?.copyWith(
color: immichDarkThemePrimaryColor,
), ),
), ),
), ],
], ),
), ),
), Positioned(
Column( bottom: 0,
children: [ left: 0,
SizedBox( right: 0,
height: 48, child: Padding(
child: AnimatedBuilder( padding: const EdgeInsets.only(bottom: 16.0),
animation: _animation, child: Column(
builder: (context, child) { children: [
return Transform.translate( SizedBox(
offset: Offset(0, 5 * _animationController.value), height: 48,
child: child, child: AnimatedBuilder(
); animation: _animation,
}, builder: (context, child) {
child: const Icon( return Transform.translate(
size: 32, offset: Offset(0, 8 * _animationController.value),
Icons.expand_less_sharp, child: child,
color: Colors.white, );
), },
child: const Icon(
size: 32,
Icons.expand_less_sharp,
color: Colors.white,
),
),
),
Text(
'Swipe up to close',
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Colors.white,
),
),
],
), ),
), ),
Text( ),
'Swipe up to close', ],
style: Theme.of(context).textTheme.bodyMedium?.copyWith( ),
color: Colors.white,
),
),
],
),
],
); );
} }
} }
+46 -41
View File
@@ -16,41 +16,46 @@ class MemoryLane extends HookConsumerWidget {
final memoryLane = memoryLaneFutureProvider final memoryLane = memoryLaneFutureProvider
.whenData( .whenData(
(memories) => memories != null (memories) => memories != null
? Container( ? SizedBox(
margin: const EdgeInsets.only(top: 10, left: 10),
height: 200, height: 200,
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
shrinkWrap: true, shrinkWrap: true,
itemCount: memories.length, itemCount: memories.length,
padding: const EdgeInsets.only(
right: 8.0,
bottom: 8,
top: 10,
left: 10,
),
itemBuilder: (context, index) { itemBuilder: (context, index) {
final memory = memories[index]; final memory = memories[index];
return Padding( return GestureDetector(
padding: const EdgeInsets.only(right: 8.0, bottom: 8), onTap: () {
child: GestureDetector( HapticFeedback.heavyImpact();
onTap: () { context.pushRoute(
HapticFeedback.heavyImpact(); MemoryRoute(
context.pushRoute( memories: memories,
MemoryRoute( memoryIndex: index,
memories: memories, ),
memoryIndex: index, );
},
child: Stack(
children: [
Card(
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(13.0),
), ),
); clipBehavior: Clip.hardEdge,
}, child: ColorFiltered(
child: Stack( colorFilter: ColorFilter.mode(
children: [ Colors.black.withOpacity(0.2),
Card( BlendMode.darken,
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(13.0),
), ),
clipBehavior: Clip.hardEdge, child: Hero(
child: ColorFiltered( tag: 'memory-${memory.assets[0].id}',
colorFilter: ColorFilter.mode(
Colors.black.withOpacity(0.2),
BlendMode.darken,
),
child: ImmichImage( child: ImmichImage(
memory.assets[0], memory.assets[0],
fit: BoxFit.cover, fit: BoxFit.cover,
@@ -61,25 +66,25 @@ class MemoryLane extends HookConsumerWidget {
), ),
), ),
), ),
Positioned( ),
bottom: 16, Positioned(
left: 16, bottom: 16,
child: ConstrainedBox( left: 16,
constraints: const BoxConstraints( child: ConstrainedBox(
maxWidth: 114, constraints: const BoxConstraints(
), maxWidth: 114,
child: Text( ),
memory.title, child: Text(
style: const TextStyle( memory.title,
fontWeight: FontWeight.w600, style: const TextStyle(
color: Colors.white, fontWeight: FontWeight.w600,
fontSize: 15, color: Colors.white,
), fontSize: 15,
), ),
), ),
), ),
], ),
), ],
), ),
); );
}, },
@@ -0,0 +1,55 @@
import 'package:flutter/material.dart';
class MemoryProgressIndicator extends StatelessWidget {
/// The number of ticks in the progress indicator
final int ticks;
/// The current value of the indicator
final double value;
const MemoryProgressIndicator({
super.key,
required this.ticks,
required this.value,
});
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
final tickWidth = constraints.maxWidth / ticks;
return ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(2.0)),
child: Stack(
children: [
LinearProgressIndicator(
value: value,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: List.generate(
ticks,
(i) => Container(
width: tickWidth,
height: 4,
decoration: BoxDecoration(
border: i == 0
? null
: Border(
left: BorderSide(
color:
Theme.of(context).scaffoldBackgroundColor,
width: 1,
),
),
),
),
),
),
],
),
);
},
);
}
}
@@ -7,6 +7,7 @@ import 'package:immich_mobile/modules/memories/models/memory.dart';
import 'package:immich_mobile/modules/memories/ui/memory_bottom_info.dart'; import 'package:immich_mobile/modules/memories/ui/memory_bottom_info.dart';
import 'package:immich_mobile/modules/memories/ui/memory_card.dart'; import 'package:immich_mobile/modules/memories/ui/memory_card.dart';
import 'package:immich_mobile/modules/memories/ui/memory_epilogue.dart'; import 'package:immich_mobile/modules/memories/ui/memory_epilogue.dart';
import 'package:immich_mobile/modules/memories/ui/memory_progress_indicator.dart';
import 'package:immich_mobile/shared/models/asset.dart'; import 'package:immich_mobile/shared/models/asset.dart';
import 'package:immich_mobile/shared/ui/immich_image.dart'; import 'package:immich_mobile/shared/ui/immich_image.dart';
import 'package:openapi/api.dart' as api; import 'package:openapi/api.dart' as api;
@@ -24,15 +25,28 @@ class MemoryPage extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final memoryPageController = usePageController(initialPage: memoryIndex);
final memoryAssetPageController = usePageController();
final currentMemory = useState(memories[memoryIndex]); final currentMemory = useState(memories[memoryIndex]);
final currentAssetPage = useState(0); final currentAssetPage = 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}",
); );
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
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),
@@ -43,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
memoryAssetPageController.nextPage( PageController controller =
memoryAssetPageControllers[currentMemoryIndex.value];
controller.nextPage(
curve: Curves.easeInOut, curve: Curves.easeInOut,
duration: const Duration(milliseconds: 500), duration: const Duration(milliseconds: 500),
); );
@@ -154,67 +171,134 @@ 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) {
currentMemoryIndex.value = pageNumber;
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
); final assetController = memoryAssetPageControllers[mIndex];
}, return Column(
children: [
Padding(
padding: const EdgeInsets.only(
left: 24.0,
right: 24.0,
top: 8.0,
bottom: 2.0,
),
child: AnimatedBuilder(
animation: assetController,
builder: (context, child) {
double value = 0.0;
if (assetController.hasClients) {
// We can only access [page] if this has clients
value = assetController.page ?? 0;
}
return MemoryProgressIndicator(
ticks: memories[mIndex].assets.length,
value: (value + 1) / memories[mIndex].assets.length,
);
},
),
),
Expanded(
child: Stack(
children: [
PageView.builder(
physics: const BouncingScrollPhysics(
parent: AlwaysScrollableScrollPhysics(),
),
controller: assetController,
onPageChanged: onAssetChanged,
scrollDirection: Axis.horizontal,
itemCount: memories[mIndex].assets.length,
itemBuilder: (context, index) {
final asset = memories[mIndex].assets[index];
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
toNextAsset(index);
},
child: Container(
color: Colors.black,
child: MemoryCard(
asset: asset,
title: memories[mIndex].title,
showTitle: index == 0,
//onVideoEnded: () {
// TODO: At the end of the video, advance to the next asset automatically. If this is a live photo, don't go to
// next asset
//if (asset.livePhotoVideoId == null) {
//toNextAsset(index);
//}
//},
),
),
);
},
),
Positioned(
top: 8,
left: 8,
child: MaterialButton(
minWidth: 0,
onPressed: () {
// 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,
);
},
shape: const CircleBorder(),
color: Colors.white.withOpacity(0.2),
elevation: 0,
child: const Icon(
Icons.close_rounded,
color: Colors.white,
),
),
),
],
),
),
MemoryBottomInfo(memory: memories[mIndex]),
],
);
},
),
), ),
), ),
), ),