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:
@@ -121,7 +121,7 @@ class _EquipmentHistoryDetailDialogState
|
||||
shape: BoxShape.circle,
|
||||
color: color,
|
||||
border: Border.all(
|
||||
color: Colors.white,
|
||||
color: ShadcnTheme.primaryForeground,
|
||||
width: 2,
|
||||
),
|
||||
boxShadow: [
|
||||
@@ -134,7 +134,7 @@ class _EquipmentHistoryDetailDialogState
|
||||
),
|
||||
child: Icon(
|
||||
_getTransactionIcon(history.transactionType),
|
||||
color: Colors.white,
|
||||
color: ShadcnTheme.primaryForeground,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
@@ -163,7 +163,7 @@ class _EquipmentHistoryDetailDialogState
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
color: ShadcnTheme.foreground.withValues(alpha: 0.05),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -534,4 +534,4 @@ class _EquipmentHistoryDetailDialogState
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import 'controllers/equipment_history_controller.dart';
|
||||
@@ -172,7 +173,7 @@ class _InventoryDashboardState extends State<InventoryDashboard> {
|
||||
),
|
||||
child: Text(
|
||||
history.transactionType == 'I' ? '입고' : '출고',
|
||||
style: const TextStyle(color: Colors.white, fontSize: 12),
|
||||
style: TextStyle(color: ShadcnTheme.primaryForeground, fontSize: 12),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
@@ -255,4 +256,4 @@ class _InventoryDashboardState extends State<InventoryDashboard> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ class _InventoryHistoryScreenState extends State<InventoryHistoryScreen> {
|
||||
text: '검색',
|
||||
onPressed: _onSearch,
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
textColor: Colors.white,
|
||||
textColor: ShadcnTheme.primaryForeground,
|
||||
icon: const Icon(Icons.search, size: 16),
|
||||
),
|
||||
),
|
||||
@@ -297,12 +297,12 @@ class _InventoryHistoryScreenState extends State<InventoryHistoryScreen> {
|
||||
),
|
||||
if (controller.hasActiveFilters) ...[
|
||||
const SizedBox(width: 8),
|
||||
const Text('|', style: TextStyle(color: Colors.grey)),
|
||||
Text('|', style: ShadcnTheme.bodySmall.copyWith(color: ShadcnTheme.mutedForeground)),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'필터링됨',
|
||||
style: ShadcnTheme.bodySmall.copyWith(
|
||||
color: Colors.orange,
|
||||
color: ShadcnTheme.warning,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
@@ -404,63 +404,113 @@ class _InventoryHistoryScreenState extends State<InventoryHistoryScreen> {
|
||||
),
|
||||
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('비고')),
|
||||
],
|
||||
children: historyList.map((history) {
|
||||
return [
|
||||
// 장비명
|
||||
ShadTableCell(
|
||||
child: Tooltip(
|
||||
message: history.equipmentName,
|
||||
child: Text(history.equipmentName, overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodyMedium.copyWith(fontWeight: FontWeight.w500)),
|
||||
),
|
||||
),
|
||||
// 시리얼번호
|
||||
ShadTableCell(
|
||||
child: Tooltip(
|
||||
message: history.serialNumber,
|
||||
child: Text(history.serialNumber, overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodySmall),
|
||||
),
|
||||
),
|
||||
// 위치
|
||||
ShadTableCell(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(history.isCustomerLocation ? Icons.business : Icons.warehouse, size: 14, color: history.isCustomerLocation ? ShadcnTheme.companyCustomer : ShadcnTheme.equipmentIn),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(child: Text(history.location, overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodySmall)),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
// 고정폭 + 마지막 filler 컬럼
|
||||
const double actionsW = 160.0;
|
||||
const double minTableWidth = 260 + 200 + 260 + 140 + actionsW + 240 + 24;
|
||||
final double tableWidth = constraints.maxWidth >= minTableWidth
|
||||
? constraints.maxWidth
|
||||
: minTableWidth;
|
||||
const double remarkColumnWidth = 240.0;
|
||||
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: SizedBox(
|
||||
width: tableWidth,
|
||||
child: ShadTable.list(
|
||||
columnSpanExtent: (index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return const FixedTableSpanExtent(260); // 장비명
|
||||
case 1:
|
||||
return const FixedTableSpanExtent(200); // 시리얼
|
||||
case 2:
|
||||
return const FixedTableSpanExtent(260); // 위치
|
||||
case 3:
|
||||
return const FixedTableSpanExtent(140); // 변동일
|
||||
case 4:
|
||||
return const FixedTableSpanExtent(actionsW); // 작업
|
||||
case 5:
|
||||
return const FixedTableSpanExtent(remarkColumnWidth); // 비고
|
||||
case 6:
|
||||
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('위치')),
|
||||
const ShadTableCell.header(child: Text('변동일')),
|
||||
ShadTableCell.header(child: SizedBox(width: actionsW, child: const Text('작업'))),
|
||||
ShadTableCell.header(child: SizedBox(width: remarkColumnWidth, child: const Text('비고'))),
|
||||
const ShadTableCell.header(child: SizedBox.shrink()),
|
||||
],
|
||||
),
|
||||
),
|
||||
// 변동일
|
||||
ShadTableCell(child: Text(history.formattedDate, style: ShadcnTheme.bodySmall)),
|
||||
// 작업
|
||||
children: historyList.map((history) {
|
||||
return [
|
||||
// 장비명
|
||||
ShadTableCell(
|
||||
child: Tooltip(
|
||||
message: history.equipmentName,
|
||||
child: Text(history.equipmentName, overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodyMedium.copyWith(fontWeight: FontWeight.w500)),
|
||||
),
|
||||
),
|
||||
// 시리얼번호
|
||||
ShadTableCell(
|
||||
child: Tooltip(
|
||||
message: history.serialNumber,
|
||||
child: Text(history.serialNumber, overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodySmall),
|
||||
),
|
||||
),
|
||||
// 위치
|
||||
ShadTableCell(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(history.isCustomerLocation ? Icons.business : Icons.warehouse, size: 14, color: history.isCustomerLocation ? ShadcnTheme.companyCustomer : ShadcnTheme.equipmentIn),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(child: Text(history.location, overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodySmall)),
|
||||
],
|
||||
),
|
||||
),
|
||||
// 변동일
|
||||
ShadTableCell(child: Text(history.formattedDate, style: ShadcnTheme.bodySmall)),
|
||||
// 작업
|
||||
ShadTableCell(
|
||||
child: ShadButton.outline(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () => _showEquipmentHistoryDetail(history),
|
||||
child: const Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [Icon(Icons.history, size: 14), SizedBox(width: 4), Text('상세보기', style: TextStyle(fontSize: 12))],
|
||||
child: SizedBox(
|
||||
width: actionsW,
|
||||
child: FittedBox(
|
||||
alignment: Alignment.centerLeft,
|
||||
fit: BoxFit.scaleDown,
|
||||
child: ShadButton.outline(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: () => _showEquipmentHistoryDetail(history),
|
||||
child: const Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [Icon(Icons.history, size: 14), SizedBox(width: 4), Text('상세보기', style: TextStyle(fontSize: 12))],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// 비고
|
||||
ShadTableCell(
|
||||
child: Tooltip(
|
||||
message: history.remark ?? '비고 없음',
|
||||
child: Text(history.remark ?? '-', overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodySmall.copyWith(color: ShadcnTheme.mutedForeground)),
|
||||
// 비고
|
||||
ShadTableCell(
|
||||
child: SizedBox(
|
||||
width: remarkColumnWidth,
|
||||
child: Tooltip(
|
||||
message: history.remark ?? '비고 없음',
|
||||
child: Text(history.remark ?? '-', overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodySmall.copyWith(color: ShadcnTheme.mutedForeground)),
|
||||
),
|
||||
),
|
||||
),
|
||||
const ShadTableCell(child: SizedBox.shrink()),
|
||||
];
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
];
|
||||
}).toList(),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -491,15 +541,14 @@ class _InventoryHistoryScreenState extends State<InventoryHistoryScreen> {
|
||||
// 데이터 테이블
|
||||
dataTable: _buildDataTable(controller.historyItems),
|
||||
|
||||
// 페이지네이션
|
||||
pagination: controller.totalPages > 1
|
||||
? Pagination(
|
||||
totalCount: controller.totalCount,
|
||||
currentPage: controller.currentPage,
|
||||
pageSize: controller.pageSize,
|
||||
onPageChanged: (page) => controller.goToPage(page),
|
||||
)
|
||||
: null,
|
||||
// 페이지네이션 (항상 표시)
|
||||
pagination: Pagination(
|
||||
totalCount: controller.totalCount,
|
||||
currentPage: controller.currentPage,
|
||||
pageSize: controller.pageSize,
|
||||
onPageChanged: (page) => controller.goToPage(page),
|
||||
),
|
||||
dataAreaPadding: EdgeInsets.zero,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user