forked from baron/baron-sso
활성 세션 카드 규칙 통일화
This commit is contained in:
@@ -35,6 +35,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
static const _surface = Colors.white;
|
||||
static const _border = Color(0xFFE5E7EB);
|
||||
static const _subtle = Color(0xFFF7F8FA);
|
||||
static const double _dashboardCardSpacing = 12;
|
||||
static const double _historySessionMinWidth = 92;
|
||||
static const double _historyOtherColumnsBaselineWidth = 780;
|
||||
static const int _historySessionMinVisibleChars = 8;
|
||||
@@ -167,9 +168,9 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
|
||||
setState(() => _revokingSessionId = session.sessionId);
|
||||
try {
|
||||
await ref.read(userSessionsProvider.notifier).revokeSession(
|
||||
session.sessionId,
|
||||
);
|
||||
await ref
|
||||
.read(userSessionsProvider.notifier)
|
||||
.revokeSession(session.sessionId);
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
@@ -825,9 +826,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
],
|
||||
_buildSectionTitle(
|
||||
tr('ui.userfront.sections.sessions'),
|
||||
tr(
|
||||
'msg.userfront.sections.sessions_subtitle',
|
||||
),
|
||||
tr('msg.userfront.sections.sessions_subtitle'),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildSessionSection(isMobile),
|
||||
@@ -1007,22 +1006,15 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
Widget _buildSessionGrid(List<UserSessionSummary> sessions, bool isMobile) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
int crossAxisCount;
|
||||
if (constraints.maxWidth > 1200) {
|
||||
crossAxisCount = 3;
|
||||
} else if (constraints.maxWidth > 800) {
|
||||
crossAxisCount = 2;
|
||||
} else {
|
||||
crossAxisCount = 1;
|
||||
}
|
||||
const spacing = 12.0;
|
||||
final cardWidth =
|
||||
(constraints.maxWidth - (spacing * (crossAxisCount - 1))) /
|
||||
crossAxisCount;
|
||||
final crossAxisCount = _dashboardCardColumnCount(constraints.maxWidth);
|
||||
final cardWidth = _dashboardCardWidth(
|
||||
constraints.maxWidth,
|
||||
crossAxisCount,
|
||||
);
|
||||
|
||||
return Wrap(
|
||||
spacing: spacing,
|
||||
runSpacing: spacing,
|
||||
spacing: _dashboardCardSpacing,
|
||||
runSpacing: _dashboardCardSpacing,
|
||||
children: sessions.map((session) {
|
||||
return SizedBox(
|
||||
width: cardWidth,
|
||||
@@ -1189,7 +1181,9 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
)
|
||||
: Text(
|
||||
isCurrent
|
||||
? tr('ui.userfront.dashboard.sessions.current_disabled')
|
||||
? tr(
|
||||
'ui.userfront.dashboard.sessions.current_disabled',
|
||||
)
|
||||
: tr('ui.userfront.dashboard.sessions.revoke.action'),
|
||||
),
|
||||
),
|
||||
@@ -1447,15 +1441,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
builder: (context, constraints) {
|
||||
final maxWidth = constraints.maxWidth;
|
||||
|
||||
// 화면 너비에 따른 컬럼 수 및 초기 표시 개수 결정
|
||||
int crossAxisCount;
|
||||
if (maxWidth > 1200) {
|
||||
crossAxisCount = 4;
|
||||
} else if (maxWidth > 800) {
|
||||
crossAxisCount = 3;
|
||||
} else {
|
||||
crossAxisCount = 2;
|
||||
}
|
||||
final crossAxisCount = _dashboardCardColumnCount(maxWidth);
|
||||
|
||||
// 초기 표시 개수는 한 줄에 표시되는 개수와 동일하게 설정 (요청에 따라 유동적 조절 가능)
|
||||
final int initialVisibleCount = crossAxisCount;
|
||||
@@ -1468,17 +1454,14 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
visibleActivities = activities.take(initialVisibleCount).toList();
|
||||
}
|
||||
|
||||
// 카드의 너비를 화면 너비에 맞춰 계산 (여백 고려)
|
||||
const spacing = 12.0;
|
||||
final double cardWidth =
|
||||
(maxWidth - (spacing * (crossAxisCount - 1))) / crossAxisCount;
|
||||
final cardWidth = _dashboardCardWidth(maxWidth, crossAxisCount);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Wrap(
|
||||
spacing: spacing,
|
||||
runSpacing: spacing,
|
||||
spacing: _dashboardCardSpacing,
|
||||
runSpacing: _dashboardCardSpacing,
|
||||
children: visibleActivities.map((item) {
|
||||
return SizedBox(
|
||||
width: cardWidth,
|
||||
@@ -1746,6 +1729,21 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
int _dashboardCardColumnCount(double maxWidth) {
|
||||
if (maxWidth > 1200) {
|
||||
return 4;
|
||||
}
|
||||
if (maxWidth > 800) {
|
||||
return 3;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
double _dashboardCardWidth(double maxWidth, int crossAxisCount) {
|
||||
return (maxWidth - (_dashboardCardSpacing * (crossAxisCount - 1))) /
|
||||
crossAxisCount;
|
||||
}
|
||||
|
||||
Widget _buildHistoryTable(AuthTimelineState state) {
|
||||
return _buildHistoryContainer(
|
||||
child: Column(
|
||||
|
||||
Reference in New Issue
Block a user