feat(dialog): 상세 팝업 SuperportDetailDialog 통합
- SuperportDetailDialog 위젯과 showSuperportDetailDialog 헬퍼를 추가하고 metadata/섹션 패턴을 표준화 - 결재/재고/마스터 각 상세 다이얼로그를 dialogs 디렉터리에 신설하고 기존 페이지를 신규 팝업으로 전환 - SuperportTable 행 선택과 우편번호 검색 다이얼로그 onRowTap 보정을 통해 헤더 오프셋 버그를 제거 - 상세 다이얼로그 및 트랜잭션/상세 뷰 전용 위젯 테스트와 tester_extensions 유틸을 추가하여 회귀를 방지 - detail_dialog_unification_plan.md로 작업 배경과 필드 통합 계획을 문서화
This commit is contained in:
@@ -6,8 +6,8 @@ import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import 'package:superport_v2/core/constants/app_sections.dart';
|
||||
import 'package:superport_v2/widgets/app_layout.dart';
|
||||
import 'package:superport_v2/widgets/components/filter_bar.dart';
|
||||
import 'package:superport_v2/widgets/components/superport_dialog.dart';
|
||||
import 'package:superport_v2/widgets/components/superport_pagination_controls.dart';
|
||||
import 'package:superport_v2/widgets/components/superport_table.dart';
|
||||
|
||||
import '../../../../../core/config/environment.dart';
|
||||
import '../../../../../core/permissions/permission_manager.dart';
|
||||
@@ -19,6 +19,7 @@ import '../../../menu/domain/repositories/menu_repository.dart';
|
||||
import '../../domain/entities/group_permission.dart';
|
||||
import '../../domain/repositories/group_permission_repository.dart';
|
||||
import '../controllers/group_permission_controller.dart';
|
||||
import '../dialogs/group_permission_detail_dialog.dart';
|
||||
|
||||
String _menuDisplayLabelFromPath(String? path, String fallback) {
|
||||
if (path != null && path.isNotEmpty) {
|
||||
@@ -216,7 +217,7 @@ class _GroupPermissionEnabledPageState
|
||||
leading: const Icon(LucideIcons.plus, size: 16),
|
||||
onPressed: _controller.isSubmitting
|
||||
? null
|
||||
: () => _openPermissionForm(context),
|
||||
: _openPermissionCreateDialog,
|
||||
child: const Text('신규 등록'),
|
||||
),
|
||||
],
|
||||
@@ -399,16 +400,9 @@ class _GroupPermissionEnabledPageState
|
||||
: _PermissionTable(
|
||||
permissions: permissions,
|
||||
dateFormat: _dateFormat,
|
||||
onEdit: _controller.isSubmitting
|
||||
onRowTap: _controller.isSubmitting
|
||||
? null
|
||||
: (permission) => _openPermissionForm(
|
||||
context,
|
||||
permission: permission,
|
||||
),
|
||||
onDelete: _controller.isSubmitting ? null : _confirmDelete,
|
||||
onRestore: _controller.isSubmitting
|
||||
? null
|
||||
: _restorePermission,
|
||||
: _openPermissionDetailDialog,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -435,368 +429,45 @@ class _GroupPermissionEnabledPageState
|
||||
return _menuDisplayLabelFromPath(menu.path, menu.menuName);
|
||||
}
|
||||
|
||||
Future<void> _openPermissionForm(
|
||||
BuildContext context, {
|
||||
GroupPermission? permission,
|
||||
}) async {
|
||||
final existingPermission = permission;
|
||||
final isEdit = existingPermission != null;
|
||||
final permissionId = existingPermission?.id;
|
||||
if (isEdit && permissionId == null) {
|
||||
_showSnack('ID 정보가 없어 수정할 수 없습니다.');
|
||||
Future<void> _openPermissionCreateDialog() async {
|
||||
final result = await showGroupPermissionDetailDialog(
|
||||
context: context,
|
||||
dateFormat: _dateFormat,
|
||||
groups: _controller.groups,
|
||||
isLoadingGroups: _controller.isLoadingGroups,
|
||||
menus: _controller.menus,
|
||||
isLoadingMenus: _controller.isLoadingMenus,
|
||||
onCreate: _controller.create,
|
||||
onUpdate: _controller.update,
|
||||
onDelete: _controller.delete,
|
||||
onRestore: _controller.restore,
|
||||
);
|
||||
if (result != null && mounted) {
|
||||
_showSnack(result.message);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _openPermissionDetailDialog(GroupPermission permission) async {
|
||||
final permissionId = permission.id;
|
||||
if (permissionId == null) {
|
||||
_showSnack('ID 정보가 없어 상세를 열 수 없습니다.');
|
||||
return;
|
||||
}
|
||||
|
||||
final groupNotifier = ValueNotifier<int?>(existingPermission?.group.id);
|
||||
final menuNotifier = ValueNotifier<int?>(existingPermission?.menu.id);
|
||||
final createNotifier = ValueNotifier<bool>(
|
||||
existingPermission?.canCreate ?? false,
|
||||
);
|
||||
final readNotifier = ValueNotifier<bool>(
|
||||
existingPermission?.canRead ?? true,
|
||||
);
|
||||
final updateNotifier = ValueNotifier<bool>(
|
||||
existingPermission?.canUpdate ?? false,
|
||||
);
|
||||
final deleteNotifier = ValueNotifier<bool>(
|
||||
existingPermission?.canDelete ?? false,
|
||||
);
|
||||
final activeNotifier = ValueNotifier<bool>(
|
||||
existingPermission?.isActive ?? true,
|
||||
);
|
||||
final noteController = TextEditingController(
|
||||
text: existingPermission?.note ?? '',
|
||||
);
|
||||
final saving = ValueNotifier<bool>(false);
|
||||
final groupError = ValueNotifier<String?>(null);
|
||||
final menuError = ValueNotifier<String?>(null);
|
||||
|
||||
await SuperportDialog.show<bool>(
|
||||
final result = await showGroupPermissionDetailDialog(
|
||||
context: context,
|
||||
dialog: SuperportDialog(
|
||||
title: isEdit ? '권한 수정' : '권한 등록',
|
||||
description: '그룹과 메뉴의 권한을 ${isEdit ? '수정' : '등록'}하세요.',
|
||||
constraints: const BoxConstraints(maxWidth: 600),
|
||||
secondaryAction: ValueListenableBuilder<bool>(
|
||||
valueListenable: saving,
|
||||
builder: (dialogContext, isSaving, __) {
|
||||
return ShadButton.ghost(
|
||||
onPressed: isSaving
|
||||
? null
|
||||
: () => Navigator.of(
|
||||
dialogContext,
|
||||
rootNavigator: true,
|
||||
).pop(false),
|
||||
child: const Text('취소'),
|
||||
);
|
||||
},
|
||||
),
|
||||
primaryAction: ValueListenableBuilder<bool>(
|
||||
valueListenable: saving,
|
||||
builder: (dialogContext, isSaving, __) {
|
||||
return ShadButton(
|
||||
onPressed: isSaving
|
||||
? null
|
||||
: () async {
|
||||
final groupId = groupNotifier.value;
|
||||
final menuId = menuNotifier.value;
|
||||
groupError.value = groupId == null ? '그룹을 선택하세요.' : null;
|
||||
menuError.value = menuId == null ? '메뉴를 선택하세요.' : null;
|
||||
if (groupError.value != null || menuError.value != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
saving.value = true;
|
||||
final trimmedNote = noteController.text.trim();
|
||||
final input = GroupPermissionInput(
|
||||
groupId: groupId!,
|
||||
menuId: menuId!,
|
||||
canCreate: createNotifier.value,
|
||||
canRead: readNotifier.value,
|
||||
canUpdate: updateNotifier.value,
|
||||
canDelete: deleteNotifier.value,
|
||||
isActive: activeNotifier.value,
|
||||
note: trimmedNote.isEmpty ? null : trimmedNote,
|
||||
);
|
||||
final navigator = Navigator.of(
|
||||
dialogContext,
|
||||
rootNavigator: true,
|
||||
);
|
||||
final response = isEdit
|
||||
? await _controller.update(permissionId!, input)
|
||||
: await _controller.create(input);
|
||||
saving.value = false;
|
||||
if (response != null) {
|
||||
if (!navigator.mounted) {
|
||||
return;
|
||||
}
|
||||
if (mounted) {
|
||||
_showSnack(isEdit ? '권한을 수정했습니다.' : '권한을 등록했습니다.');
|
||||
}
|
||||
navigator.pop(true);
|
||||
}
|
||||
},
|
||||
child: Text(isEdit ? '저장' : '등록'),
|
||||
);
|
||||
},
|
||||
),
|
||||
child: ValueListenableBuilder<bool>(
|
||||
valueListenable: saving,
|
||||
builder: (dialogContext, isSaving, __) {
|
||||
final theme = ShadTheme.of(dialogContext);
|
||||
final materialTheme = Theme.of(dialogContext);
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.only(right: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ValueListenableBuilder<String?>(
|
||||
valueListenable: groupError,
|
||||
builder: (_, errorText, __) {
|
||||
return _FormField(
|
||||
label: '그룹',
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ShadSelect<int?>(
|
||||
initialValue: groupNotifier.value,
|
||||
placeholder: const Text('그룹을 선택하세요'),
|
||||
selectedOptionBuilder: (context, value) {
|
||||
if (value == null) {
|
||||
return const Text('그룹을 선택하세요');
|
||||
}
|
||||
final groupId = value;
|
||||
final group = _controller.groups.firstWhere(
|
||||
(g) => g.id == groupId,
|
||||
orElse: () =>
|
||||
Group(id: groupId, groupName: ''),
|
||||
);
|
||||
return Text(
|
||||
group.groupName.isEmpty
|
||||
? '그룹을 선택하세요'
|
||||
: group.groupName,
|
||||
);
|
||||
},
|
||||
onChanged: isSaving || isEdit
|
||||
? null
|
||||
: (value) {
|
||||
groupNotifier.value = value;
|
||||
if (value != null) {
|
||||
groupError.value = null;
|
||||
}
|
||||
},
|
||||
options: [
|
||||
..._controller.groups.map(
|
||||
(group) => ShadOption<int?>(
|
||||
value: group.id,
|
||||
child: Text(group.groupName),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (errorText != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 6),
|
||||
child: Text(
|
||||
errorText,
|
||||
style: theme.textTheme.small.copyWith(
|
||||
color: materialTheme.colorScheme.error,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ValueListenableBuilder<String?>(
|
||||
valueListenable: menuError,
|
||||
builder: (_, errorText, __) {
|
||||
return _FormField(
|
||||
label: '메뉴',
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ShadSelect<int?>(
|
||||
initialValue: menuNotifier.value,
|
||||
placeholder: const Text('메뉴를 선택하세요'),
|
||||
selectedOptionBuilder: (context, value) {
|
||||
if (value == null) {
|
||||
return const Text('메뉴를 선택하세요');
|
||||
}
|
||||
final menuId = value;
|
||||
final menu = _controller.menus.firstWhere(
|
||||
(m) => m.id == menuId,
|
||||
orElse: () => MenuItem(
|
||||
id: menuId,
|
||||
menuCode: '',
|
||||
menuName: '',
|
||||
),
|
||||
);
|
||||
return Text(
|
||||
menu.menuName.isEmpty
|
||||
? '메뉴를 선택하세요'
|
||||
: menu.menuName,
|
||||
);
|
||||
},
|
||||
onChanged: isSaving || isEdit
|
||||
? null
|
||||
: (value) {
|
||||
menuNotifier.value = value;
|
||||
if (value != null) {
|
||||
menuError.value = null;
|
||||
}
|
||||
},
|
||||
options: [
|
||||
..._controller.menus.map(
|
||||
(menu) => ShadOption<int?>(
|
||||
value: menu.id,
|
||||
child: Text(menu.menuName),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (errorText != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 6),
|
||||
child: Text(
|
||||
errorText,
|
||||
style: theme.textTheme.small.copyWith(
|
||||
color: materialTheme.colorScheme.error,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_PermissionToggleRow(
|
||||
label: '생성권한',
|
||||
notifier: createNotifier,
|
||||
enabled: !isSaving,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_PermissionToggleRow(
|
||||
label: '조회권한',
|
||||
notifier: readNotifier,
|
||||
enabled: !isSaving,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_PermissionToggleRow(
|
||||
label: '수정권한',
|
||||
notifier: updateNotifier,
|
||||
enabled: !isSaving,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_PermissionToggleRow(
|
||||
label: '삭제권한',
|
||||
notifier: deleteNotifier,
|
||||
enabled: !isSaving,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ValueListenableBuilder<bool>(
|
||||
valueListenable: activeNotifier,
|
||||
builder: (_, value, __) {
|
||||
return _FormField(
|
||||
label: '사용여부',
|
||||
child: Row(
|
||||
children: [
|
||||
ShadSwitch(
|
||||
value: value,
|
||||
onChanged: isSaving
|
||||
? null
|
||||
: (next) => activeNotifier.value = next,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(value ? '사용' : '미사용'),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_FormField(
|
||||
label: '비고',
|
||||
child: ShadTextarea(controller: noteController),
|
||||
),
|
||||
if (existingPermission != null) ...[
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'생성일시: ${_formatDateTime(existingPermission.createdAt)}',
|
||||
style: theme.textTheme.small,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'수정일시: ${_formatDateTime(existingPermission.updatedAt)}',
|
||||
style: theme.textTheme.small,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
dateFormat: _dateFormat,
|
||||
permission: permission,
|
||||
groups: _controller.groups,
|
||||
isLoadingGroups: _controller.isLoadingGroups,
|
||||
menus: _controller.menus,
|
||||
isLoadingMenus: _controller.isLoadingMenus,
|
||||
onCreate: _controller.create,
|
||||
onUpdate: _controller.update,
|
||||
onDelete: _controller.delete,
|
||||
onRestore: _controller.restore,
|
||||
);
|
||||
|
||||
groupNotifier.dispose();
|
||||
menuNotifier.dispose();
|
||||
createNotifier.dispose();
|
||||
readNotifier.dispose();
|
||||
updateNotifier.dispose();
|
||||
deleteNotifier.dispose();
|
||||
activeNotifier.dispose();
|
||||
noteController.dispose();
|
||||
saving.dispose();
|
||||
groupError.dispose();
|
||||
menuError.dispose();
|
||||
}
|
||||
|
||||
Future<void> _confirmDelete(GroupPermission permission) async {
|
||||
final confirmed = await SuperportDialog.show<bool>(
|
||||
context: context,
|
||||
dialog: SuperportDialog(
|
||||
title: '권한 삭제',
|
||||
description:
|
||||
'"${permission.group.groupName}" → "${permission.menu.menuName}" 권한을 삭제하시겠습니까?',
|
||||
secondaryAction: Builder(
|
||||
builder: (dialogContext) {
|
||||
return ShadButton.ghost(
|
||||
onPressed: () =>
|
||||
Navigator.of(dialogContext, rootNavigator: true).pop(false),
|
||||
child: const Text('취소'),
|
||||
);
|
||||
},
|
||||
),
|
||||
primaryAction: Builder(
|
||||
builder: (dialogContext) {
|
||||
return ShadButton.destructive(
|
||||
onPressed: () =>
|
||||
Navigator.of(dialogContext, rootNavigator: true).pop(true),
|
||||
child: const Text('삭제'),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if (confirmed == true && permission.id != null) {
|
||||
final success = await _controller.delete(permission.id!);
|
||||
if (success && mounted) {
|
||||
_showSnack('권한을 삭제했습니다.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _restorePermission(GroupPermission permission) async {
|
||||
if (permission.id == null) return;
|
||||
final restored = await _controller.restore(permission.id!);
|
||||
if (restored != null && mounted) {
|
||||
_showSnack('권한을 복구했습니다.');
|
||||
if (result != null && mounted) {
|
||||
_showSnack(result.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -810,179 +481,84 @@ class _GroupPermissionEnabledPageState
|
||||
}
|
||||
messenger.showSnackBar(SnackBar(content: Text(message)));
|
||||
}
|
||||
|
||||
String _formatDateTime(DateTime? value) {
|
||||
if (value == null) {
|
||||
return '-';
|
||||
}
|
||||
return _dateFormat.format(value.toLocal());
|
||||
}
|
||||
}
|
||||
|
||||
class _PermissionTable extends StatelessWidget {
|
||||
const _PermissionTable({
|
||||
required this.permissions,
|
||||
required this.dateFormat,
|
||||
required this.onEdit,
|
||||
required this.onDelete,
|
||||
required this.onRestore,
|
||||
required this.onRowTap,
|
||||
});
|
||||
|
||||
final List<GroupPermission> permissions;
|
||||
final intl.DateFormat dateFormat;
|
||||
final void Function(GroupPermission permission)? onEdit;
|
||||
final void Function(GroupPermission permission)? onDelete;
|
||||
final void Function(GroupPermission permission)? onRestore;
|
||||
final void Function(GroupPermission permission)? onRowTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final header = [
|
||||
'ID',
|
||||
'그룹명',
|
||||
'메뉴명',
|
||||
'라우트 경로',
|
||||
'생성',
|
||||
'조회',
|
||||
'수정',
|
||||
'삭제',
|
||||
'사용',
|
||||
'삭제',
|
||||
'비고',
|
||||
'변경일시',
|
||||
'동작',
|
||||
].map((text) => ShadTableCell.header(child: Text(text))).toList();
|
||||
final columns = const [
|
||||
Text('ID'),
|
||||
Text('그룹명'),
|
||||
Text('메뉴명'),
|
||||
Text('라우트 경로'),
|
||||
Text('생성'),
|
||||
Text('조회'),
|
||||
Text('수정'),
|
||||
Text('삭제'),
|
||||
Text('사용'),
|
||||
Text('삭제'),
|
||||
Text('비고'),
|
||||
Text('변경일시'),
|
||||
];
|
||||
|
||||
final rows = permissions.map((permission) {
|
||||
final cells = [
|
||||
permission.id?.toString() ?? '-',
|
||||
permission.group.groupName,
|
||||
_menuDisplayLabelFromPath(
|
||||
permission.menu.path,
|
||||
permission.menu.menuName,
|
||||
),
|
||||
permission.menu.path ?? '-',
|
||||
permission.canCreate ? 'Y' : '-',
|
||||
permission.canRead ? 'Y' : '-',
|
||||
permission.canUpdate ? 'Y' : '-',
|
||||
permission.canDelete ? 'Y' : '-',
|
||||
permission.isActive ? 'Y' : 'N',
|
||||
permission.isDeleted ? 'Y' : '-',
|
||||
permission.note?.isEmpty ?? true ? '-' : permission.note!,
|
||||
permission.updatedAt == null
|
||||
? '-'
|
||||
: dateFormat.format(permission.updatedAt!.toLocal()),
|
||||
].map((text) => ShadTableCell(child: Text(text))).toList();
|
||||
|
||||
cells.add(
|
||||
ShadTableCell(
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: onEdit == null ? null : () => onEdit!(permission),
|
||||
child: const Icon(LucideIcons.pencil, size: 16),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
permission.isDeleted
|
||||
? ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: onRestore == null
|
||||
? null
|
||||
: () => onRestore!(permission),
|
||||
child: const Icon(LucideIcons.history, size: 16),
|
||||
)
|
||||
: ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: onDelete == null
|
||||
? null
|
||||
: () => onDelete!(permission),
|
||||
child: const Icon(LucideIcons.trash2, size: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return cells;
|
||||
}).toList();
|
||||
|
||||
return SizedBox(
|
||||
height: 56.0 * (permissions.length + 1),
|
||||
child: ShadTable.list(
|
||||
header: header,
|
||||
children: rows,
|
||||
columnSpanExtent: (index) {
|
||||
switch (index) {
|
||||
case 1:
|
||||
case 2:
|
||||
return const FixedTableSpanExtent(180);
|
||||
case 9:
|
||||
return const FixedTableSpanExtent(220);
|
||||
case 11:
|
||||
return const FixedTableSpanExtent(200);
|
||||
default:
|
||||
return const FixedTableSpanExtent(110);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _FormField extends StatelessWidget {
|
||||
const _FormField({required this.label, required this.child});
|
||||
|
||||
final String label;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = ShadTheme.of(context);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label, style: theme.textTheme.small),
|
||||
const SizedBox(height: 6),
|
||||
child,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _PermissionToggleRow extends StatelessWidget {
|
||||
const _PermissionToggleRow({
|
||||
required this.label,
|
||||
required this.notifier,
|
||||
required this.enabled,
|
||||
});
|
||||
|
||||
final String label;
|
||||
final ValueNotifier<bool> notifier;
|
||||
final bool enabled;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = ShadTheme.of(context);
|
||||
return ValueListenableBuilder<bool>(
|
||||
valueListenable: notifier,
|
||||
builder: (_, value, __) {
|
||||
return _FormField(
|
||||
label: label,
|
||||
child: Row(
|
||||
children: [
|
||||
ShadSwitch(
|
||||
value: value,
|
||||
onChanged: !enabled ? null : (next) => notifier.value = next,
|
||||
final rows = permissions
|
||||
.map(
|
||||
(permission) => <Widget>[
|
||||
Text(permission.id?.toString() ?? '-'),
|
||||
Text(permission.group.groupName),
|
||||
Text(
|
||||
_menuDisplayLabelFromPath(
|
||||
permission.menu.path,
|
||||
permission.menu.menuName,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(value ? '허용' : '차단', style: theme.textTheme.small),
|
||||
],
|
||||
),
|
||||
);
|
||||
),
|
||||
Text(permission.menu.path ?? '-'),
|
||||
Text(permission.canCreate ? 'Y' : '-'),
|
||||
Text(permission.canRead ? 'Y' : '-'),
|
||||
Text(permission.canUpdate ? 'Y' : '-'),
|
||||
Text(permission.canDelete ? 'Y' : '-'),
|
||||
Text(permission.isActive ? 'Y' : 'N'),
|
||||
Text(permission.isDeleted ? 'Y' : '-'),
|
||||
Text(permission.note?.isEmpty ?? true ? '-' : permission.note!),
|
||||
Text(
|
||||
permission.updatedAt == null
|
||||
? '-'
|
||||
: dateFormat.format(permission.updatedAt!.toLocal()),
|
||||
),
|
||||
],
|
||||
)
|
||||
.toList();
|
||||
|
||||
return SuperportTable(
|
||||
columns: columns,
|
||||
rows: rows,
|
||||
rowHeight: 56,
|
||||
maxHeight: 56.0 * (permissions.length + 1),
|
||||
onRowTap: onRowTap == null
|
||||
? null
|
||||
: (index) {
|
||||
if (index < 0 || index >= permissions.length) {
|
||||
return;
|
||||
}
|
||||
onRowTap!(permissions[index]);
|
||||
},
|
||||
columnSpanExtent: (index) => switch (index) {
|
||||
1 => const FixedTableSpanExtent(180),
|
||||
2 => const FixedTableSpanExtent(200),
|
||||
3 => const FixedTableSpanExtent(220),
|
||||
10 => const FixedTableSpanExtent(220),
|
||||
11 => const FixedTableSpanExtent(200),
|
||||
_ => const FixedTableSpanExtent(110),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user