feat(ui): full‑width ShadTable across app; fix rent dialog width; correct equipment pagination
- 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:
@@ -376,7 +376,7 @@ class _BranchFormScreenState extends State<BranchFormScreen> {
|
||||
onPressed: controller.isSaving ? null : _saveBranch,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: ShadcnTheme.primary,
|
||||
foregroundColor: Colors.white,
|
||||
foregroundColor: ShadcnTheme.primaryForeground,
|
||||
minimumSize: const Size.fromHeight(48),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@@ -387,7 +387,7 @@ class _BranchFormScreenState extends State<BranchFormScreen> {
|
||||
height: 20,
|
||||
width: 20,
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
|
||||
valueColor: AlwaysStoppedAnimation<Color>(ShadcnTheme.primaryForeground),
|
||||
strokeWidth: 2,
|
||||
),
|
||||
)
|
||||
@@ -411,4 +411,4 @@ class _BranchFormScreenState extends State<BranchFormScreen> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -347,7 +347,7 @@ class _CompanyBranchDialogState extends State<CompanyBranchDialog> {
|
||||
label: const Text('지점 추가'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: ShadcnTheme.primary,
|
||||
foregroundColor: Colors.white,
|
||||
foregroundColor: ShadcnTheme.primaryForeground,
|
||||
minimumSize: const Size(100, 36),
|
||||
),
|
||||
),
|
||||
@@ -468,4 +468,4 @@ class _CompanyBranchDialogState extends State<CompanyBranchDialog> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,16 +75,11 @@ class CompanyNameAutocomplete extends StatelessWidget {
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).cardColor,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(color: Colors.grey.shade300),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withAlpha(77),
|
||||
spreadRadius: 1,
|
||||
blurRadius: 3,
|
||||
offset: const Offset(0, 1),
|
||||
),
|
||||
border: Border.all(color: Theme.of(context).dividerColor),
|
||||
boxShadow: const [
|
||||
BoxShadow(color: Colors.transparent),
|
||||
],
|
||||
),
|
||||
child:
|
||||
@@ -98,10 +93,7 @@ class CompanyNameAutocomplete extends StatelessWidget {
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: filteredCompanyNames.length,
|
||||
separatorBuilder:
|
||||
(context, index) => Divider(
|
||||
height: 1,
|
||||
color: Colors.grey.shade200,
|
||||
),
|
||||
(context, index) => Divider(height: 1, color: Theme.of(context).dividerColor),
|
||||
itemBuilder: (context, index) {
|
||||
final companyName = filteredCompanyNames[index];
|
||||
final text = nameController.text.toLowerCase();
|
||||
@@ -138,8 +130,8 @@ class CompanyNameAutocomplete extends StatelessWidget {
|
||||
0,
|
||||
matchIndex,
|
||||
),
|
||||
style: const TextStyle(
|
||||
color: Colors.black,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
),
|
||||
// 일치하는 부분
|
||||
@@ -161,10 +153,9 @@ class CompanyNameAutocomplete extends StatelessWidget {
|
||||
matchIndex + text.length,
|
||||
),
|
||||
style: TextStyle(
|
||||
color:
|
||||
matchIndex == 0
|
||||
? Colors.grey[600]
|
||||
: Colors.black,
|
||||
color: matchIndex == 0
|
||||
? Theme.of(context).textTheme.bodySmall?.color?.withOpacity(0.7)
|
||||
: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -146,7 +146,7 @@ class _CompanyRestoreDialogState extends State<CompanyRestoreDialog> {
|
||||
height: 16,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: Colors.white,
|
||||
color: ShadcnTheme.primaryForeground,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
@@ -206,4 +206,4 @@ Future<bool?> showCompanyRestoreDialog(
|
||||
onRestored: onRestored,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user