feat(ui): full‑width ShadTable across app; fix rent dialog width; correct equipment pagination
Some checks failed
Flutter Test & Quality Check / Test on macos-latest (push) Has been cancelled
Flutter Test & Quality Check / Test on ubuntu-latest (push) Has been cancelled
Flutter Test & Quality Check / Build APK (push) Has been cancelled

- ShadTable: ensure full-width via LayoutBuilder+ConstrainedBox minWidth
- BaseListScreen: default data area padding = 0 for table edge-to-edge
- Vendor/Model/User/Company/Inventory/Zipcode: set columnSpanExtent per column
  and add final filler column to absorb remaining width; pin date/status/actions
  widths; ensure date text is single-line
- Equipment: unify card/border style; define fixed column widths + filler;
  increase checkbox column to 56px to avoid overflow
- Rent list: migrate to ShadTable.list with fixed widths + filler column
- Rent form dialog: prevent infinite width by bounding ShadProgress with
  SizedBox and remove Expanded from option rows; add safe selectedOptionBuilder
- Admin list: fix const with non-const argument in table column extents
- Services/Controller: remove hardcoded perPage=10; use BaseListController
  perPage; trust server meta (total/totalPages) in equipment pagination
- widgets/shad_table: ConstrainedBox(minWidth=viewport) so table stretches

Run: flutter analyze → 0 errors (warnings remain).
This commit is contained in:
JiWoong Sul
2025-09-09 22:38:08 +09:00
parent 655d473413
commit 49b203d366
67 changed files with 2305 additions and 1933 deletions

View File

@@ -72,11 +72,11 @@ class EquipmentListController extends BaseListController<UnifiedEquipment> {
required PaginationParams params,
Map<String, dynamic>? additionalFilters,
}) async {
// API 호출 (페이지 크기를 명시적으로 10개로 고정)
// API 호출: BaseListController에서 넘겨준 page/perPage를 그대로 전달
final apiEquipmentDtos = await ErrorHandler.handleApiCall(
() => _equipmentService.getEquipmentsWithStatus(
page: params.page,
perPage: 10, // 🎯 장비 리스트는 항상 10개로 고정
perPage: params.perPage,
status: _statusFilter != null ?
EquipmentStatusConverter.clientToServer(_statusFilter) : null,
search: params.search,
@@ -598,4 +598,4 @@ class EquipmentListController extends BaseListController<UnifiedEquipment> {
(statusItem) => statusItem,
);
}
}
}

View File

