forked from baron/baron-sso
flutter 린트 적용
This commit is contained in:
@@ -88,3 +88,16 @@ String buildLocalizedPath(String localeCode, Uri uri) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
String buildSigninRedirectPath(String localeCode, Uri uri) {
|
||||
final newPath = '/$localeCode/signin';
|
||||
final newUri = uri.replace(path: newPath);
|
||||
String result = newUri.path;
|
||||
if (newUri.hasQuery) {
|
||||
result += '?${newUri.query}';
|
||||
}
|
||||
if (newUri.hasFragment) {
|
||||
result += '#${newUri.fragment}';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class AuthTokenStore {
|
||||
_localStorage.setItem(_providerKey, provider);
|
||||
}
|
||||
} catch (e) {
|
||||
print("[AuthTokenStore] CRITICAL - Failed to set token: $e");
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,25 +12,17 @@ class WebWindow {
|
||||
|
||||
void redirectTo(String url) {
|
||||
final currentHref = web.window.location.href;
|
||||
Uri? targetUri;
|
||||
try {
|
||||
targetUri = Uri.parse(url);
|
||||
} catch (_) {
|
||||
debugPrint("[WebWindow] redirectTo parse failed: url=$url");
|
||||
}
|
||||
|
||||
debugPrint(
|
||||
"[WebWindow] redirectTo start: current=$currentHref, target=$url",
|
||||
);
|
||||
|
||||
print("[WebWindow] FINAL REDIRECT ATTEMPT. URL: $url");
|
||||
|
||||
// Most direct and safe way for WASM: location.href assignment via package:web
|
||||
Future.delayed(Duration.zero, () {
|
||||
try {
|
||||
web.window.location.href = url;
|
||||
} catch (e) {
|
||||
print("[WebWindow] CRITICAL JS ERROR: $e");
|
||||
debugPrint("[WebWindow] CRITICAL JS ERROR: $e");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -38,11 +38,10 @@ class LanguageSelector extends StatelessWidget {
|
||||
}
|
||||
LocaleStorage.write(value);
|
||||
await context.setLocale(Locale(value));
|
||||
if (!context.mounted) return;
|
||||
final uri = GoRouterState.of(context).uri;
|
||||
final target = buildLocalizedPath(value, uri);
|
||||
if (context.mounted) {
|
||||
context.go(target);
|
||||
}
|
||||
context.go(target);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user