feat: Flutter analyze 오류 대폭 개선 및 재고 이력 화면 UI 통일 완료
## 주요 개선사항 ### 🔧 Flutter Analyze 오류 대폭 개선 - 이전: 47개 이슈 (ERROR 14개 포함) - 현재: 22개 이슈 (ERROR 0개) - 개선율: 53% 감소, 모든 ERROR 해결 ### 🎨 재고 이력 화면 UI 통일 완료 - BaseListScreen 패턴 완전 적용 - 헤더 고정 + 바디 스크롤 구조 구현 - shadcn_ui 컴포넌트 100% 사용 - 장비 관리 화면과 동일한 표준 패턴 ### ✨ 코드 품질 개선 - unused imports 제거 (5개 파일) - unnecessary cast 제거 - unused fields 제거 - injection container 오류 해결 ### 📋 문서화 완료 - CLAUDE.md에 UI 통일성 리팩토링 계획 상세 추가 - 전체 10개 화면의 단계별 계획 문서화 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -278,26 +278,196 @@ class _WarehouseLocationListState
|
||||
);
|
||||
}
|
||||
|
||||
/// 데이터 테이블
|
||||
Widget _buildDataTable(List<WarehouseLocation> pagedLocations) {
|
||||
// 전체 데이터가 없는지 확인 (API의 total 사용)
|
||||
if (_controller.total == 0 && pagedLocations.isEmpty) {
|
||||
return StandardEmptyState(
|
||||
title:
|
||||
_controller.searchQuery.isNotEmpty
|
||||
? '검색 결과가 없습니다'
|
||||
: '등록된 입고지가 없습니다',
|
||||
icon: Icons.warehouse_outlined,
|
||||
action:
|
||||
_controller.searchQuery.isEmpty
|
||||
? StandardActionButtons.addButton(
|
||||
text: '첫 창고 추가하기',
|
||||
onPressed: _navigateToAdd,
|
||||
)
|
||||
: null,
|
||||
/// 헤더 셀 빌더
|
||||
Widget _buildHeaderCell(
|
||||
String text, {
|
||||
required int flex,
|
||||
required bool useExpanded,
|
||||
required double minWidth,
|
||||
}) {
|
||||
final child = Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
text,
|
||||
style: ShadcnTheme.bodyMedium.copyWith(fontWeight: FontWeight.w500),
|
||||
),
|
||||
);
|
||||
|
||||
if (useExpanded) {
|
||||
return Expanded(flex: flex, child: child);
|
||||
} else {
|
||||
return SizedBox(width: minWidth, child: child);
|
||||
}
|
||||
}
|
||||
|
||||
/// 데이터 셀 빌더
|
||||
Widget _buildDataCell(
|
||||
Widget child, {
|
||||
required int flex,
|
||||
required bool useExpanded,
|
||||
required double minWidth,
|
||||
}) {
|
||||
final container = Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: child,
|
||||
);
|
||||
|
||||
if (useExpanded) {
|
||||
return Expanded(flex: flex, child: container);
|
||||
} else {
|
||||
return SizedBox(width: minWidth, child: container);
|
||||
}
|
||||
}
|
||||
|
||||
/// 헤더 셀 리스트
|
||||
List<Widget> _buildHeaderCells() {
|
||||
return [
|
||||
_buildHeaderCell('번호', flex: 0, useExpanded: false, minWidth: 50),
|
||||
_buildHeaderCell('창고명', flex: 2, useExpanded: true, minWidth: 80),
|
||||
_buildHeaderCell('주소', flex: 3, useExpanded: true, minWidth: 120),
|
||||
_buildHeaderCell('담당자', flex: 2, useExpanded: true, minWidth: 80),
|
||||
_buildHeaderCell('연락처', flex: 2, useExpanded: true, minWidth: 100),
|
||||
_buildHeaderCell('수용량', flex: 1, useExpanded: true, minWidth: 70),
|
||||
_buildHeaderCell('상태', flex: 0, useExpanded: false, minWidth: 70),
|
||||
_buildHeaderCell('생성일', flex: 2, useExpanded: true, minWidth: 100),
|
||||
_buildHeaderCell('관리', flex: 0, useExpanded: false, minWidth: 80),
|
||||
];
|
||||
}
|
||||
|
||||
/// 테이블 행 빌더
|
||||
Widget _buildTableRow(WarehouseLocation location, int index) {
|
||||
final rowNumber = (_controller.currentPage - 1) * _controller.pageSize + index + 1;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: index.isEven
|
||||
? ShadcnTheme.muted.withValues(alpha: 0.1)
|
||||
: null,
|
||||
border: const Border(
|
||||
bottom: BorderSide(color: Colors.black),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
_buildDataCell(
|
||||
Text(
|
||||
rowNumber.toString(),
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 50,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
location.name,
|
||||
style: ShadcnTheme.bodyMedium.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
flex: 2,
|
||||
useExpanded: true,
|
||||
minWidth: 80,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
location.address ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
flex: 3,
|
||||
useExpanded: true,
|
||||
minWidth: 120,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
location.managerName ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
flex: 2,
|
||||
useExpanded: true,
|
||||
minWidth: 80,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
location.managerPhone ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
flex: 2,
|
||||
useExpanded: true,
|
||||
minWidth: 100,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
location.capacity?.toString() ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
flex: 1,
|
||||
useExpanded: true,
|
||||
minWidth: 70,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildStatusChip(location.isActive),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 70,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
_formatDate(location.createdAt),
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
flex: 2,
|
||||
useExpanded: true,
|
||||
minWidth: 100,
|
||||
),
|
||||
_buildDataCell(
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () => _navigateToEdit(location),
|
||||
child: const Icon(Icons.edit, size: 16),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () => _showDeleteDialog(location.id),
|
||||
child: const Icon(Icons.delete, size: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 80,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 상태 배지 빌더 (shadcn_ui 일관성)
|
||||
Widget _buildStatusChip(bool isActive) {
|
||||
if (isActive) {
|
||||
return ShadBadge.secondary(
|
||||
child: const Text('활성'),
|
||||
);
|
||||
} else {
|
||||
return ShadBadge.destructive(
|
||||
child: const Text('비활성'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 데이터 테이블
|
||||
Widget _buildDataTable(List<WarehouseLocation> pagedLocations) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
@@ -305,216 +475,45 @@ class _WarehouseLocationListState
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 테이블 헤더
|
||||
// 고정 헤더
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: ShadcnTheme.spacing4,
|
||||
vertical: 10,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.black),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text('번호', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text('창고명', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text('주소', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text('담당자', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text('연락처', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text('수용량', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text('상태', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text('생성일', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text('관리', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
],
|
||||
border: Border(bottom: BorderSide(color: Colors.black)),
|
||||
),
|
||||
child: Row(children: _buildHeaderCells()),
|
||||
),
|
||||
|
||||
// 테이블 데이터
|
||||
...pagedLocations.asMap().entries.map((entry) {
|
||||
final int index = entry.key;
|
||||
final WarehouseLocation location = entry.value;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: ShadcnTheme.spacing4,
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.black),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
// 번호
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
'${(_controller.currentPage - 1) * _controller.pageSize + index + 1}',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
// 창고명
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
location.name,
|
||||
style: ShadcnTheme.bodyMedium,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// 주소
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
location.address ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// 담당자
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
location.managerName ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// 연락처
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
location.managerPhone ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// 수용량
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
location.capacity?.toString() ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
// 상태
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: location.isActive
|
||||
? ShadcnTheme.success.withValues(alpha: 0.1)
|
||||
: ShadcnTheme.muted.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: location.isActive
|
||||
? ShadcnTheme.success.withValues(alpha: 0.3)
|
||||
: ShadcnTheme.muted.withValues(alpha: 0.3)
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
location.isActive ? '활성' : '비활성',
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: location.isActive
|
||||
? ShadcnTheme.success
|
||||
: ShadcnTheme.muted,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
// 생성일
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
_formatDate(location.createdAt),
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// 관리
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
// 스크롤 바디
|
||||
Expanded(
|
||||
child: pagedLocations.isEmpty
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
child: IconButton(
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 30,
|
||||
minHeight: 30,
|
||||
),
|
||||
padding: const EdgeInsets.all(4),
|
||||
icon: Icon(
|
||||
Icons.edit,
|
||||
size: 16,
|
||||
color: ShadcnTheme.primary,
|
||||
),
|
||||
onPressed: () => _navigateToEdit(location),
|
||||
tooltip: '수정',
|
||||
),
|
||||
Icon(
|
||||
Icons.warehouse_outlined,
|
||||
size: 64,
|
||||
color: ShadcnTheme.mutedForeground,
|
||||
),
|
||||
Flexible(
|
||||
child: IconButton(
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 30,
|
||||
minHeight: 30,
|
||||
),
|
||||
padding: const EdgeInsets.all(4),
|
||||
icon: Icon(
|
||||
Icons.delete,
|
||||
size: 16,
|
||||
color: ShadcnTheme.destructive,
|
||||
),
|
||||
onPressed: () =>
|
||||
_showDeleteDialog(location.id),
|
||||
tooltip: '삭제',
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
_controller.searchQuery.isNotEmpty
|
||||
? '검색 결과가 없습니다'
|
||||
: '등록된 창고가 없습니다',
|
||||
style: ShadcnTheme.bodyMedium.copyWith(
|
||||
color: ShadcnTheme.mutedForeground,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
itemCount: pagedLocations.length,
|
||||
itemBuilder: (context, index) => _buildTableRow(pagedLocations[index], index),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user