@@ -105,7 +105,49 @@ class _EquipmentListState extends State<EquipmentList> {
final allSelected = items.isNotEmpty &&
items.every((e) => _selectedItems.contains(e.equipment.id));
// 표시 컬럼 판정 (기존 조건과 동일)
final showCompany = availableWidth > 900;
final showWarehouse = availableWidth > 1100;
final showDate = availableWidth > 800;
// 컬럼 최소 폭 추정치 (px)
// 체크박스 컬럼은 셀 기본 좌우 패딩(16+16)을 고려해 최소 50px 이상 필요
const checkboxW = 56.0;
const statusW = 80.0;
const equipNoW = 120.0;
const serialW = 160.0;
const vendorW = 160.0;
const modelBaseW = 240.0; // 남는 폭은 이 컬럼이 흡수
const companyW = 180.0;
const warehouseW = 180.0;
const dateW = 140.0;
const actionsW = 160.0; // 아이콘 3개 수용
double minTableWidth = checkboxW + statusW + equipNoW + serialW + vendorW + modelBaseW + actionsW;
if (showCompany) minTableWidth += companyW;
if (showWarehouse) minTableWidth += warehouseW;
if (showDate) minTableWidth += dateW;
final extra = (availableWidth - minTableWidth);
final double modelColumnWidth = modelBaseW; // 모델은 고정 폭, 남는 폭은 filler가 흡수
// 컬럼 폭 정의(마지막 filler가 잔여 폭 흡수)
final columnExtents = <TableSpanExtent>[
const FixedTableSpanExtent(checkboxW),
const FixedTableSpanExtent(statusW),
const FixedTableSpanExtent(equipNoW),
const FixedTableSpanExtent(serialW),
const FixedTableSpanExtent(vendorW),
const FixedTableSpanExtent(modelBaseW),
if (showCompany) const FixedTableSpanExtent(companyW),
if (showWarehouse) const FixedTableSpanExtent(warehouseW),
if (showDate) const FixedTableSpanExtent(dateW),
const FixedTableSpanExtent(actionsW),
const RemainingTableSpanExtent(),
];
return ShadTable.list(
columnSpanExtent: (index) => columnExtents[index],
header: [
// 선택
ShadTableCell.header(
@@ -128,11 +170,13 @@ class _EquipmentListState extends State<EquipmentList> {
ShadTableCell.header(child: const Text('장비번호')),
ShadTableCell.header(child: const Text('시리얼')),
ShadTableCell.header(child: const Text('제조사')),
ShadTableCell.header(child: const Text('모델')),
if (availableWidth > 900) ShadTableCell.header(child: const Text('회사')),
if (availableWidth > 1100) ShadTableCell.header(child: const Text('창고')),
if (availableWidth > 800) ShadTableCell.header(child: const Text('일자')),
ShadTableCell.header(child: const Text('관리')),
// 남는 폭을 모델 컬럼이 흡수
ShadTableCell.header(child: SizedBox(width: modelColumnWidth, child: const Text('모델'))),
if (showCompany) ShadTableCell.header(child: const Text('회사')),
if (showWarehouse) ShadTableCell.header(child: const Text('창고')),
if (showDate) ShadTableCell.header(child: const Text('일자')),
ShadTableCell.header(child: SizedBox(width: actionsW, child: const Text('관리'))),
const ShadTableCell.header(child: SizedBox.shrink()),
],
children: items.map((item) {
final id = item.equipment.id;
@@ -177,15 +221,18 @@ class _EquipmentListState extends State<EquipmentList> {
item.vendorName ?? item.equipment.manufacturer,
),
),
// 모델
// 모델 (가변 폭)
ShadTableCell(
child: _buildTextWithTooltip(
item.modelName ?? item.equipment.modelName,
item.modelName ?? item.equipment.modelName,
child: SizedBox(
width: modelColumnWidth,
child: _buildTextWithTooltip(
item.modelName ?? item.equipment.modelName,
item.modelName ?? item.equipment.modelName,
),
),
),
// 회사 (반응형)
if (availableWidth > 900)
if (showCompany)
ShadTableCell(
child: _buildTextWithTooltip(
item.companyName ?? item.currentCompany ?? '-',
@@ -193,7 +240,7 @@ class _EquipmentListState extends State<EquipmentList> {
),
),
// 창고 (반응형)
if (availableWidth > 1100)
if (showWarehouse)
ShadTableCell(
child: _buildTextWithTooltip(
item.warehouseLocation ?? '-',
@@ -201,49 +248,57 @@ class _EquipmentListState extends State<EquipmentList> {
),
),
// 일자 (반응형)
if (availableWidth > 800)
if (showDate)
ShadTableCell(
child: _buildTextWithTooltip(
_formatDate(item.date),
_formatDate(item.date),
),
),
// 관리 액션
// 관리 액션 (오버플로우 방지)
ShadTableCell(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Tooltip(
message: '이력 보기',
child: ShadButton.ghost(
size: ShadButtonSize.sm,
onPressed: () => _showEquipmentHistoryDialog(item.equipment.id ?? 0),
child: const Icon(Icons.history, size: 16),
),
child: SizedBox(
width: actionsW,
child: FittedBox(
alignment: Alignment.centerLeft,
fit: BoxFit.scaleDown,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Tooltip(
message: '이력 보기',
child: ShadButton.ghost(
size: ShadButtonSize.sm,
onPressed: () => _showEquipmentHistoryDialog(item.equipment.id ?? 0),
child: const Icon(Icons.history, size: 16),
),
),
const SizedBox(width: 4),
Tooltip(
message: '수정',
child: ShadButton.ghost(
size: ShadButtonSize.sm,
onPressed: () => _handleEdit(item),
child: const Icon(Icons.edit, size: 16),
),
),
const SizedBox(width: 4),
Tooltip(
message: '삭제',
child: ShadButton.ghost(
size: ShadButtonSize.sm,
onPressed: () => _handleDelete(item),
child: const Icon(Icons.delete_outline, size: 16),
),
),
],
),
const SizedBox(width: 4),
Tooltip(
message: '수정',
child: ShadButton.ghost(
size: ShadButtonSize.sm,
onPressed: () => _handleEdit(item),
child: const Icon(Icons.edit, size: 16),
),
),
const SizedBox(width: 4),
Tooltip(
message: '삭제',
child: ShadButton.ghost(
size: ShadButtonSize.sm,
onPressed: () => _handleDelete(item),
child: const Icon(Icons.delete_outline, size: 16),
),
),
],
),
),
),
];
}).toList(),
),
const ShadTableCell(child: SizedBox.shrink()),
];
}).toList(),
);
}
@@ -784,15 +839,16 @@ class _EquipmentListState extends State<EquipmentList> {
// 데이터 테이블
dataTable: _buildDataTable(filteredEquipments),
// 페이지네이션 - 조건 수정으로 표시 개선
pagination: controller.total > controller.pageSize ? Pagination(
// 페이지네이션 - 항상 하단 표시
pagination: Pagination(
totalCount: controller.total,
currentPage: controller.currentPage,
pageSize: controller.pageSize,
onPageChanged: (page) {
controller.goToPage(page);
},
) : null,
),
dataAreaPadding: EdgeInsets.zero,
);
},
),
@@ -811,7 +867,7 @@ class _EquipmentListState extends State<EquipmentList> {
decoration: BoxDecoration(
color: ShadcnTheme.card,
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
border: Border.all(color: Colors.black),
border: Border.all(color: ShadcnTheme.border),
),
child: TextField(
controller: _searchController,
@@ -837,7 +893,7 @@ class _EquipmentListState extends State<EquipmentList> {
text: '검색',
onPressed: _onSearch,
variant: ShadcnButtonVariant.primary,
textColor: Colors.white,
textColor: ShadcnTheme.primaryForeground,
icon: const Icon(Icons.search, size: 16),
),
),
@@ -963,7 +1019,7 @@ class _EquipmentListState extends State<EquipmentList> {
}
},
variant: ShadcnButtonVariant.primary,
textColor: Colors.white,
textColor: ShadcnTheme.primaryForeground,
icon: const Icon(Icons.add, size: 16),
),
],
@@ -1052,14 +1108,14 @@ class _EquipmentListState extends State<EquipmentList> {
}
},
variant: ShadcnButtonVariant.primary,
textColor: Colors.white,
textColor: ShadcnTheme.primaryForeground,
icon: const Icon(Icons.add, size: 16),
),
ShadcnButton(
text: '출고',
onPressed: selectedInCount > 0 ? _handleOutEquipment : null,
variant: selectedInCount > 0 ? ShadcnButtonVariant.primary : ShadcnButtonVariant.secondary,
textColor: selectedInCount > 0 ? Colors.white : null,
textColor: selectedInCount > 0 ? ShadcnTheme.primaryForeground : null,
icon: const Icon(Icons.local_shipping, size: 16),
),
ShadcnButton(
@@ -1156,31 +1212,19 @@ class _EquipmentListState extends State<EquipmentList> {
}
return Container(
width: double.infinity,
decoration: BoxDecoration(
border: Border.all(color: Colors.black),
border: Border.all(color: ShadcnTheme.border),
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
),
child: LayoutBuilder(
builder: (context, constraints) {
final availableWidth = constraints.maxWidth;
final minimumWidth = _getMinimumTableWidth(pagedEquipments, availableWidth);
final needsHorizontalScroll = minimumWidth > availableWidth;
// ShadTable 경로로 일괄 전환 (가로 스크롤은 ShadTable 외부에서 처리)
if (needsHorizontalScroll) {
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
controller: _horizontalScrollController,
child: SizedBox(
width: minimumWidth,
child: _buildShadTable(pagedEquipments, availableWidth: availableWidth),
),
);
} else {
child: Padding(
padding: const EdgeInsets.all(12.0),
child: LayoutBuilder(
builder: (context, constraints) {
final availableWidth = constraints.maxWidth;
// 수평 스크롤 배제: 가용 너비 기준으로 컬럼 가감 처리 (내부에서 반응형 처리)
return _buildShadTable(pagedEquipments, availableWidth: availableWidth);
}
},
},
),
),
);
}

