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

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

@@ -87,9 +87,10 @@ class _ApprovalStepEnabledPageState extends State<_ApprovalStepEnabledPage> {
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();
}
}
@@ -117,7 +118,7 @@ class _ApprovalStepEnabledPageState extends State<_ApprovalStepEnabledPage> {
final pageSize = result?.pageSize ?? records.length;
final totalPages = pageSize == 0
? 1
: (totalCount / pageSize).ceil().clamp(1, 9999);
: (totalCount / pageSize).ceil().clamp(1, 9999) as int;
final hasNext = result == null
? false
: (result.page * result.pageSize) < result.total;
@@ -410,6 +411,17 @@ class _ApprovalStepEnabledPageState extends State<_ApprovalStepEnabledPage> {
Text('$totalCount건', style: theme.textTheme.small),
Row(
children: [
ShadButton.outline(
size: ShadButtonSize.sm,
onPressed:
_controller.isLoading ||
isSaving ||
currentPage <= 1
? null
: () => _controller.fetch(page: 1),
child: const Text('처음'),
),
const SizedBox(width: 8),
ShadButton.outline(
size: ShadButtonSize.sm,
onPressed:
@@ -435,6 +447,19 @@ class _ApprovalStepEnabledPageState extends State<_ApprovalStepEnabledPage> {
),
child: const Text('다음'),
),
const SizedBox(width: 8),
ShadButton.outline(
size: ShadButtonSize.sm,
onPressed:
_controller.isLoading ||
isSaving ||
currentPage >= totalPages
? null
: () => _controller.fetch(
page: totalPages,
),
child: const Text('마지막'),
),
const SizedBox(width: 12),
Text(
'페이지 $currentPage / $totalPages',
@@ -507,7 +532,8 @@ class _ApprovalStepEnabledPageState extends State<_ApprovalStepEnabledPage> {
return;
}
ScaffoldMessenger.of(context).showSnackBar(
final messenger = ScaffoldMessenger.maybeOf(context);
messenger?.showSnackBar(
SnackBar(content: Text('결재번호 ${created.approvalNo} 단계가 추가되었습니다.')),
);
}
@@ -515,9 +541,10 @@ class _ApprovalStepEnabledPageState extends State<_ApprovalStepEnabledPage> {
Future<void> _openEditStepForm(ApprovalStepRecord record) async {
final stepId = record.step.id;
if (stepId == null) {
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('저장되지 않은 단계는 수정할 수 없습니다.')));
final messenger = ScaffoldMessenger.maybeOf(context);
messenger?.showSnackBar(
const SnackBar(content: Text('저장되지 않은 단계는 수정할 수 없습니다.')),
);
return;
}
@@ -542,7 +569,8 @@ class _ApprovalStepEnabledPageState extends State<_ApprovalStepEnabledPage> {
return;
}
ScaffoldMessenger.of(context).showSnackBar(
final messenger = ScaffoldMessenger.maybeOf(context);
messenger?.showSnackBar(
SnackBar(content: Text('결재번호 ${updated.approvalNo} 단계 정보를 수정했습니다.')),
);
}
@@ -550,7 +578,8 @@ class _ApprovalStepEnabledPageState extends State<_ApprovalStepEnabledPage> {
Future<void> _openDetail(ApprovalStepRecord record) async {
final stepId = record.step.id;
if (stepId == null) {
ScaffoldMessenger.of(context).showSnackBar(
final messenger = ScaffoldMessenger.maybeOf(context);
messenger?.showSnackBar(
const SnackBar(content: Text('단계 식별자가 없어 상세 정보를 볼 수 없습니다.')),
);
return;
@@ -614,9 +643,10 @@ class _ApprovalStepEnabledPageState extends State<_ApprovalStepEnabledPage> {
Future<void> _confirmDeleteStep(ApprovalStepRecord record) async {
final stepId = record.step.id;
if (stepId == null) {
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('저장되지 않은 단계는 삭제할 수 없습니다.')));
final messenger = ScaffoldMessenger.maybeOf(context);
messenger?.showSnackBar(
const SnackBar(content: Text('저장되지 않은 단계는 삭제할 수 없습니다.')),
);
return;
}
@@ -628,11 +658,13 @@ class _ApprovalStepEnabledPageState extends State<_ApprovalStepEnabledPage> {
'결재번호 ${record.approvalNo}${record.step.stepOrder}단계를 삭제하시겠습니까? 삭제 후 복구할 수 있습니다.',
actions: [
ShadButton.ghost(
onPressed: () => Navigator.of(context).pop(false),
onPressed: () =>
Navigator.of(context, rootNavigator: true).pop(false),
child: const Text('취소'),
),
ShadButton.destructive(
onPressed: () => Navigator.of(context).pop(true),
onPressed: () =>
Navigator.of(context, rootNavigator: true).pop(true),
child: const Text('삭제'),
),
],
@@ -648,7 +680,8 @@ class _ApprovalStepEnabledPageState extends State<_ApprovalStepEnabledPage> {
return;
}
if (success) {
ScaffoldMessenger.of(context).showSnackBar(
final messenger = ScaffoldMessenger.maybeOf(context);
messenger?.showSnackBar(
SnackBar(content: Text('결재번호 ${record.approvalNo} 단계가 삭제되었습니다.')),
);
}
@@ -657,9 +690,10 @@ class _ApprovalStepEnabledPageState extends State<_ApprovalStepEnabledPage> {
Future<void> _confirmRestoreStep(ApprovalStepRecord record) async {
final stepId = record.step.id;
if (stepId == null) {
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('단계 식별자가 없어 복구할 수 없습니다.')));
final messenger = ScaffoldMessenger.maybeOf(context);
messenger?.showSnackBar(
const SnackBar(content: Text('단계 식별자가 없어 복구할 수 없습니다.')),
);
return;
}
@@ -671,11 +705,13 @@ class _ApprovalStepEnabledPageState extends State<_ApprovalStepEnabledPage> {
'결재번호 ${record.approvalNo}${record.step.stepOrder}단계를 복구하시겠습니까?',
actions: [
ShadButton.ghost(
onPressed: () => Navigator.of(context).pop(false),
onPressed: () =>
Navigator.of(context, rootNavigator: true).pop(false),
child: const Text('취소'),
),
ShadButton(
onPressed: () => Navigator.of(context).pop(true),
onPressed: () =>
Navigator.of(context, rootNavigator: true).pop(true),
child: const Text('복구'),
),
],
@@ -691,7 +727,8 @@ class _ApprovalStepEnabledPageState extends State<_ApprovalStepEnabledPage> {
return;
}
if (restored != null) {
ScaffoldMessenger.of(context).showSnackBar(
final messenger = ScaffoldMessenger.maybeOf(context);
messenger?.showSnackBar(
SnackBar(content: Text('결재번호 ${restored.approvalNo} 단계가 복구되었습니다.')),
);
}
@@ -832,7 +869,7 @@ class _StepFormDialogState extends State<_StepFormDialog> {
child: Text(widget.submitLabel),
),
secondaryAction: ShadButton.ghost(
onPressed: () => Navigator.of(context).pop(),
onPressed: () => Navigator.of(context, rootNavigator: true).pop(),
child: const Text('취소'),
),
contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
@@ -951,7 +988,7 @@ class _StepFormDialogState extends State<_StepFormDialog> {
statusId: widget.initialRecord?.step.status.id,
);
Navigator.of(context).pop(input);
Navigator.of(context, rootNavigator: true).pop(input);
}
void _clearError(String field) {