1
0
forked from baron/baron-sso

flutter 린트 적용

This commit is contained in:
2026-02-19 16:08:42 +09:00
parent 466e7f1e54
commit 3eb7ed01ee
8 changed files with 35 additions and 73 deletions

View File

@@ -1,3 +1,4 @@
// ignore_for_file: avoid_print
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
@@ -120,7 +121,6 @@ final _router = GoRouter(
GoRoute(
path: '', // Matches /:locale
builder: (context, state) {
print("[Router] Building Dashboard (Root)");
return const DashboardScreen();
},
),
@@ -134,7 +134,6 @@ final _router = GoRouter(
final loginChallenge = state.uri.queryParameters['login_challenge'];
final redirectUrl = state.uri.queryParameters['redirect_uri'] ??
state.uri.queryParameters['redirect_url'];
print("[Router] Building /signin. Challenge: $loginChallenge");
return LoginScreen(
key: state.pageKey,
loginChallenge: loginChallenge,
@@ -149,7 +148,6 @@ final _router = GoRouter(
final loginChallenge = state.uri.queryParameters['login_challenge'];
final redirectUrl = state.uri.queryParameters['redirect_uri'] ??
state.uri.queryParameters['redirect_url'];
print("[Router] Building /login (as signin). Challenge: $loginChallenge");
return LoginScreen(
key: state.pageKey,
loginChallenge: loginChallenge,
@@ -162,12 +160,10 @@ final _router = GoRouter(
builder: (BuildContext context, GoRouterState state) {
final consentChallenge = state.uri.queryParameters['consent_challenge'];
if (consentChallenge == null) {
print("[Router] WARNING: Consent screen without challenge.");
return const Scaffold(
body: Center(child: Text('Error: Consent challenge is missing.')),
);
}
print("[Router] Building /consent. Challenge: $consentChallenge");
return ConsentScreen(consentChallenge: consentChallenge);
},
),
@@ -200,7 +196,6 @@ final _router = GoRouter(
GoRoute(
path: 'l/:shortCode',
builder: (context, state) {
final shortCode = state.pathParameters['shortCode'];
return LoginScreen(key: state.pageKey);
},
),
@@ -264,11 +259,8 @@ final _router = GoRouter(
final requestedLocale = extractLocaleFromPath(uri);
final preferredLocale = resolvePreferredLocaleCode();
print("[Router] Redirect check for: $uri");
if (requestedLocale == null) {
final localizedPath = buildLocalizedPath(preferredLocale, uri);
print("[Router] Locale missing. Redirecting to: $localizedPath");
return localizedPath;
}
@@ -296,22 +288,12 @@ final _router = GoRouter(
path.startsWith('/consent/') ||
uri.path.contains('/consent');
print("[Router] Path: $path, IsLoggedIn: $isLoggedIn, IsPublic: $isPublicPath");
if (isPublicPath) {
return null;
}
if (!isLoggedIn) {
print("[Router] ACCESS DENIED. Redirecting to /signin");
final locale = requestedLocale;
final newPath = '/$locale/signin';
// Preserve ALL query parameters
final finalRedirect = uri.replace(path: newPath);
String result = finalRedirect.path;
if (finalRedirect.hasQuery) result += '?${finalRedirect.query}';
return result;
return buildSigninRedirectPath(requestedLocale, uri);
}
return null;