The background of the photo view does not extend below the height of the
viewport, and so the asset details fade in over black with the photo
view, and the standard surface colour scheme of the scaffold for the
rest. This leads to a janky animation. We can't change the background of
the scaffold to black, as it in turn makes the iOS bouncing scroll
physics cut off incorrectly. The best fix is to remove background
decoration from the photo view, and defer to the parent to colour the
background.
Co-authored-by: Alex <alex.tran1502@gmail.com>
In order to scroll smoothly without interfering with the gesture
detector on the photo view, we have an offstate scroll view which we
defer all drags to, and then forward scroll offsets to the real scroll
controller. This works well, but it can be simpler. Instead, we can
create a custom scroll controller on a scroll view with never scrollable
physics, and then forward drag events to that, bypassing the need for a
proxy scroll controller.
Co-authored-by: Alex <alex.tran1502@gmail.com>
Consolidate video state into a single asset-scoped provider, and reduce
dependency on global state generally. Overall this should fix a few
timing issues and race conditions with videos specifically, and make
future changes in this area easier.
The image in the photo view has no height, and is therefore entirely
unconstrained. This causes the image to take up the full height of the
viewport during the hero animation, which can make look out of sync. In
some other cases, it can stretch or resize the image to fill the entire
viewport.
The changes in #25952 inadvertently removed an optimisation which
prevents the video player from being recreated when the tree changed.
This happens surprisingly often, namely when the hero animation
finishes. The widget is particularly expensive, so recreating it 2-3 in
a short period not only feels sluggish, but also causes the video to
hitch and restart.
The solution is to bring the global key back for the native video
player. Unlike before, we are using a custom global key which compares
the values of hero tags directly. This means we don't need to maintain a
map of hero tags to global keys in the state, and also means we don't
have to pass the global key down multiple layers.
This also fixes#25981.
Asset details are prematurely hidden when a drag ends if the simulation
shows that it will close given its current velocity. It makes for a much
more responsible feeling UI. However, this behaviour conflicts with the
logic which determines whether details are showing based on the current
offset. The result is that the details are hidden, then immediately
shown again, and then hidden once it passes the min snap distance
threshold.
This can be fixed by only evaluating the position based logic when a
drag is active, and then inferring upcoming state with a simulation.
Keeping track of the last scroll offset and guarding on scroll direction
is not necessary. The dead zone with kTouchSlop is more than sufficient,
and much simpler.
Co-authored-by: shenlong <139912620+shenlong-tanwen@users.noreply.github.com>
We have all the information we need to decide on whether we should pop
or not at the end of a drag. There's no need to track that separately,
and update the value constantly.
* wip
* Functional implementation, still need to bug test.
* Fixed flickering bugs
* Fixed bug with drag actions interfering with zoom panning. Fixed video being zoomable when bottom sheet is shown. Code cleanup.
* Add comments and simplify video controls
* Clearer variable name
* Fix bug where the redundant onTapDown would interfere with zooming gestures
* Fix zoom not working the second time when viewing a video.
* fix video of live photo retaining pan from photo portion
* code cleanup and simplified widget stack
---------
Co-authored-by: Alex <alex.tran1502@gmail.com>
* feat(mobile): tap behavior for next/previous image
This change enables switching to the next/previous photo in the photo
viewer by tapping the left/right quarter of the screen.
* Avoid animation on first/last image
* Add changes to asset_viewer.page
* Add setting for tap navigation, disable by default
Not everyone wants to have tapping for next/previous image enabled, so
this commit adds a settings toggle. Since it might be confusing behavior
for new users, it is disabled by default.
* chore: refactor
* fix: lint
---------
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
We were manually tracking whether gestures should be blocked, which was
a remnant of how the old code worked. This is no longer needed as we
have better heuristics for knowing whether we should skip drag updates
now.
Co-authored-by: Alex <alex.tran1502@gmail.com>
The drag intent was not set until it reached the kTouchSlop threshold.
This is not necessary as flutter already has its own heuristics for
preventing unintended drags.
The result of using kTouchSlop is that dismissing or scroll can feel a
little delayed, and will jump from 0 to kTouchSlop (18px) rather than
moving smoothly.
The existing implementation for showing asset details uses a bottom
sheet, and is not in sync with the preview or scroll intent. Other apps
use inline details, which is much cleaner and feels better to use.
The current asset changes when the timeline refreshes, which can be
quite jarring. Assets are tracked by their index, and that index becomes
stale when the timeline refreshes. This can be resolved by updating the
index of asset based on a unique identifier (like the hero tag).
* change drag bar and animation position
* ensure bottom bar is below the metadata panel - move the bottom bar from bottomNavigationBar into the Stack
* change some parameters
* add background color for night mode
* background color
* change default position
* minor changes
---------
Co-authored-by: Alex <alex.tran1502@gmail.com>
* fix(mobile): videos with '#' don't play on android
* refactor: one line
Co-authored-by: shenlong <139912620+shenlong-tanwen@users.noreply.github.com>
* fix: depend on platform
---------
Co-authored-by: shenlong <139912620+shenlong-tanwen@users.noreply.github.com>
* chore(mobile): i18n: "open_asset_info" in viewer kebab menu
* feat(mobile): move some top buttons into kebabu menu
* refactor(mobile): viewer kebab menu to use context-based button generation
* feat(mobile): refactor action button and kebab menu to use ConsumerWidget for improved state management
* feat(mobile): pass original theme to ViewerKebabMenu for consistent styling
* chore: styling
---------
Co-authored-by: Alex <alex.tran1502@gmail.com>
* feat(mobile): implement viewer kebab menu with about option
* feat: revert exisitng buttons, adjust label name
* unify MenuAnchor usage
---------
Co-authored-by: Alex <alex.tran1502@gmail.com>
* fixed the timezone issue in the Immich mobile app's metadata sheet to match the web app's behavior
* format dart
* now uses the shared applyTimezoneOffset() utility function from mobile/lib/utils/timezone.dart
* add tests
---------
Co-authored-by: Alex <alex.tran1502@gmail.com>
* chore: break sheet tile into own file
* feat: set location from bottom sheet
* refactor: location picker
There was a lot of confusing controls here, simplified to 1 mode
* fix: local asset check
* chore: refactoring of location details widget
* fix: update currentAssetExifProvider when changing location
* chore: use SheetTile for location header
* chore: remove coordinate change check
* chore: remove comment
* feat: add action button in photo viewer for adding assets to albums, archiving, and moving to locked folders
* fix: use const constructors for icons in action button menu
* Update mobile/lib/presentation/widgets/action_buttons/add_action_button.widget.dart
Co-authored-by: Brandon Wees <brandonwees@gmail.com>
* Update mobile/lib/presentation/widgets/asset_viewer/bottom_bar.widget.dart
Co-authored-by: Brandon Wees <brandonwees@gmail.com>
* remove de translation
* fixed PR comments: https://github.com/immich-app/immich/pull/23608
* menu styling
* menu styling
* i18n
---------
Co-authored-by: Brandon Wees <brandonwees@gmail.com>
Co-authored-by: Alex <alex.tran1502@gmail.com>