1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-25 10:43:13 +02:00

style(mobile): asset selection animation (#5322)

* refactor: replace navigator.pop with context.pop

* mobile: use demo instance credentials for test login

* style(mobile): centre align add partner button

* mobile: add thumbnail selection animation

* differnt gesture for test instance

---------

Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
shenlong 2023-11-28 22:05:13 +00:00 committed by GitHub
parent 6522707b49
commit b0db8ed6c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 41 additions and 29 deletions

View File

@ -65,7 +65,7 @@ class AddToAlbumBottomSheet extends HookConsumerWidget {
}
ref.invalidate(albumDetailProvider(album.id));
Navigator.pop(context);
context.pop();
}
return Card(

View File

@ -89,7 +89,7 @@ class AlbumViewerAppbar extends HookConsumerWidget
),
actions: <Widget>[
TextButton(
onPressed: () => Navigator.pop(context, 'Cancel'),
onPressed: () => context.pop('Cancel'),
child: Text(
'Cancel',
style: TextStyle(
@ -100,7 +100,7 @@ class AlbumViewerAppbar extends HookConsumerWidget
),
TextButton(
onPressed: () {
Navigator.pop(context, 'Confirm');
context.pop('Confirm');
deleteAlbum();
},
child: Text(
@ -131,7 +131,7 @@ class AlbumViewerAppbar extends HookConsumerWidget
context
.autoNavigate(const TabControllerRoute(children: [SharingRoute()]));
} else {
Navigator.pop(context);
context.pop();
ImmichToast.show(
context: context,
msg: "album_viewer_appbar_share_err_leave".tr(),
@ -153,12 +153,12 @@ class AlbumViewerAppbar extends HookConsumerWidget
);
if (isSuccess) {
Navigator.pop(context);
context.pop();
selectionDisabled();
ref.watch(albumProvider.notifier).getAllAlbums();
ref.invalidate(albumDetailProvider(album.id));
} else {
Navigator.pop(context);
context.pop();
ImmichToast.show(
context: context,
msg: "album_viewer_appbar_share_err_remove".tr(),
@ -253,7 +253,7 @@ class AlbumViewerAppbar extends HookConsumerWidget
ListTile(
leading: const Icon(Icons.person_add_alt_rounded),
onTap: () {
Navigator.pop(context);
context.pop();
onAddUsers!(album);
},
title: const Text(
@ -265,7 +265,7 @@ class AlbumViewerAppbar extends HookConsumerWidget
leading: const Icon(Icons.share_rounded),
onTap: () {
context.autoPush(SharedLinkEditRoute(albumId: album.remoteId));
Navigator.pop(context);
context.pop();
},
title: const Text(
"control_bottom_app_bar_share",
@ -286,7 +286,7 @@ class AlbumViewerAppbar extends HookConsumerWidget
ListTile(
leading: const Icon(Icons.add_photo_alternate_outlined),
onTap: () {
Navigator.pop(context);
context.pop();
onAddPhotos!(album);
},
title: const Text(

View File

@ -27,7 +27,7 @@ class AlbumOptionsPage extends HookConsumerWidget {
final isOwner = owner?.id == userId;
void showErrorMessage() {
Navigator.pop(context);
context.pop();
ImmichToast.show(
context: context,
msg: "shared_album_section_people_action_error".tr(),
@ -70,7 +70,7 @@ class AlbumOptionsPage extends HookConsumerWidget {
showErrorMessage();
}
Navigator.pop(context);
context.pop();
ImmichLoadingOverlayController.appLoader.hide();
}

View File

@ -514,7 +514,7 @@ class GalleryViewerPage extends HookConsumerWidget {
currentAsset,
stackElements.elementAt(stackIndex.value),
);
Navigator.pop(ctx);
ctx.pop();
context.autoPop();
},
title: const Text(
@ -541,7 +541,7 @@ class GalleryViewerPage extends HookConsumerWidget {
stackElements.elementAt(1),
childrenToRemove: [currentAsset],
);
Navigator.pop(ctx);
ctx.pop();
context.autoPop();
} else {
await ref.read(assetStackServiceProvider).updateStack(
@ -551,7 +551,7 @@ class GalleryViewerPage extends HookConsumerWidget {
],
);
removeAssetFromStack();
Navigator.pop(ctx);
ctx.pop();
}
},
title: const Text(
@ -569,7 +569,7 @@ class GalleryViewerPage extends HookConsumerWidget {
currentAsset,
childrenToRemove: stack,
);
Navigator.pop(ctx);
ctx.pop();
context.autoPop();
},
title: const Text(

View File

@ -197,7 +197,9 @@ class ThumbnailImage extends StatelessWidget {
},
child: Stack(
children: [
Container(
AnimatedContainer(
duration: const Duration(milliseconds: 300),
curve: Curves.decelerate,
decoration: BoxDecoration(
border: multiselectEnabled && isSelected
? Border.all(

View File

@ -127,6 +127,12 @@ class LoginForm extends HookConsumerWidget {
);
populateTestLoginInfo() {
usernameController.text = 'demo@immich.app';
passwordController.text = 'demo';
serverEndpointController.text = 'https://demo.immich.app';
}
populateTestLoginInfo1() {
usernameController.text = 'testuser@email.com';
passwordController.text = 'password';
serverEndpointController.text = 'http://10.1.15.216:2283/api';
@ -387,6 +393,7 @@ class LoginForm extends HookConsumerWidget {
children: [
GestureDetector(
onDoubleTap: () => populateTestLoginInfo(),
onLongPress: () => populateTestLoginInfo1(),
child: RotationTransition(
turns: logoAnimationController,
child: const ImmichLogo(

View File

@ -17,7 +17,7 @@ class MemoryLane extends HookConsumerWidget {
.whenData(
(memories) => memories != null
? Container(
margin: const EdgeInsets.only(top: 10),
margin: const EdgeInsets.only(top: 10, left: 10),
height: 200,
child: ListView.builder(
scrollDirection: Axis.horizontal,

View File

@ -1,6 +1,7 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/modules/partner/providers/partner.provider.dart';
import 'package:immich_mobile/modules/partner/services/partner.service.dart';
import 'package:immich_mobile/shared/models/user.dart';
@ -34,7 +35,7 @@ class PartnerPage extends HookConsumerWidget {
children: [
for (User u in users)
SimpleDialogOption(
onPressed: () => Navigator.pop(context, u),
onPressed: () => context.pop(u),
child: Row(
children: [
Padding(
@ -70,8 +71,7 @@ class PartnerPage extends HookConsumerWidget {
builder: (BuildContext context) {
return ConfirmDialog(
title: "partner_page_stop_sharing_title",
content:
"partner_page_stop_sharing_content".tr(args: [u.name]),
content: "partner_page_stop_sharing_content".tr(args: [u.name]),
onOk: () => ref.read(partnerServiceProvider).removePartner(u),
);
},
@ -118,6 +118,7 @@ class PartnerPage extends HookConsumerWidget {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
@ -126,13 +127,16 @@ class PartnerPage extends HookConsumerWidget {
style: TextStyle(fontSize: 14),
).tr(),
),
ElevatedButton.icon(
Align(
alignment: Alignment.center,
child: ElevatedButton.icon(
onPressed: availableUsers.whenOrNull(
data: (data) => addNewUsersHandler,
),
icon: const Icon(Icons.person_add),
label: const Text("partner_page_add_partner").tr(),
),
),
],
),
),

View File

@ -1,6 +1,7 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/modules/settings/ui/advanced_settings/advanced_settings.dart';
import 'package:immich_mobile/modules/settings/ui/asset_list_settings/asset_list_settings.dart';
import 'package:immich_mobile/modules/settings/ui/local_storage_settings/local_storage_settings.dart';
@ -18,9 +19,7 @@ class SettingsPage extends HookConsumerWidget {
leading: IconButton(
iconSize: 20,
splashRadius: 24,
onPressed: () {
Navigator.pop(context);
},
onPressed: () => context.pop(),
icon: const Icon(Icons.arrow_back_ios_new_rounded),
),
automaticallyImplyLeading: false,