View File

@@ -732,7 +732,7 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
// 회사 이름을 표시하는 위젯 (지점 포함)
Widget _buildCompanyDropdownItem(String item, EquipmentOutFormController controller) {
final TextStyle defaultStyle = TextStyle(
color: Colors.black87,
color: ShadcnTheme.foreground,
fontSize: 14,
fontWeight: FontWeight.normal,
);
@@ -758,7 +758,7 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
child: Icon(
Icons.subdirectory_arrow_right,
size: 16,
color: Colors.grey,
color: ShadcnTheme.mutedForeground,
),
alignment: PlaceholderAlignment.middle,
),
@@ -770,8 +770,8 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
TextSpan(text: ' ', style: defaultStyle),
TextSpan(
text: branchName, // 지점명
style: const TextStyle(
color: Colors.indigo,
style: TextStyle(
color: ShadcnTheme.primary,
fontWeight: FontWeight.w500,
fontSize: 14,
),
@@ -789,7 +789,7 @@ class _EquipmentOutFormScreenState extends State<EquipmentOutFormScreen> {
style: defaultStyle, // 기본 스타일 설정
children: [
WidgetSpan(
child: Icon(Icons.business, size: 16, color: Colors.black54),
child: Icon(Icons.business, size: 16, color: ShadcnTheme.mutedForeground),
alignment: PlaceholderAlignment.middle,
),
TextSpan(text: ' ', style: defaultStyle),

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:superport/screens/common/theme_shadcn.dart';
/// 자동완성 텍스트 필드 위젯
///
@@ -136,16 +137,10 @@ class _AutocompleteTextFieldState extends State<AutocompleteTextField> {
right: 0,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.grey.shade300),
color: ShadcnTheme.card,
border: Border.all(color: ShadcnTheme.border),
borderRadius: BorderRadius.circular(4),
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.3),
blurRadius: 4,
offset: const Offset(0, 2),
),
],
boxShadow: ShadcnTheme.shadowSm,
),
constraints: const BoxConstraints(maxHeight: 200),
child: ListView.builder(

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:superport/screens/common/theme_shadcn.dart';
/// 드롭다운 기능이 있는 재사용 가능한 TextFormField 위젯
class CustomDropdownField extends StatefulWidget {
@@ -59,21 +60,14 @@ class _CustomDropdownFieldState extends State<CustomDropdownField> {
showWhenUnlinked: false,
offset: const Offset(0, 45),
child: Material(
elevation: 4,
elevation: 0,
borderRadius: BorderRadius.circular(4),
child: Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.grey.shade300),
color: ShadcnTheme.card,
border: Border.all(color: ShadcnTheme.border),
borderRadius: BorderRadius.circular(4),
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.3),
spreadRadius: 1,
blurRadius: 3,
offset: const Offset(0, 1),
),
],
boxShadow: ShadcnTheme.shadowSm,
),
constraints: const BoxConstraints(maxHeight: 200),
child: SingleChildScrollView(
@@ -175,4 +169,4 @@ class _CustomDropdownFieldState extends State<CustomDropdownField> {
],
);
}
}
}

