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:
@@ -39,173 +39,134 @@ class ZipcodeTable extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: ShadCard(
|
||||
child: SingleChildScrollView(
|
||||
child: DataTable(
|
||||
horizontalMargin: 16,
|
||||
columnSpacing: 24,
|
||||
columns: const [
|
||||
DataColumn(
|
||||
label: Text(
|
||||
'우편번호',
|
||||
style: TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
'시도',
|
||||
style: TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
'구/군',
|
||||
style: TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
'상세주소',
|
||||
style: TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
'작업',
|
||||
style: TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
],
|
||||
rows: zipcodes.map((zipcode) {
|
||||
return DataRow(
|
||||
cells: [
|
||||
// 우편번호
|
||||
DataCell(
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primary.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
zipcode.zipcode.toString().padLeft(5, '0'),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: theme.colorScheme.primary,
|
||||
fontFamily: 'monospace',
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
ShadButton.ghost(
|
||||
onPressed: () => _copyToClipboard(
|
||||
context,
|
||||
zipcode.zipcode.toString().padLeft(5, '0'),
|
||||
'우편번호'
|
||||
),
|
||||
size: ShadButtonSize.sm,
|
||||
child: Icon(
|
||||
Icons.copy,
|
||||
size: 14,
|
||||
color: theme.colorScheme.mutedForeground,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
// 고정폭 + 마지막 filler
|
||||
const double minW = 160 + 180 + 180 + 320 + 140 + 24;
|
||||
final double tableW = constraints.maxWidth >= minW ? constraints.maxWidth : minW;
|
||||
const double etcW = 320.0;
|
||||
|
||||
// 시도
|
||||
DataCell(
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_city,
|
||||
size: 16,
|
||||
color: theme.colorScheme.mutedForeground,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Flexible(
|
||||
child: Text(
|
||||
zipcode.sido,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// 구/군
|
||||
DataCell(
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on,
|
||||
size: 16,
|
||||
color: theme.colorScheme.mutedForeground,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Flexible(
|
||||
child: Text(
|
||||
zipcode.gu,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// 상세주소
|
||||
DataCell(
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 300),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
zipcode.etc,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.foreground,
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: SizedBox(
|
||||
width: tableW,
|
||||
child: ShadTable.list(
|
||||
columnSpanExtent: (index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return const FixedTableSpanExtent(160); // 우편번호
|
||||
case 1:
|
||||
return const FixedTableSpanExtent(180); // 시도
|
||||
case 2:
|
||||
return const FixedTableSpanExtent(180); // 구/군
|
||||
case 3:
|
||||
return const FixedTableSpanExtent(etcW); // 상세주소
|
||||
case 4:
|
||||
return const FixedTableSpanExtent(140); // 작업
|
||||
case 5:
|
||||
return const RemainingTableSpanExtent(); // filler
|
||||
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: etcW, child: const Text('상세주소'))),
|
||||
const ShadTableCell.header(child: Text('작업')),
|
||||
const ShadTableCell.header(child: SizedBox.shrink()),
|
||||
],
|
||||
children: zipcodes.map((zipcode) {
|
||||
return [
|
||||
// 우편번호 (오버플로우 방지)
|
||||
ShadTableCell(
|
||||
child: SizedBox(
|
||||
width: 160,
|
||||
child: FittedBox(
|
||||
alignment: Alignment.centerLeft,
|
||||
fit: BoxFit.scaleDown,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primary.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
zipcode.zipcode.toString().padLeft(5, '0'),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: theme.colorScheme.primary,
|
||||
fontFamily: 'monospace',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
ShadButton.ghost(
|
||||
onPressed: () => _copyToClipboard(
|
||||
context,
|
||||
zipcode.fullAddress,
|
||||
'전체주소'
|
||||
const SizedBox(width: 8),
|
||||
ShadButton.ghost(
|
||||
onPressed: () => _copyToClipboard(context, zipcode.zipcode.toString().padLeft(5, '0'), '우편번호'),
|
||||
size: ShadButtonSize.sm,
|
||||
child: Icon(Icons.copy, size: 14, color: theme.colorScheme.mutedForeground),
|
||||
),
|
||||
size: ShadButtonSize.sm,
|
||||
child: Icon(
|
||||
Icons.copy,
|
||||
size: 14,
|
||||
color: theme.colorScheme.mutedForeground,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// 작업
|
||||
DataCell(
|
||||
ShadButton(
|
||||
onPressed: () => onSelect(zipcode),
|
||||
size: ShadButtonSize.sm,
|
||||
child: const Text('선택', style: TextStyle(fontSize: 11)),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
// 시도
|
||||
ShadTableCell(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_city, size: 16, color: theme.colorScheme.mutedForeground),
|
||||
const SizedBox(width: 6),
|
||||
Flexible(child: Text(zipcode.sido, overflow: TextOverflow.ellipsis, style: const TextStyle(fontWeight: FontWeight.w500))),
|
||||
],
|
||||
),
|
||||
),
|
||||
// 구/군
|
||||
ShadTableCell(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_on, size: 16, color: theme.colorScheme.mutedForeground),
|
||||
const SizedBox(width: 6),
|
||||
Flexible(child: Text(zipcode.gu, overflow: TextOverflow.ellipsis, style: const TextStyle(fontWeight: FontWeight.w500))),
|
||||
],
|
||||
),
|
||||
),
|
||||
// 상세주소 (가변 폭)
|
||||
ShadTableCell(
|
||||
child: SizedBox(
|
||||
width: etcW,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(child: Text(zipcode.etc, overflow: TextOverflow.ellipsis, style: TextStyle(color: theme.colorScheme.foreground))),
|
||||
const SizedBox(width: 8),
|
||||
ShadButton.ghost(
|
||||
onPressed: () => _copyToClipboard(context, zipcode.fullAddress, '전체주소'),
|
||||
size: ShadButtonSize.sm,
|
||||
child: Icon(Icons.copy, size: 14, color: theme.colorScheme.mutedForeground),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// 작업
|
||||
ShadTableCell(
|
||||
child: ShadButton(
|
||||
onPressed: () => onSelect(zipcode),
|
||||
size: ShadButtonSize.sm,
|
||||
child: const Text('선택', style: TextStyle(fontSize: 11)),
|
||||
),
|
||||
),
|
||||
const ShadTableCell(child: SizedBox.shrink()),
|
||||
];
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user