계정 정보 다이얼로그 추가 및 전체 목록 페치 개선

This commit is contained in:
JiWoong Sul
2025-10-22 01:05:47 +09:00
parent 6b58effc83
commit f4dc83d441
44 changed files with 1636 additions and 362 deletions

View File

@@ -43,6 +43,17 @@ class ApprovalHistoryController extends ChangeNotifier {
_errorMessage = null;
notifyListeners();
try {
final previous = _result;
final int resolvedPage;
if (page < 1) {
resolvedPage = 1;
} else if (previous != null && previous.pageSize > 0) {
final calculated = (previous.total / previous.pageSize).ceil();
final maxPage = calculated < 1 ? 1 : calculated;
resolvedPage = page > maxPage ? maxPage : page;
} else {
resolvedPage = page;
}
final action = switch (_actionFilter) {
ApprovalHistoryActionFilter.all => null,
ApprovalHistoryActionFilter.approve => 'approve',
@@ -51,7 +62,7 @@ class ApprovalHistoryController extends ChangeNotifier {
};
final response = await _repository.list(
page: page,
page: resolvedPage,
pageSize: _pageSize,
query: _query.trim().isEmpty ? null : _query.trim(),
action: action,

View File

@@ -87,9 +87,10 @@ class _ApprovalHistoryEnabledPageState
final error = _controller.errorMessage;
if (error != null && error != _lastError && mounted) {
_lastError = error;
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(error)));
final messenger = ScaffoldMessenger.maybeOf(context);
if (messenger != null) {
messenger.showSnackBar(SnackBar(content: Text(error)));
}
_controller.clearError();
}
}
@@ -115,7 +116,7 @@ class _ApprovalHistoryEnabledPageState
final currentPage = result?.page ?? 1;
final totalPages = result == null || result.pageSize == 0
? 1
: (result.total / result.pageSize).ceil().clamp(1, 9999);
: (result.total / result.pageSize).ceil().clamp(1, 9999) as int;
final sortedHistories = _applySorting(histories);
return AppLayout(