View File

@@ -6,6 +6,7 @@ import 'package:superport/data/models/equipment_history_dto.dart';
import 'package:superport/services/equipment_service.dart';
import 'package:superport/core/errors/failures.dart';
import 'package:intl/intl.dart';
import 'package:superport/screens/common/theme_shadcn.dart';
/// 장비 이력을 표시하는 팝업 다이얼로그
class EquipmentHistoryDialog extends StatefulWidget {
@@ -190,17 +191,17 @@ class _EquipmentHistoryDialogState extends State<EquipmentHistoryDialog> {
Color _getTransactionTypeColor(String? type) {
switch (type) {
case 'I':
return Colors.green;
return ShadcnTheme.equipmentIn;
case 'O':
return Colors.blue;
return ShadcnTheme.equipmentOut;
case 'R':
return Colors.orange;
return ShadcnTheme.equipmentRepair;
case 'T':
return Colors.teal;
return ShadcnTheme.equipmentRent;
case 'D':
return Colors.red;
return ShadcnTheme.destructive;
default:
return Colors.grey;
return ShadcnTheme.secondary;
}
}
@@ -211,16 +212,10 @@ class _EquipmentHistoryDialogState extends State<EquipmentHistoryDialog> {
return Container(
margin: const EdgeInsets.only(bottom: 8),
decoration: BoxDecoration(
color: Colors.white,
color: ShadcnTheme.card,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.grey.shade200),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.02),
blurRadius: 4,
offset: const Offset(0, 2),
),
],
border: Border.all(color: ShadcnTheme.border),
boxShadow: ShadcnTheme.shadowSm,
),
child: Material(
color: Colors.transparent,
@@ -359,15 +354,9 @@ class _EquipmentHistoryDialogState extends State<EquipmentHistoryDialog> {
minHeight: 400,
),
decoration: BoxDecoration(
color: Colors.grey.shade50,
color: ShadcnTheme.background,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.15),
blurRadius: 20,
offset: const Offset(0, 10),
),
],
boxShadow: ShadcnTheme.shadowLg,
),
child: Column(
children: [
@@ -375,13 +364,13 @@ class _EquipmentHistoryDialogState extends State<EquipmentHistoryDialog> {
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
color: ShadcnTheme.card,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(12),
topRight: Radius.circular(12),
),
border: Border(
bottom: BorderSide(color: Colors.grey.shade200),
bottom: BorderSide(color: ShadcnTheme.border),
),
),
child: Row(
@@ -580,13 +569,13 @@ class _EquipmentHistoryDialogState extends State<EquipmentHistoryDialog> {
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.white,
color: ShadcnTheme.card,
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(12),
bottomRight: Radius.circular(12),
),
border: Border(
top: BorderSide(color: Colors.grey.shade200),
top: BorderSide(color: ShadcnTheme.border),
),
),
child: Row(
@@ -628,4 +617,4 @@ class _EquipmentHistoryDialogState extends State<EquipmentHistoryDialog> {
),
);
}
}
}

