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:
@@ -283,59 +283,84 @@ class _MaintenanceListState extends State<MaintenanceList> {
|
||||
);
|
||||
}
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: ShadcnTheme.border),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// 고정 헤더
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: ShadcnTheme.spacing4, vertical: ShadcnTheme.spacing3),
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
||||
border: Border(bottom: BorderSide(color: ShadcnTheme.border)),
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(ShadcnTheme.radiusMd),
|
||||
topRight: Radius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
controller: _horizontalScrollController,
|
||||
child: _buildFixedHeader(),
|
||||
),
|
||||
),
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
// 기본 컬럼 폭 합산
|
||||
const double selectW = 60;
|
||||
const double idW = 80;
|
||||
const double equipInfoBaseW = 200; // 이 컬럼이 남는 폭을 흡수
|
||||
const double typeW = 120;
|
||||
const double startW = 100;
|
||||
const double endW = 100;
|
||||
const double periodW = 80;
|
||||
const double statusW = 100;
|
||||
const double remainW = 100;
|
||||
const double actionsW = 120;
|
||||
|
||||
// 스크롤 가능한 바디
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
controller: _horizontalScrollController,
|
||||
child: SizedBox(
|
||||
width: _calculateTableWidth(),
|
||||
child: ListView.builder(
|
||||
itemCount: maintenances.length,
|
||||
itemBuilder: (context, index) => _buildTableRow(maintenances[index], index),
|
||||
double baseWidth = selectW + idW + equipInfoBaseW + typeW + startW + endW + actionsW;
|
||||
if (_showDetailedColumns) {
|
||||
baseWidth += periodW + statusW + remainW;
|
||||
}
|
||||
|
||||
final extra = (constraints.maxWidth - baseWidth);
|
||||
final double equipInfoWidth = equipInfoBaseW + (extra > 0 ? extra : 0.0);
|
||||
final double tableWidth = (constraints.maxWidth > baseWidth) ? constraints.maxWidth : baseWidth;
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: ShadcnTheme.border),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// 고정 헤더
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: ShadcnTheme.spacing4, vertical: ShadcnTheme.spacing3),
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
||||
border: Border(bottom: BorderSide(color: ShadcnTheme.border)),
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(ShadcnTheme.radiusMd),
|
||||
topRight: Radius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
controller: _horizontalScrollController,
|
||||
child: _buildFixedHeader(equipInfoWidth, tableWidth),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// 스크롤 가능한 바디
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
controller: _horizontalScrollController,
|
||||
child: SizedBox(
|
||||
width: tableWidth,
|
||||
child: ListView.builder(
|
||||
itemCount: maintenances.length,
|
||||
itemBuilder: (context, index) => _buildTableRow(maintenances[index], index, equipInfoWidth),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 고정 헤더 빌드
|
||||
Widget _buildFixedHeader() {
|
||||
Widget _buildFixedHeader(double equipInfoWidth, double tableWidth) {
|
||||
return SizedBox(
|
||||
width: _calculateTableWidth(),
|
||||
width: tableWidth,
|
||||
child: Row(
|
||||
children: [
|
||||
_buildHeaderCell('선택', 60),
|
||||
_buildHeaderCell('ID', 80),
|
||||
_buildHeaderCell('장비 정보', 200),
|
||||
_buildHeaderCell('장비 정보', equipInfoWidth),
|
||||
_buildHeaderCell('유지보수 타입', 120),
|
||||
_buildHeaderCell('시작일', 100),
|
||||
_buildHeaderCell('종료일', 100),
|
||||
@@ -350,14 +375,7 @@ class _MaintenanceListState extends State<MaintenanceList> {
|
||||
);
|
||||
}
|
||||
|
||||
/// 테이블 총 너비 계산
|
||||
double _calculateTableWidth() {
|
||||
double width = 60 + 80 + 200 + 120 + 100 + 100 + 120; // 기본 컬럼들
|
||||
if (_showDetailedColumns) {
|
||||
width += 80 + 100 + 100; // 상세 컬럼들
|
||||
}
|
||||
return width;
|
||||
}
|
||||
// 기존 _calculateTableWidth 제거: LayoutBuilder에서 계산
|
||||
|
||||
/// 헤더 셀 빌드
|
||||
Widget _buildHeaderCell(String text, double width) {
|
||||
@@ -372,7 +390,7 @@ class _MaintenanceListState extends State<MaintenanceList> {
|
||||
}
|
||||
|
||||
/// 테이블 행 빌드
|
||||
Widget _buildTableRow(MaintenanceDto maintenance, int index) {
|
||||
Widget _buildTableRow(MaintenanceDto maintenance, int index, double equipInfoWidth) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: index.isEven ? ShadcnTheme.muted.withValues(alpha: 0.1) : null,
|
||||
@@ -412,9 +430,9 @@ class _MaintenanceListState extends State<MaintenanceList> {
|
||||
),
|
||||
),
|
||||
|
||||
// 장비 정보
|
||||
// 장비 정보 (가변 폭)
|
||||
SizedBox(
|
||||
width: 200,
|
||||
width: equipInfoWidth,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -448,9 +466,9 @@ class _MaintenanceListState extends State<MaintenanceList> {
|
||||
),
|
||||
child: Text(
|
||||
MaintenanceType.getDisplayName(maintenance.maintenanceType),
|
||||
style: const TextStyle(
|
||||
style: ShadcnTheme.caption.copyWith(
|
||||
fontSize: 12,
|
||||
color: Colors.white,
|
||||
color: ShadcnTheme.primaryForeground,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -498,9 +516,9 @@ class _MaintenanceListState extends State<MaintenanceList> {
|
||||
),
|
||||
child: Text(
|
||||
_controller.getMaintenanceStatusText(maintenance),
|
||||
style: const TextStyle(
|
||||
style: ShadcnTheme.caption.copyWith(
|
||||
fontSize: 12,
|
||||
color: Colors.white,
|
||||
color: ShadcnTheme.primaryForeground,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -729,4 +747,4 @@ class _MaintenanceListState extends State<MaintenanceList> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user