forked from baron/baron-sso
활성 RP 홈페이지 이동 기능 추가
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
import '../../../../core/notifiers/auth_notifier.dart';
|
import '../../../../core/notifiers/auth_notifier.dart';
|
||||||
import '../../../../core/services/auth_token_store.dart';
|
import '../../../../core/services/auth_token_store.dart';
|
||||||
import '../../../../core/services/http_client.dart';
|
import '../../../../core/services/http_client.dart';
|
||||||
@@ -106,6 +107,7 @@ class LinkedRp {
|
|||||||
final String id;
|
final String id;
|
||||||
final String name;
|
final String name;
|
||||||
final String logo;
|
final String logo;
|
||||||
|
final String url;
|
||||||
final String status;
|
final String status;
|
||||||
final List<String> scopes;
|
final List<String> scopes;
|
||||||
final DateTime? lastAuthenticatedAt;
|
final DateTime? lastAuthenticatedAt;
|
||||||
@@ -114,6 +116,7 @@ class LinkedRp {
|
|||||||
required this.id,
|
required this.id,
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.logo,
|
required this.logo,
|
||||||
|
required this.url,
|
||||||
required this.status,
|
required this.status,
|
||||||
required this.scopes,
|
required this.scopes,
|
||||||
required this.lastAuthenticatedAt,
|
required this.lastAuthenticatedAt,
|
||||||
@@ -134,6 +137,7 @@ class LinkedRp {
|
|||||||
id: json['id']?.toString() ?? '',
|
id: json['id']?.toString() ?? '',
|
||||||
name: json['name']?.toString() ?? '',
|
name: json['name']?.toString() ?? '',
|
||||||
logo: json['logo']?.toString() ?? '',
|
logo: json['logo']?.toString() ?? '',
|
||||||
|
url: json['url']?.toString() ?? '',
|
||||||
status: json['status']?.toString() ?? '',
|
status: json['status']?.toString() ?? '',
|
||||||
scopes: (json['scopes'] as List?)?.whereType<String>().toList() ?? [],
|
scopes: (json['scopes'] as List?)?.whereType<String>().toList() ?? [],
|
||||||
lastAuthenticatedAt: parsedLastAuth,
|
lastAuthenticatedAt: parsedLastAuth,
|
||||||
@@ -887,6 +891,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
canLogout: false,
|
canLogout: false,
|
||||||
isRevoked: isRevoked,
|
isRevoked: isRevoked,
|
||||||
onRevoke: isRevoked ? null : () => _onRevokeLink(rp.id, name),
|
onRevoke: isRevoked ? null : () => _onRevokeLink(rp.id, name),
|
||||||
|
url: rp.url, // URL 전달
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -945,9 +950,11 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
final borderColor = isActive ? Colors.green.withOpacity(0.5) : _border;
|
final borderColor = isActive ? Colors.green.withOpacity(0.5) : _border;
|
||||||
final borderWidth = isActive ? 1.5 : 1.0;
|
final borderWidth = isActive ? 1.5 : 1.0;
|
||||||
|
|
||||||
return Opacity(
|
// 활성 상태면 클릭 가능 (URL 유무와 관계없이)
|
||||||
opacity: item.isRevoked ? 0.6 : 1.0,
|
final isClickable = isActive;
|
||||||
child: Container(
|
|
||||||
|
// 카드 컨텐츠
|
||||||
|
final cardContent = Container(
|
||||||
width: 260,
|
width: 260,
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -1033,10 +1040,47 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Opacity 적용
|
||||||
|
final opaqueCard = Opacity(
|
||||||
|
opacity: item.isRevoked ? 0.6 : 1.0,
|
||||||
|
child: cardContent,
|
||||||
|
);
|
||||||
|
|
||||||
|
// 클릭 가능한 경우 InkWell로 감싸기
|
||||||
|
if (isClickable) {
|
||||||
|
return MouseRegion(
|
||||||
|
cursor: SystemMouseCursors.click,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () async {
|
||||||
|
if (item.url != null && item.url!.isNotEmpty) {
|
||||||
|
final uri = Uri.parse(item.url!);
|
||||||
|
if (await canLaunchUrl(uri)) {
|
||||||
|
await launchUrl(uri);
|
||||||
|
} else {
|
||||||
|
if (context.mounted) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('해당 링크를 열 수 없습니다.')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (context.mounted) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text('이동할 페이지 주소(Client URI)가 설정되지 않았습니다.')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: opaqueCard,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return opaqueCard;
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildAccessHistory(bool isWide) {
|
Widget _buildAccessHistory(bool isWide) {
|
||||||
if (_auditLoading && _auditLogs.isEmpty) {
|
if (_auditLoading && _auditLogs.isEmpty) {
|
||||||
return _buildHistoryContainer(
|
return _buildHistoryContainer(
|
||||||
@@ -1232,6 +1276,7 @@ class _ActivityItem {
|
|||||||
final String appName;
|
final String appName;
|
||||||
final String lastAuthAt;
|
final String lastAuthAt;
|
||||||
final String status;
|
final String status;
|
||||||
|
final String? url;
|
||||||
final bool canLogout;
|
final bool canLogout;
|
||||||
final bool isRevoked;
|
final bool isRevoked;
|
||||||
final VoidCallback? onLogout;
|
final VoidCallback? onLogout;
|
||||||
@@ -1243,6 +1288,7 @@ class _ActivityItem {
|
|||||||
required this.lastAuthAt,
|
required this.lastAuthAt,
|
||||||
required this.status,
|
required this.status,
|
||||||
required this.canLogout,
|
required this.canLogout,
|
||||||
|
this.url,
|
||||||
this.isRevoked = false,
|
this.isRevoked = false,
|
||||||
this.onLogout,
|
this.onLogout,
|
||||||
this.onRevoke,
|
this.onRevoke,
|
||||||
|
|||||||
Reference in New Issue
Block a user