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:
@@ -313,191 +313,259 @@ class _CompanyListState extends State<CompanyList> {
|
||||
}
|
||||
}
|
||||
|
||||
/// ShadTable을 사용한 회사 데이터 테이블 빌드
|
||||
Widget _buildCompanyShadTable(List<CompanyItem> items, CompanyListController controller) {
|
||||
final theme = ShadTheme.of(context);
|
||||
/// 헤더 셀 빌더
|
||||
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: 3, useExpanded: true, minWidth: 120),
|
||||
_buildHeaderCell('구분', flex: 0, useExpanded: false, minWidth: 60),
|
||||
_buildHeaderCell('주소', flex: 2, useExpanded: true, minWidth: 100),
|
||||
_buildHeaderCell('담당자', flex: 2, useExpanded: true, minWidth: 80),
|
||||
_buildHeaderCell('연락처', flex: 2, useExpanded: true, minWidth: 100),
|
||||
_buildHeaderCell('파트너/고객', flex: 1, useExpanded: true, minWidth: 80),
|
||||
_buildHeaderCell('상태', flex: 0, useExpanded: false, minWidth: 60),
|
||||
_buildHeaderCell('등록/수정일', flex: 2, useExpanded: true, minWidth: 100),
|
||||
_buildHeaderCell('비고', flex: 1, useExpanded: true, minWidth: 80),
|
||||
_buildHeaderCell('관리', flex: 0, useExpanded: false, minWidth: 80),
|
||||
];
|
||||
}
|
||||
|
||||
/// 테이블 행 빌더
|
||||
Widget _buildTableRow(CompanyItem item, int index, CompanyListController controller) {
|
||||
final rowNumber = ((controller.currentPage - 1) * controller.pageSize) + index + 1;
|
||||
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 1200, // 최소 너비 설정
|
||||
maxWidth: 2000, // 최대 너비 설정
|
||||
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: ShadTable(
|
||||
columnCount: 11,
|
||||
rowCount: items.length + 1, // +1 for header
|
||||
header: (context, column) {
|
||||
final headers = [
|
||||
'번호', '회사명', '구분', '주소', '담당자',
|
||||
'연락처', '파트너/고객', '상태', '등록/수정일', '비고', '관리'
|
||||
];
|
||||
return ShadTableCell(
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: 50, // 헤더 높이
|
||||
maxHeight: 50,
|
||||
),
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
child: Text(
|
||||
headers[column],
|
||||
style: theme.textTheme.muted.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
builder: (context, vicinity) {
|
||||
final column = vicinity.column;
|
||||
final row = vicinity.row - 1; // -1 because header is row 0
|
||||
|
||||
if (row < 0 || row >= items.length) {
|
||||
return const ShadTableCell(child: SizedBox.shrink());
|
||||
}
|
||||
|
||||
final item = items[row];
|
||||
final index = ((controller.currentPage - 1) * controller.pageSize) + row;
|
||||
|
||||
// 모든 셀에 최소 높이 설정
|
||||
Widget wrapWithHeight(Widget child) {
|
||||
return Container(
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: 60, // 최소 높이 60px
|
||||
maxHeight: 80, // 최대 높이 80px
|
||||
),
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
|
||||
switch (column) {
|
||||
case 0: // 번호
|
||||
return ShadTableCell(
|
||||
child: wrapWithHeight(
|
||||
Text('${index + 1}', style: theme.textTheme.small)
|
||||
)
|
||||
);
|
||||
case 1: // 회사명
|
||||
return ShadTableCell(
|
||||
child: wrapWithHeight(_buildDisplayNameText(item))
|
||||
);
|
||||
case 2: // 구분
|
||||
return ShadTableCell(
|
||||
child: wrapWithHeight(_buildCompanyTypeLabel(item.isBranch))
|
||||
);
|
||||
case 3: // 주소
|
||||
return ShadTableCell(
|
||||
child: wrapWithHeight(
|
||||
Text(
|
||||
item.address.isNotEmpty ? item.address : '-',
|
||||
style: theme.textTheme.small,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 2,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
_buildDataCell(
|
||||
Text(
|
||||
rowNumber.toString(),
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 50,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildDisplayNameText(item),
|
||||
flex: 3,
|
||||
useExpanded: true,
|
||||
minWidth: 120,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildCompanyTypeLabel(item.isBranch),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 60,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
item.address.isNotEmpty ? item.address : '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 2,
|
||||
),
|
||||
flex: 2,
|
||||
useExpanded: true,
|
||||
minWidth: 100,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildContactInfo(item),
|
||||
flex: 2,
|
||||
useExpanded: true,
|
||||
minWidth: 80,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildContactDetails(item),
|
||||
flex: 2,
|
||||
useExpanded: true,
|
||||
minWidth: 100,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildPartnerCustomerFlags(item),
|
||||
flex: 1,
|
||||
useExpanded: true,
|
||||
minWidth: 80,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildStatusBadge(item.isActive),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 60,
|
||||
),
|
||||
_buildDataCell(
|
||||
_buildDateInfo(item),
|
||||
flex: 2,
|
||||
useExpanded: true,
|
||||
minWidth: 100,
|
||||
),
|
||||
_buildDataCell(
|
||||
Text(
|
||||
item.remark ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 2,
|
||||
),
|
||||
flex: 1,
|
||||
useExpanded: true,
|
||||
minWidth: 80,
|
||||
),
|
||||
_buildDataCell(
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (item.id != null) ...[
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () {
|
||||
if (item.isBranch) {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
'/company/branch/edit',
|
||||
arguments: {
|
||||
'companyId': item.parentCompanyId,
|
||||
'branchId': item.id,
|
||||
'parentCompanyName': item.parentCompanyName,
|
||||
},
|
||||
).then((result) {
|
||||
if (result == true) controller.refresh();
|
||||
});
|
||||
} else {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
'/company/edit',
|
||||
arguments: {
|
||||
'companyId': item.id,
|
||||
'isBranch': false,
|
||||
},
|
||||
).then((result) {
|
||||
if (result == true) controller.refresh();
|
||||
});
|
||||
}
|
||||
},
|
||||
child: const Icon(Icons.edit, size: 16),
|
||||
),
|
||||
),
|
||||
);
|
||||
case 4: // 담당자
|
||||
return ShadTableCell(
|
||||
child: wrapWithHeight(_buildContactInfo(item))
|
||||
);
|
||||
case 5: // 연락처
|
||||
return ShadTableCell(
|
||||
child: wrapWithHeight(_buildContactDetails(item))
|
||||
);
|
||||
case 6: // 파트너/고객
|
||||
return ShadTableCell(
|
||||
child: wrapWithHeight(_buildPartnerCustomerFlags(item))
|
||||
);
|
||||
case 7: // 상태
|
||||
return ShadTableCell(
|
||||
child: wrapWithHeight(_buildStatusBadge(item.isActive))
|
||||
);
|
||||
case 8: // 등록/수정일
|
||||
return ShadTableCell(
|
||||
child: wrapWithHeight(_buildDateInfo(item))
|
||||
);
|
||||
case 9: // 비고
|
||||
return ShadTableCell(
|
||||
child: wrapWithHeight(
|
||||
Text(
|
||||
item.remark ?? '-',
|
||||
style: theme.textTheme.small,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 2,
|
||||
const SizedBox(width: 4),
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () {
|
||||
if (item.isBranch) {
|
||||
_deleteBranch(item.parentCompanyId!, item.id!);
|
||||
} else {
|
||||
_deleteCompany(item.id!);
|
||||
}
|
||||
},
|
||||
child: const Icon(Icons.delete, size: 16),
|
||||
),
|
||||
),
|
||||
);
|
||||
case 10: // 관리
|
||||
return ShadTableCell(
|
||||
child: wrapWithHeight(
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
],
|
||||
],
|
||||
),
|
||||
flex: 0,
|
||||
useExpanded: false,
|
||||
minWidth: 80,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 헤더 고정 패턴 회사 테이블 빌더
|
||||
Widget _buildCompanyShadTable(List<CompanyItem> items, CompanyListController controller) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// 고정 헤더
|
||||
Container(
|
||||
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: _buildHeaderCells()),
|
||||
),
|
||||
// 스크롤 바디
|
||||
Expanded(
|
||||
child: items.isEmpty
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (item.id != null) ...[
|
||||
InkWell(
|
||||
onTap: () {
|
||||
if (item.isBranch) {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
'/company/branch/edit',
|
||||
arguments: {
|
||||
'companyId': item.parentCompanyId,
|
||||
'branchId': item.id,
|
||||
'parentCompanyName': item.parentCompanyName,
|
||||
},
|
||||
).then((result) {
|
||||
if (result == true) controller.refresh();
|
||||
});
|
||||
} else {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
'/company/edit',
|
||||
arguments: {
|
||||
'companyId': item.id,
|
||||
'isBranch': false,
|
||||
},
|
||||
).then((result) {
|
||||
if (result == true) controller.refresh();
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
alignment: Alignment.center,
|
||||
child: const Icon(Icons.edit, size: 16),
|
||||
),
|
||||
Icon(
|
||||
Icons.business_outlined,
|
||||
size: 64,
|
||||
color: ShadcnTheme.mutedForeground,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'등록된 회사가 없습니다',
|
||||
style: ShadcnTheme.bodyMedium.copyWith(
|
||||
color: ShadcnTheme.mutedForeground,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
if (item.isBranch) {
|
||||
_deleteBranch(item.parentCompanyId!, item.id!);
|
||||
} else {
|
||||
_deleteCompany(item.id!);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
alignment: Alignment.center,
|
||||
child: const Icon(Icons.delete, size: 16),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
itemCount: items.length,
|
||||
itemBuilder: (context, index) => _buildTableRow(items[index], index, controller),
|
||||
),
|
||||
),
|
||||
);
|
||||
default:
|
||||
return const ShadTableCell(child: SizedBox.shrink());
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user