Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mobile][photos] Stabilize selection sheet resize animations

r4khul66d7cf1b847b
diff --git a/mobile/apps/photos/lib/ui/components/bottom_action_bar/selection_action_sheet.dart b/mobile/apps/photos/lib/ui/components/bottom_action_bar/selection_action_sheet.dart
index 523dcf59c3..0099d908be 100644
--- a/mobile/apps/photos/lib/ui/components/bottom_action_bar/selection_action_sheet.dart
+++ b/mobile/apps/photos/lib/ui/components/bottom_action_bar/selection_action_sheet.dart
@@ -57,7 +57,7 @@ class _SelectionActionSheetState extends State<SelectionActionSheet> {
double _maxExtent = 1;
bool _isCollapsing = false;
- static const _duration = Motion.slow;
+ static const _duration = Motion.standard;
@override
void didChangeDependencies() {
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart
index 683d96ad8e..3d6535973b 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart
@@ -134,6 +134,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar>
valueListenable: _hasSelectedFilesNotifier,
builder: (context, value, child) {
return AnimatedCrossFade(
+ alignment: Alignment.bottomCenter,
firstCurve: Curves.easeOutCubic,
secondCurve: Curves.easeOutCubic,
sizeCurve: Curves.easeOutCubic,
diff --git a/mobile/apps/photos/test/ui/viewer/gallery/collection_page_cover_test.dart b/mobile/apps/photos/test/ui/viewer/gallery/collection_page_cover_test.dart
index 522ffc8d3a..df467f5a55 100644
--- a/mobile/apps/photos/test/ui/viewer/gallery/collection_page_cover_test.dart
+++ b/mobile/apps/photos/test/ui/viewer/gallery/collection_page_cover_test.dart
@@ -37,6 +37,7 @@ import "package:photos/services/favorites_service.dart";
import "package:photos/services/ignored_files_service.dart";
import "package:photos/ui/collections/album/row_item.dart";
import "package:photos/ui/components/bottom_action_bar/action_bar_widget.dart";
+import "package:photos/ui/components/bottom_action_bar/selection_action_sheet.dart";
import "package:photos/ui/viewer/actions/file_selection_overlay_bar.dart";
import "package:photos/ui/viewer/gallery/collection_page.dart";
import "package:photos/ui/viewer/gallery/component/album_cover_app_bar.dart";
@@ -397,6 +398,46 @@ void main() {
},
);
+ testWidgets("anchors the selection sheet during interrupted resizing", (
+ tester,
+ ) async {
+ tester.view.physicalSize = const Size(375, 812);
+ tester.view.devicePixelRatio = 1;
+ addTearDown(tester.view.reset);
+ final file = _file(1);
+ await tester.runAsync(() => FilesDB.instance.insertMultiple([file]));
+ await _pumpAlbum(tester, _collection());
+ await _expectCover(tester, file);
+ final selectedFiles = tester
+ .widget<FileSelectionOverlayBar>(find.byType(FileSelectionOverlayBar))
+ .selectedFiles;
+ selectedFiles.toggleSelection(file);
+ await tester.pumpAndSettle();
+ final sheet = find.byType(SelectionActionSheet);
+ final material = find.descendant(
+ of: sheet,
+ matching: find.byType(Material),
+ );
+ final handle = find.descendant(
+ of: sheet,
+ matching: find.bySemanticsLabel("More"),
+ );
+ await tester.tap(handle);
+ await tester.pumpAndSettle();
+ await tester.tap(handle);
+ await tester.pump();
+ for (var frame = 0; frame < 24; frame++) {
+ await tester.pump(const Duration(milliseconds: 16));
+ expect(tester.getBottomRight(material).dy, closeTo(812, 0.01));
+ if (frame == 3) await tester.tap(handle);
+ }
+ selectedFiles.clearAll();
+ await tester.pumpAndSettle();
+ expect(sheet, findsNothing);
+ expect(tester.takeException(), isNull);
+ await _disposeAlbum(tester);
+ });
+
testWidgets(
"animates the thumbnail into the header through reversal and cover changes",
(tester) async {