11import 'package:flutter/material.dart' hide IconAlignment;
22import 'package:on_time_front/core/di/di_setup.dart' ;
3+ import 'package:on_time_front/core/dio/api_error_message.dart' ;
34import 'package:on_time_front/core/logging/app_logger.dart' ;
45import 'package:on_time_front/domain/repositories/user_repository.dart' ;
56import 'package:sign_in_with_apple/sign_in_with_apple.dart' ;
@@ -29,8 +30,9 @@ class AppleSignInButton extends StatelessWidget {
2930 final fullNameRaw =
3031 '${credential .givenName ?? '' } ${credential .familyName ?? '' }'
3132 .trim ();
32- final fullName =
33- fullNameRaw.isNotEmpty ? fullNameRaw : 'Apple User' ;
33+ final fullName = fullNameRaw.isNotEmpty
34+ ? fullNameRaw
35+ : 'Apple User' ;
3436
3537 final identityToken = credential.identityToken;
3638 final authorizationCode = credential.authorizationCode;
@@ -44,10 +46,20 @@ class AppleSignInButton extends StatelessWidget {
4446 fullName: fullName,
4547 email: credential.email,
4648 );
47- } catch (error) {
49+ } catch (error, stackTrace ) {
4850 AppLogger .debug (
49- 'Apple Sign-In button failed errorType=${error .runtimeType }' ,
51+ 'Apple Sign-In button failed errorType=${error .runtimeType } '
52+ 'message=$error stackTrace=$stackTrace ' ,
5053 );
54+ if (! context.mounted) {
55+ return ;
56+ }
57+ final message =
58+ ApiErrorMessage .fromException (error) ??
59+ 'Apple 로그인에 실패했습니다. 잠시 후 다시 시도해 주세요.' ;
60+ ScaffoldMessenger .of (
61+ context,
62+ ).showSnackBar (SnackBar (content: Text (message)));
5163 }
5264 },
5365 borderRadius: BorderRadius .circular (14 ),
0 commit comments