View File

@@ -147,7 +147,7 @@ class _EquipmentRestoreDialogState extends State<EquipmentRestoreDialog> {
height: 16,
child: CircularProgressIndicator(
strokeWidth: 2,
color: Colors.white,
color: ShadcnTheme.primaryForeground,
),
),
const SizedBox(width: 8),
@@ -207,4 +207,4 @@ Future<bool?> showEquipmentRestoreDialog(
onRestored: onRestored,
),
);
}
}

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:superport/utils/constants.dart';
import 'package:superport/core/services/lookups_service.dart';
import 'package:superport/screens/common/theme_shadcn.dart';
// 장비 상태에 따라 칩(Chip) 위젯을 반환하는 함수형 위젯
class EquipmentStatusChip extends StatelessWidget {
@@ -13,7 +14,7 @@ class EquipmentStatusChip extends StatelessWidget {
Widget build(BuildContext context) {
// 캐시된 상태 정보 조회 시도
String statusText = status;
Color backgroundColor = Colors.grey;
Color backgroundColor = ShadcnTheme.secondary;
try {
final lookupsService = GetIt.instance<LookupsService>();
@@ -37,46 +38,46 @@ class EquipmentStatusChip extends StatelessWidget {
switch (status) {
case EquipmentStatus.in_:
case 'in':
backgroundColor = Colors.green;
backgroundColor = ShadcnTheme.equipmentIn;
if (statusText == status) statusText = '입고';
break;
case EquipmentStatus.out:
case 'out':
backgroundColor = Colors.orange;
backgroundColor = ShadcnTheme.equipmentOut;
if (statusText == status) statusText = '출고';
break;
case EquipmentStatus.rent:
case 'rent':
backgroundColor = Colors.blue;
backgroundColor = ShadcnTheme.equipmentRent;
if (statusText == status) statusText = '대여';
break;
case EquipmentStatus.repair:
case 'repair':
backgroundColor = Colors.blue;
backgroundColor = ShadcnTheme.equipmentRepair;
if (statusText == status) statusText = '수리중';
break;
case EquipmentStatus.damaged:
case 'damaged':
backgroundColor = Colors.red;
backgroundColor = ShadcnTheme.error;
if (statusText == status) statusText = '손상';
break;
case EquipmentStatus.lost:
case 'lost':
backgroundColor = Colors.purple;
backgroundColor = ShadcnTheme.purple;
if (statusText == status) statusText = '분실';
break;
case EquipmentStatus.disposed:
case 'disposed':
backgroundColor = Colors.black;
backgroundColor = ShadcnTheme.equipmentDisposal;
if (statusText == status) statusText = '폐기';
break;
case EquipmentStatus.etc:
case 'etc':
backgroundColor = Colors.grey;
backgroundColor = ShadcnTheme.secondary;
if (statusText == status) statusText = '기타';
break;
default:
backgroundColor = Colors.grey;
backgroundColor = ShadcnTheme.equipmentUnknown;
if (statusText == status) statusText = '알 수 없음';
}
@@ -84,11 +85,15 @@ class EquipmentStatusChip extends StatelessWidget {
return Chip(
label: Text(
statusText,
style: const TextStyle(color: Colors.white, fontSize: 12),
style: ShadcnTheme.labelSmall.copyWith(color: ShadcnTheme.primaryForeground),
),
backgroundColor: backgroundColor,
visualDensity: VisualDensity.compact,
padding: const EdgeInsets.symmetric(horizontal: 5),
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(ShadcnTheme.radiusFull),
side: BorderSide(color: backgroundColor.withValues(alpha: 0.2)),
),
);
}
}

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:superport/screens/common/theme_shadcn.dart';
// 장비 요약 정보 행 위젯 (SRP, 재사용성)
class EquipmentSummaryRow extends StatelessWidget {
@@ -30,7 +31,9 @@ class EquipmentSummaryRow extends StatelessWidget {
value,
style: TextStyle(
fontSize: 15,
color: value == '정보 없음' ? Colors.grey.shade600 : Colors.black,
color: value == '정보 없음'
? ShadcnTheme.mutedForeground
: ShadcnTheme.foreground,
),
),
),