feat(mobile): Added "jump to date" functionality to the memory view (#7323)

* implemented jump to date from memory

* Changed implementation to a ValueNotifier & fixes

* remove debug code

* feat(mobile):
- Added index bound checks
- Handled edge cases when scrolling to the very bottom of the grid-view
- removing the listener on dispose

* feat(mobile): fixed debug index offset & added debug toast for scroll errors

* feat(mobile): added more debug toasts...

* feat(mobile): scroll to month, if timeline is not grouped by days

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Arno Wiest 2024-04-24 22:02:03 +02:00 committed by GitHub
parent 0dbe44cb78
commit dc9b51ad02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 120 additions and 24 deletions

View file

@ -1,6 +1,10 @@
// ignore_for_file: require_trailing_commas
import 'package:auto_route/auto_route.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:immich_mobile/modules/memories/models/memory.dart';
import 'package:immich_mobile/modules/asset_viewer/providers/scroll_to_date_notifier.provider.dart';
class MemoryBottomInfo extends StatelessWidget {
final Memory memory;
@ -12,33 +16,46 @@ class MemoryBottomInfo extends StatelessWidget {
final df = DateFormat.yMMMMd();
return Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
memory.title,
style: TextStyle(
color: Colors.grey[400],
fontSize: 13.0,
fontWeight: FontWeight.w500,
),
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
memory.title,
style: TextStyle(
color: Colors.grey[400],
fontSize: 13.0,
fontWeight: FontWeight.w500,
),
Text(
df.format(
memory.assets[0].fileCreatedAt,
),
style: const TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.w500,
),
),
Text(
df.format(
memory.assets[0].fileCreatedAt,
),
],
style: const TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.w500,
),
),
],
),
MaterialButton(
minWidth: 0,
onPressed: () {
context.popRoute();
scrollToDateNotifierProvider
.scrollToDate(memory.assets[0].fileCreatedAt);
},
shape: const CircleBorder(),
color: Colors.white.withOpacity(0.2),
elevation: 0,
child: const Icon(
Icons.open_in_new,
color: Colors.white,
),
],
),
),
]),
);
}
}