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

@@ -338,79 +338,137 @@ class _CompanyListState extends State<CompanyList> {
),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: ShadTable.list(
header: const [
ShadTableCell.header(child: Text('번호')),
ShadTableCell.header(child: Text('회사명')),
ShadTableCell.header(child: Text('구분')),
ShadTableCell.header(child: Text('주소')),
ShadTableCell.header(child: Text('담당자')),
ShadTableCell.header(child: Text('연락처')),
ShadTableCell.header(child: Text('파트너/고객')),
ShadTableCell.header(child: Text('상태')),
ShadTableCell.header(child: Text('등록/수정일')),
ShadTableCell.header(child: Text('비고')),
ShadTableCell.header(child: Text('관리')),
],
children: [
for (int index = 0; index < items.length; index++)
[
// 번호
ShadTableCell(child: Text(((((controller.currentPage - 1) * controller.pageSize) + index + 1)).toString(), style: ShadcnTheme.bodySmall)),
// 회사명 (본사>지점 표기 유지)
ShadTableCell(child: _buildDisplayNameText(items[index])),
// 구분 (본사/지점)
ShadTableCell(child: _buildCompanyTypeLabel(items[index].isBranch)),
// 주소
ShadTableCell(child: Text(items[index].address.isNotEmpty ? items[index].address : '-', overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodySmall)),
// 담당자 요약
ShadTableCell(child: _buildContactInfo(items[index])),
// 연락처 상세
ShadTableCell(child: _buildContactDetails(items[index])),
// 파트너/고객 플래그
ShadTableCell(child: _buildPartnerCustomerFlags(items[index])),
// 상태
ShadTableCell(child: _buildStatusBadge(items[index].isActive)),
// 등록/수정일
ShadTableCell(child: _buildDateInfo(items[index])),
// 비고
ShadTableCell(child: Text(items[index].remark ?? '-', overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodySmall)),
// 관리(편집/삭제)
ShadTableCell(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (items[index].id != null) ...[
ShadButton.ghost(
size: ShadButtonSize.sm,
onPressed: () async {
// 기존 편집 흐름 유지
final args = {'companyId': items[index].id};
final result = await Navigator.pushNamed(context, '/company/edit', arguments: args);
if (result == true) {
controller.refresh();
}
},
child: const Icon(Icons.edit, size: 16),
child: LayoutBuilder(
builder: (context, constraints) {
// 최소폭 추정 (다컬럼): 번호(64)+회사명(240)+구분(120)+주소(320)+담당자(200)+연락처(220)+파트너/고객(160)+상태(120)+등록/수정일(200)+비고(220)+관리(160)+여백(24)
const double actionsW = 160.0;
const double minTableWidth = 64 + 240 + 120 + 320 + 200 + 220 + 160 + 120 + 200 + 220 + actionsW + 24;
final double tableWidth = constraints.maxWidth >= minTableWidth
? constraints.maxWidth
: minTableWidth;
const double addressColumnWidth = 320.0; // 고정, 남는 폭은 filler가 흡수
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: SizedBox(
width: tableWidth,
child: ShadTable.list(
columnSpanExtent: (index) {
switch (index) {
case 0:
return const FixedTableSpanExtent(64);
case 1:
return const FixedTableSpanExtent(240);
case 2:
return const FixedTableSpanExtent(120);
case 3:
return const FixedTableSpanExtent(addressColumnWidth);
case 4:
return const FixedTableSpanExtent(200);
case 5:
return const FixedTableSpanExtent(220);
case 6:
return const FixedTableSpanExtent(160);
case 7:
return const FixedTableSpanExtent(120);
case 8:
return const FixedTableSpanExtent(200);
case 9:
return const FixedTableSpanExtent(220);
case 10:
return const FixedTableSpanExtent(actionsW);
case 11:
return const RemainingTableSpanExtent();
default:
return const FixedTableSpanExtent(100);
}
},
header: [
const ShadTableCell.header(child: Text('번호')),
const ShadTableCell.header(child: Text('회사명')),
const ShadTableCell.header(child: Text('구분')),
ShadTableCell.header(child: SizedBox(width: addressColumnWidth, child: const Text('주소'))),
const ShadTableCell.header(child: Text('담당자')),
const ShadTableCell.header(child: Text('연락처')),
const ShadTableCell.header(child: Text('파트너/고객')),
const ShadTableCell.header(child: Text('상태')),
const ShadTableCell.header(child: Text('등록/수정일')),
const ShadTableCell.header(child: Text('비고')),
ShadTableCell.header(child: SizedBox(width: actionsW, child: const Text('관리'))),
const ShadTableCell.header(child: SizedBox.shrink()),
],
children: [
for (int index = 0; index < items.length; index++)
[
// 번호
ShadTableCell(child: Text(((((controller.currentPage - 1) * controller.pageSize) + index + 1)).toString(), style: ShadcnTheme.bodySmall)),
// 회사명 (본사>지점 표기 유지)
ShadTableCell(child: _buildDisplayNameText(items[index])),
// 구분 (본사/지점)
ShadTableCell(child: _buildCompanyTypeLabel(items[index].isBranch)),
// 주소 (가변 폭)
ShadTableCell(
child: SizedBox(
width: addressColumnWidth,
child: Text(items[index].address.isNotEmpty ? items[index].address : '-', overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodySmall),
),
),
const SizedBox(width: 4),
ShadButton.ghost(
size: ShadButtonSize.sm,
onPressed: () {
if (items[index].isBranch) {
_deleteBranch(items[index].parentCompanyId!, items[index].id!);
} else {
_deleteCompany(items[index].id!);
}
},
child: const Icon(Icons.delete, size: 16),
// 담당자 요약
ShadTableCell(child: _buildContactInfo(items[index])),
// 연락처 상세
ShadTableCell(child: _buildContactDetails(items[index])),
// 파트너/고객 플래그
ShadTableCell(child: _buildPartnerCustomerFlags(items[index])),
// 상태
ShadTableCell(child: _buildStatusBadge(items[index].isActive)),
// 등록/수정일
ShadTableCell(child: _buildDateInfo(items[index])),
// 비고
ShadTableCell(child: Text(items[index].remark ?? '-', overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodySmall)),
// 관리(편집/삭제)
ShadTableCell(
child: SizedBox(
width: actionsW,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (items[index].id != null) ...[
ShadButton.ghost(
size: ShadButtonSize.sm,
onPressed: () async {
// 기존 편집 흐름 유지
final args = {'companyId': items[index].id};
final result = await Navigator.pushNamed(context, '/company/edit', arguments: args);
if (result == true) {
controller.refresh();
}
},
child: const Icon(Icons.edit, size: 16),
),
const SizedBox(width: 4),
ShadButton.ghost(
size: ShadButtonSize.sm,
onPressed: () {
if (items[index].isBranch) {
_deleteBranch(items[index].parentCompanyId!, items[index].id!);
} else {
_deleteCompany(items[index].id!);
}
},
child: const Icon(Icons.delete, size: 16),
),
],
],
),
),
),
const ShadTableCell(child: SizedBox.shrink()),
],
],
),
],
),
],
],
),
);
},
),
),
);
@@ -602,6 +660,7 @@ class _CompanyListState extends State<CompanyList> {
controller.goToPage(page);
},
),
dataAreaPadding: EdgeInsets.zero,
);
},
),