forked from Cutlery/immich
		
	improve login ux (#2004)
removed animated switchers to resolve issue with flutter/issues/120874
This commit is contained in:
		
							parent
							
								
									3a1d5de742
								
							
						
					
					
						commit
						08ed71e51e
					
				| @ -242,5 +242,6 @@ | ||||
|   "permission_onboarding_go_to_settings": "Go to settings", | ||||
|   "permission_onboarding_permission_limited": "Permission limited. To let Immich backup and manage your entire gallery collection, grant photo and video permissions in Settings.", | ||||
|   "permission_onboarding_continue_anyway": "Continue anyway", | ||||
|   "permission_onboarding_log_out": "Log out" | ||||
|   "permission_onboarding_log_out": "Log out", | ||||
|   "login_form_next_button": "Next" | ||||
| } | ||||
|  | ||||
| @ -166,7 +166,6 @@ class LoginForm extends HookConsumerWidget { | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     oAuthLogin() async { | ||||
|       var oAuthService = ref.watch(oAuthServiceProvider); | ||||
|       ref.watch(assetProvider.notifier).clearAllAsset(); | ||||
| @ -230,10 +229,7 @@ class LoginForm extends HookConsumerWidget { | ||||
|     } | ||||
| 
 | ||||
|     buildSelectServer() { | ||||
|       return ConstrainedBox( | ||||
|         key: const ValueKey('server'), | ||||
|         constraints: const BoxConstraints(maxWidth: 300), | ||||
|         child: Column( | ||||
|       return Column( | ||||
|         crossAxisAlignment: CrossAxisAlignment.stretch, | ||||
|         children: [ | ||||
|           ServerEndpointInput( | ||||
| @ -249,7 +245,7 @@ class LoginForm extends HookConsumerWidget { | ||||
|             onPressed: isLoadingServer.value ? null : getServerLoginCredential, | ||||
|             icon: const Icon(Icons.arrow_forward_rounded), | ||||
|             label: const Text( | ||||
|                 'Next', | ||||
|               'login_form_next_button', | ||||
|               style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold), | ||||
|             ).tr(), | ||||
|           ), | ||||
| @ -261,15 +257,11 @@ class LoginForm extends HookConsumerWidget { | ||||
|               ), | ||||
|             ), | ||||
|         ], | ||||
|         ), | ||||
|       ); | ||||
|     } | ||||
| 
 | ||||
|     buildLogin() { | ||||
|       return ConstrainedBox( | ||||
|         key: const ValueKey('login'), | ||||
|         constraints: const BoxConstraints(maxWidth: 300), | ||||
|         child: AutofillGroup( | ||||
|       return AutofillGroup( | ||||
|         child: Column( | ||||
|           crossAxisAlignment: CrossAxisAlignment.stretch, | ||||
|           children: [ | ||||
| @ -290,15 +282,21 @@ class LoginForm extends HookConsumerWidget { | ||||
|               focusNode: passwordFocusNode, | ||||
|               onSubmit: login, | ||||
|             ), | ||||
|               AnimatedSwitcher( | ||||
|                 duration: const Duration(milliseconds: 500), | ||||
|                 child: isLoading.value  | ||||
|                   ? const SizedBox( | ||||
| 
 | ||||
|           // Note: This used to have an AnimatedSwitcher, but was removed | ||||
|           // because of https://github.com/flutter/flutter/issues/120874 | ||||
|           isLoading.value | ||||
|               ? const Padding( | ||||
|                   padding: EdgeInsets.only(top: 18.0), | ||||
|                   child: SizedBox( | ||||
|                     width: 24, | ||||
|                     height: 24, | ||||
|                     child: FittedBox( | ||||
|                       child: CircularProgressIndicator( | ||||
|                         strokeWidth: 2, | ||||
|                       ), | ||||
|                     ), | ||||
|                   ), | ||||
|                 ) | ||||
|               : Column( | ||||
|                   crossAxisAlignment: CrossAxisAlignment.stretch, | ||||
| @ -327,7 +325,6 @@ class LoginForm extends HookConsumerWidget { | ||||
|                     ], | ||||
|                   ], | ||||
|                 ), | ||||
|                   ), | ||||
|               const SizedBox(height: 12), | ||||
|               TextButton.icon( | ||||
|                 icon: const Icon(Icons.arrow_back), | ||||
| @ -336,16 +333,18 @@ class LoginForm extends HookConsumerWidget { | ||||
|               ), | ||||
|           ], | ||||
|         ), | ||||
|         ), | ||||
|       ); | ||||
|     } | ||||
|     final child = serverEndpoint.value == null  | ||||
|     final serverSelectionOrLogin = serverEndpoint.value == null | ||||
|       ? buildSelectServer() | ||||
|       : buildLogin(); | ||||
| 
 | ||||
|     return LayoutBuilder( | ||||
|       builder: (context, constraints) { | ||||
|         return SingleChildScrollView( | ||||
|           child: Center( | ||||
|             child: Container( | ||||
|               constraints: const BoxConstraints(maxWidth: 300), | ||||
|               child: Column( | ||||
|                 crossAxisAlignment: CrossAxisAlignment.stretch, | ||||
|                 mainAxisAlignment: MainAxisAlignment.center, | ||||
| @ -370,12 +369,14 @@ class LoginForm extends HookConsumerWidget { | ||||
|                     ], | ||||
|                   ), | ||||
|                   const SizedBox(height: 18), | ||||
|               AnimatedSwitcher( | ||||
|                 duration: const Duration(milliseconds: 500), | ||||
|                 child: child,  | ||||
|               ), | ||||
| 
 | ||||
|                   // Note: This used to have an AnimatedSwitcher, but was removed | ||||
|                   // because of https://github.com/flutter/flutter/issues/120874 | ||||
|                   serverSelectionOrLogin, | ||||
|                 ], | ||||
|               ), | ||||
|             ), | ||||
|           ), | ||||
|         ); | ||||
|       }, | ||||
|     ); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user