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

@ -45,7 +45,7 @@ extension ContextHelper on BuildContext {
) => ) =>
AutoRouter.of(this).navigate(route); AutoRouter.of(this).navigate(route);
// Auto-Push replace route from the current context // Auto-Push replace route from the current context
Future<T?> autoReplace<T extends Object?>(PageRouteInfo<dynamic> route) => Future<T?> autoReplace<T extends Object?>(PageRouteInfo<dynamic> route) =>
AutoRouter.of(this).replace(route); AutoRouter.of(this).replace(route);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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