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