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

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import '../../../data/models/maintenance_dto.dart';
import 'package:superport/screens/common/theme_shadcn.dart';
class MaintenanceCalendar extends StatefulWidget {
final List<MaintenanceDto> maintenances;
@@ -42,14 +43,8 @@ class _MaintenanceCalendarState extends State<MaintenanceCalendar> {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.1),
blurRadius: 4,
offset: const Offset(0, 2),
),
],
color: ShadcnTheme.card,
boxShadow: ShadcnTheme.shadowSm,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -104,9 +99,11 @@ class _MaintenanceCalendarState extends State<MaintenanceCalendar> {
padding: const EdgeInsets.symmetric(vertical: 12),
child: Text(
weekdays[i],
style: TextStyle(
fontWeight: FontWeight.bold,
color: i == 0 ? Colors.red : (i == 6 ? Colors.blue : Colors.black),
style: ShadcnTheme.labelMedium.copyWith(
fontWeight: FontWeight.w600,
color: i == 0
? ShadcnTheme.destructive
: (i == 6 ? ShadcnTheme.accent : ShadcnTheme.foreground),
),
),
),
@@ -140,15 +137,15 @@ class _MaintenanceCalendarState extends State<MaintenanceCalendar> {
margin: const EdgeInsets.all(2),
decoration: BoxDecoration(
color: isSelected
? Theme.of(context).primaryColor.withValues(alpha: 0.2)
? ShadcnTheme.primary.withValues(alpha: 0.12)
: isToday
? Colors.blue.withValues(alpha: 0.1)
? ShadcnTheme.accent.withValues(alpha: 0.08)
: Colors.transparent,
border: Border.all(
color: isSelected
? Theme.of(context).primaryColor
? ShadcnTheme.primary
: isToday
? Colors.blue
? ShadcnTheme.accent
: Colors.transparent,
width: isSelected || isToday ? 2 : 1,
),
@@ -162,11 +159,13 @@ class _MaintenanceCalendarState extends State<MaintenanceCalendar> {
left: 8,
child: Text(
day.toString(),
style: TextStyle(
fontWeight: isToday ? FontWeight.bold : FontWeight.normal,
style: ShadcnTheme.bodySmall.copyWith(
fontWeight: isToday ? FontWeight.w700 : FontWeight.w400,
color: isWeekend
? (date.weekday == DateTime.sunday ? Colors.red : Colors.blue)
: Colors.black,
? (date.weekday == DateTime.sunday
? ShadcnTheme.destructive
: ShadcnTheme.accent)
: ShadcnTheme.foreground,
),
),
),
@@ -188,9 +187,9 @@ class _MaintenanceCalendarState extends State<MaintenanceCalendar> {
),
child: Text(
'#${m.equipmentHistoryId}',
style: const TextStyle(
fontSize: 10,
color: Colors.white,
style: ShadcnTheme.caption.copyWith(
color: ShadcnTheme.primaryForeground,
fontWeight: FontWeight.w600,
),
overflow: TextOverflow.ellipsis,
),
@@ -207,14 +206,14 @@ class _MaintenanceCalendarState extends State<MaintenanceCalendar> {
child: Container(
padding: const EdgeInsets.all(2),
decoration: BoxDecoration(
color: Colors.grey[600],
color: ShadcnTheme.secondaryDark,
shape: BoxShape.circle,
),
child: Text(
'+${dayMaintenances.length - 3}',
style: const TextStyle(
fontSize: 8,
color: Colors.white,
style: ShadcnTheme.caption.copyWith(
fontSize: 9,
color: ShadcnTheme.primaryForeground,
),
),
),
@@ -276,24 +275,23 @@ class _MaintenanceCalendarState extends State<MaintenanceCalendar> {
switch (status.toLowerCase()) {
case 'overdue':
return Colors.red;
return ShadcnTheme.alertExpired;
case 'scheduled':
case 'upcoming':
// nextMaintenanceDate 필드가 없으므로 startedAt 기반으로 계산
final daysUntil = maintenance.startedAt.difference(DateTime.now()).inDays;
if (daysUntil <= 7) {
return Colors.orange;
return ShadcnTheme.alertWarning30;
} else if (daysUntil <= 30) {
return Colors.yellow[700]!;
return ShadcnTheme.alertWarning60;
}
return Colors.blue;
return ShadcnTheme.info;
case 'inprogress':
case 'ongoing':
return Colors.purple;
return ShadcnTheme.purple;
case 'completed':
return Colors.green;
return ShadcnTheme.success;
default:
return Colors.grey;
return ShadcnTheme.secondary;
}
}
}
}

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:superport/screens/common/theme_shadcn.dart';
import 'package:superport/data/models/maintenance_dto.dart';
import 'package:superport/data/models/equipment_history_dto.dart';
import 'package:superport/data/repositories/equipment_history_repository.dart';
@@ -563,7 +564,7 @@ class MaintenanceController extends ChangeNotifier {
case '완료': return Colors.grey;
case '만료됨': return Colors.red;
case '삭제됨': return Colors.grey.withValues(alpha: 0.5);
default: return Colors.black;
default: return ShadcnTheme.foreground;
}
}
@@ -636,8 +637,13 @@ class MaintenanceController extends ChangeNotifier {
// 백엔드에서 직접 제공하는 company_name 사용
debugPrint('getCompanyName - ID: ${maintenance.id}, companyName: "${maintenance.companyName}", companyId: ${maintenance.companyId}');
if (maintenance.companyName != null && maintenance.companyName!.isNotEmpty) {
return maintenance.companyName!;
final name = maintenance.companyName;
if (name != null) {
final trimmed = name.trim();
// 백엔드가 문자열 'null'을 반환하는 케이스 방지
if (trimmed.isNotEmpty && trimmed.toLowerCase() != 'null') {
return trimmed;
}
}
return '-';
}
@@ -707,4 +713,4 @@ class MaintenanceController extends ChangeNotifier {
reset();
super.dispose();
}
}
}

View File

@@ -1,3 +1,4 @@
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
@@ -7,7 +8,8 @@ import 'package:superport/screens/maintenance/controllers/maintenance_controller
import 'package:superport/screens/maintenance/widgets/status_summary_cards.dart';
import 'package:superport/screens/maintenance/maintenance_form_dialog.dart';
import 'package:superport/data/models/maintenance_dto.dart';
import 'package:superport/screens/common/widgets/standard_data_table.dart';
// Removed StandardDataTable in favor of ShadTable.list
import 'package:superport/screens/common/widgets/pagination.dart';
/// 유지보수 대시보드 화면 (Phase 9.2)
/// StatusSummaryCards + 필터링된 유지보수 목록으로 구성
@@ -21,6 +23,8 @@ class MaintenanceAlertDashboard extends StatefulWidget {
class _MaintenanceAlertDashboardState extends State<MaintenanceAlertDashboard> {
String _activeFilter = 'all'; // all, expiring_60, expiring_30, expiring_7, expired
int _alertPage = 1;
final int _alertPageSize = 10;
@override
void initState() {
@@ -207,7 +211,7 @@ class _MaintenanceAlertDashboardState extends State<MaintenanceAlertDashboard> {
icon = Icons.schedule_outlined;
break;
case 'expired':
color = ShadcnTheme.alertExpired; // 만료됨 - 심각 (진한 레드)
color = ShadcnTheme.alertExpired; // 만료됨 - 심각 (진한 레드)
icon = Icons.error_outline;
break;
default:
@@ -294,7 +298,7 @@ class _MaintenanceAlertDashboardState extends State<MaintenanceAlertDashboard> {
);
}
/// 필터링된 유지보수 목록 (테이블 형태)
/// 필터링된 유지보수 목록 (ShadTable.list)
Widget _buildFilteredMaintenanceList(MaintenanceController controller) {
if (controller.isLoading && controller.upcomingAlerts.isEmpty && controller.overdueAlerts.isEmpty) {
return ShadCard(
@@ -309,14 +313,13 @@ class _MaintenanceAlertDashboardState extends State<MaintenanceAlertDashboard> {
final filteredList = _getFilteredMaintenanceList(controller);
if (filteredList.isEmpty) {
return StandardDataTable(
columns: _buildTableColumns(),
rows: const [],
emptyMessage: _getEmptyMessage(),
emptyIcon: Icons.check_circle_outline,
);
}
// 항상 테이블 헤더 + 페이지네이션을 유지
// 페이지네이션 적용 (UI 레벨)
final total = filteredList.length;
final start = ((_alertPage - 1) * _alertPageSize).clamp(0, total);
final end = (start + _alertPageSize).clamp(0, total);
final paged = filteredList.sublist(start, end);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -357,183 +360,149 @@ class _MaintenanceAlertDashboardState extends State<MaintenanceAlertDashboard> {
],
),
),
// 테이블
StandardDataTable(
columns: _buildTableColumns(),
rows: filteredList.map((maintenance) =>
_buildMaintenanceTableRow(maintenance, controller)
).toList(),
maxHeight: 400,
// 테이블 (ShadTable.list)
// 주의: TwoDimensionalViewport 제약 오류 방지를 위해 고정/제한 높이 부여
SizedBox(
height: _computeTableHeight(paged.length),
child: LayoutBuilder(builder: (context, constraints) {
// 최소 폭 추정: 장비명(260)+시리얼(200)+고객사(240)+만료일(140)+타입(120)+상태(180)+주기(100)+여백(24)
const double minTableWidth = 260 + 200 + 240 + 140 + 120 + 180 + 100 + 24;
final double extra = constraints.maxWidth - minTableWidth;
final double fillerWidth = extra > 0 ? extra : 0.0;
const double nameBaseWidth = 260.0;
final double nameColumnWidth = nameBaseWidth + fillerWidth; // 남는 폭은 장비명이 흡수
return ShadTable.list(
header: [
ShadTableCell.header(child: SizedBox(width: nameColumnWidth, 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('주기')),
],
// 남은 폭을 채우는 필러 컬럼은 위에서 header에 추가함
children: paged.map((maintenance) {
final today = DateTime.now();
final daysRemaining = maintenance.endedAt.difference(today).inDays;
final isExpiringSoon = daysRemaining <= 7;
final isExpired = daysRemaining < 0;
Color typeBg = _getMaintenanceTypeColor(maintenance.maintenanceType);
final typeLabel = _getMaintenanceTypeLabel(maintenance.maintenanceType);
return [
// 장비명
ShadTableCell(
child: SizedBox(
width: nameColumnWidth,
child: InkWell(
onTap: () => _showMaintenanceDetails(maintenance),
child: Text(
controller.getEquipmentName(maintenance),
style: ShadcnTheme.bodyMedium.copyWith(
fontWeight: FontWeight.w500,
color: ShadcnTheme.primary,
),
overflow: TextOverflow.ellipsis,
),
),
),
),
// 시리얼번호
ShadTableCell(
child: Text(
controller.getEquipmentSerial(maintenance),
style: ShadcnTheme.bodySmall,
overflow: TextOverflow.ellipsis,
),
),
// 고객사
ShadTableCell(
child: Text(
controller.getCompanyName(maintenance),
style: ShadcnTheme.bodySmall.copyWith(
color: ShadcnTheme.companyCustomer,
fontWeight: FontWeight.w500,
),
overflow: TextOverflow.ellipsis,
),
),
// 만료일
ShadTableCell(
child: Text(
'${maintenance.endedAt.year}-${maintenance.endedAt.month.toString().padLeft(2, '0')}-${maintenance.endedAt.day.toString().padLeft(2, '0')}',
style: ShadcnTheme.bodySmall.copyWith(
color: isExpired
? ShadcnTheme.alertExpired
: isExpiringSoon
? ShadcnTheme.alertWarning30
: ShadcnTheme.alertNormal,
fontWeight: isExpired || isExpiringSoon ? FontWeight.w600 : FontWeight.w500,
),
),
),
// 타입
ShadTableCell(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: typeBg,
borderRadius: BorderRadius.circular(12),
),
child: Text(
typeLabel,
style: ShadcnTheme.caption.copyWith(
color: ShadcnTheme.primaryForeground,
fontWeight: FontWeight.w600,
fontSize: 10,
),
),
),
),
// 상태 (남은 일수/지연)
ShadTableCell(
child: Text(
isExpired ? '${daysRemaining.abs()}일 지연' : '$daysRemaining일 남음',
style: ShadcnTheme.bodySmall.copyWith(
color: isExpired
? ShadcnTheme.alertExpired
: isExpiringSoon
? ShadcnTheme.alertWarning30
: ShadcnTheme.alertNormal,
fontWeight: FontWeight.w600,
),
),
),
// 주기
ShadTableCell(
child: Text(
'${maintenance.periodMonth}개월',
style: ShadcnTheme.bodySmall,
),
),
// 바디에는 빈 셀로 컬럼만 유지
// 남는 폭은 장비명 컬럼이 흡수
];
}).toList(),
);
}),
),
// 하단 페이지네이션 (항상 표시)
const SizedBox(height: 12),
Pagination(
totalCount: total,
currentPage: _alertPage,
pageSize: _alertPageSize,
onPageChanged: (p) => setState(() => _alertPage = p),
),
],
);
}
/// 테이블 컬럼 정의
List<StandardDataColumn> _buildTableColumns() {
return [
StandardDataColumn(
label: '장비명',
flex: 3,
),
StandardDataColumn(
label: '시리얼번호',
flex: 2,
),
StandardDataColumn(
label: '고객사',
flex: 2,
),
StandardDataColumn(
label: '만료일',
flex: 2,
),
StandardDataColumn(
label: '타입',
flex: 1,
),
StandardDataColumn(
label: '상태',
flex: 2,
),
StandardDataColumn(
label: '주기',
flex: 1,
),
];
}
/// 유지보수 테이블 행 생성
StandardDataRow _buildMaintenanceTableRow(
MaintenanceDto maintenance,
MaintenanceController controller,
) {
// 만료까지 남은 일수 계산
final today = DateTime.now();
final daysRemaining = maintenance.endedAt.difference(today).inDays;
final isExpiringSoon = daysRemaining <= 7;
final isExpired = daysRemaining < 0;
return StandardDataRow(
index: 0, // index는 StandardDataTable에서 자동 설정
columns: _buildTableColumns(),
cells: [
// 장비명
InkWell(
onTap: () => _showMaintenanceDetails(maintenance),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8),
child: Text(
controller.getEquipmentName(maintenance),
style: ShadcnTheme.bodyMedium.copyWith(
fontWeight: FontWeight.w500,
color: ShadcnTheme.primary,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
),
// 시리얼번호
Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8),
child: Text(
controller.getEquipmentSerial(maintenance),
style: ShadcnTheme.bodySmall.copyWith(
color: ShadcnTheme.foreground,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
// 고객사 - Phase 10: 회사 타입별 색상 적용
Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8),
child: Text(
controller.getCompanyName(maintenance),
style: ShadcnTheme.bodySmall.copyWith(
color: ShadcnTheme.companyCustomer, // 고객사 - 진한 그린
fontWeight: FontWeight.w500,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
// 만료일
Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8),
child: Text(
'${maintenance.endedAt.year}-${maintenance.endedAt.month.toString().padLeft(2, '0')}-${maintenance.endedAt.day.toString().padLeft(2, '0')}',
style: ShadcnTheme.bodySmall.copyWith(
// Phase 10: 만료 상태별 색상 체계 적용
color: isExpired
? ShadcnTheme.alertExpired // 만료됨 - 심각 (진한 레드)
: isExpiringSoon
? ShadcnTheme.alertWarning30 // 만료 임박 - 경고 (오렌지)
: ShadcnTheme.alertNormal, // 정상 - 안전 (그린)
fontWeight: isExpired || isExpiringSoon ? FontWeight.w600 : FontWeight.w500,
),
),
),
// 타입 (방문/원격 변환)
Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: _getMaintenanceTypeColor(maintenance.maintenanceType),
borderRadius: BorderRadius.circular(12),
),
child: Text(
_getMaintenanceTypeLabel(maintenance.maintenanceType),
style: ShadcnTheme.caption.copyWith(
color: Colors.white,
fontWeight: FontWeight.w600,
fontSize: 10,
),
),
),
),
// 상태 (남은 일수/지연)
Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8),
child: Text(
isExpired
? '${daysRemaining.abs()}일 지연'
: '$daysRemaining일 남음',
style: ShadcnTheme.bodySmall.copyWith(
// Phase 10: 남은 일수 상태별 색상 체계 적용
color: isExpired
? ShadcnTheme.alertExpired // 지연 - 심각 (진한 레드)
: isExpiringSoon
? ShadcnTheme.alertWarning30 // 임박 - 경고 (오렌지)
: ShadcnTheme.alertNormal, // 충분 - 안전 (그린)
fontWeight: FontWeight.w600,
),
),
),
// 주기
Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 8),
child: Text(
'${maintenance.periodMonth}개월',
style: ShadcnTheme.bodySmall.copyWith(
color: ShadcnTheme.foreground,
),
),
),
],
);
}
/// 유지보수 타입을 방문(V)/원격(R)로 변환
String _getMaintenanceTypeLabel(String maintenanceType) {
switch (maintenanceType) {
@@ -559,6 +528,17 @@ class _MaintenanceAlertDashboardState extends State<MaintenanceAlertDashboard> {
}
}
// 테이블 높이 계산 (ShadTable.list가 내부 스크롤을 가지므로 부모에서 높이를 제한)
double _computeTableHeight(int rows) {
const rowHeight = 48.0; // 셀 높이(대략)
const headerHeight = 48.0;
const minH = 200.0; // 너무 작지 않게 최소 높이
const maxH = 560.0; // 페이지에서 과도하게 커지지 않도록 상한
final visible = rows.clamp(1, _alertPageSize); // 페이지당 행 수 이내로 계산
final h = headerHeight + (visible * rowHeight) + 16.0; // 약간의 패딩
return math.max(minH, math.min(maxH, h.toDouble()));
}
/// 빠른 작업 섹션
Widget _buildQuickActions() {
return ShadCard(
@@ -735,4 +715,4 @@ class _MaintenanceAlertDashboardState extends State<MaintenanceAlertDashboard> {
),
);
}
}
}

View File

@@ -99,15 +99,8 @@ class _MaintenanceHistoryScreenState extends State<MaintenanceHistoryScreen>
return Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.1),
spreadRadius: 1,
blurRadius: 3,
offset: const Offset(0, 2),
),
],
color: ShadcnTheme.card,
boxShadow: ShadcnTheme.shadowSm,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -132,7 +125,7 @@ class _MaintenanceHistoryScreenState extends State<MaintenanceHistoryScreen>
.length;
return Text(
'완료된 유지보수: $completedCount건',
style: TextStyle(color: Colors.grey[600]),
style: ShadcnTheme.bodySmall.copyWith(color: ShadcnTheme.mutedForeground),
);
},
),
@@ -272,9 +265,9 @@ class _MaintenanceHistoryScreenState extends State<MaintenanceHistoryScreen>
return Container(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
decoration: BoxDecoration(
color: Colors.white,
color: ShadcnTheme.card,
border: Border(
bottom: BorderSide(color: Colors.grey[300]!),
bottom: BorderSide(color: ShadcnTheme.border),
),
),
child: Row(
@@ -298,7 +291,7 @@ class _MaintenanceHistoryScreenState extends State<MaintenanceHistoryScreen>
child: Container(
padding: const EdgeInsets.symmetric(vertical: 12),
decoration: BoxDecoration(
color: isSelected ? Theme.of(context).primaryColor : Colors.grey[100],
color: isSelected ? ShadcnTheme.primary : ShadcnTheme.muted,
borderRadius: BorderRadius.circular(8),
),
child: Row(
@@ -307,13 +300,13 @@ class _MaintenanceHistoryScreenState extends State<MaintenanceHistoryScreen>
Icon(
icon,
size: 20,
color: isSelected ? Colors.white : Colors.grey[600],
color: isSelected ? ShadcnTheme.primaryForeground : ShadcnTheme.mutedForeground,
),
const SizedBox(width: 8),
Text(
label,
style: TextStyle(
color: isSelected ? Colors.white : Colors.grey[600],
style: ShadcnTheme.bodySmall.copyWith(
color: isSelected ? ShadcnTheme.primaryForeground : ShadcnTheme.mutedForeground,
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
),
),
@@ -374,8 +367,8 @@ class _MaintenanceHistoryScreenState extends State<MaintenanceHistoryScreen>
),
child: Text(
DateFormat('yyyy년 MM월 dd일').format(DateTime.parse(date)),
style: const TextStyle(
color: Colors.white,
style: TextStyle(
color: ShadcnTheme.primaryForeground,
fontWeight: FontWeight.bold,
),
),
@@ -394,15 +387,9 @@ class _MaintenanceHistoryScreenState extends State<MaintenanceHistoryScreen>
margin: const EdgeInsets.only(left: 20, bottom: 12),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
color: ShadcnTheme.card,
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.1),
blurRadius: 4,
offset: const Offset(0, 2),
),
],
boxShadow: ShadcnTheme.shadowSm,
border: Border(
left: BorderSide(
color: Theme.of(context).primaryColor,
@@ -547,8 +534,8 @@ class _MaintenanceHistoryScreenState extends State<MaintenanceHistoryScreen>
color: index.isEven
? ShadcnTheme.muted.withValues(alpha: 0.1)
: null,
border: const Border(
bottom: BorderSide(color: Colors.black),
border: Border(
bottom: BorderSide(color: ShadcnTheme.border),
),
),
child: Row(
@@ -634,7 +621,7 @@ class _MaintenanceHistoryScreenState extends State<MaintenanceHistoryScreen>
return Container(
margin: const EdgeInsets.all(24),
decoration: BoxDecoration(
border: Border.all(color: Colors.black),
border: Border.all(color: ShadcnTheme.border),
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
),
child: Column(
@@ -644,7 +631,7 @@ class _MaintenanceHistoryScreenState extends State<MaintenanceHistoryScreen>
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
decoration: BoxDecoration(
color: ShadcnTheme.muted.withValues(alpha: 0.3),
border: Border(bottom: BorderSide(color: Colors.black)),
border: Border(bottom: BorderSide(color: ShadcnTheme.border)),
),
child: Row(children: _buildHeaderCells()),
),
@@ -743,15 +730,9 @@ class _MaintenanceHistoryScreenState extends State<MaintenanceHistoryScreen>
return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.white,
color: ShadcnTheme.card,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.1),
blurRadius: 10,
offset: const Offset(0, 2),
),
],
boxShadow: ShadcnTheme.shadowMd,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -931,10 +912,10 @@ class _MaintenanceHistoryScreenState extends State<MaintenanceHistoryScreen>
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
Text(
'통계 요약',
style: TextStyle(
color: Colors.white,
color: ShadcnTheme.primaryForeground,
fontSize: 18,
fontWeight: FontWeight.bold,
),
@@ -961,15 +942,15 @@ class _MaintenanceHistoryScreenState extends State<MaintenanceHistoryScreen>
Text(
label,
style: TextStyle(
color: Colors.white.withValues(alpha: 0.8),
color: ShadcnTheme.primaryForeground.withValues(alpha: 0.8),
fontSize: 12,
),
),
const SizedBox(height: 4),
Text(
value,
style: const TextStyle(
color: Colors.white,
style: TextStyle(
color: ShadcnTheme.primaryForeground,
fontSize: 16,
fontWeight: FontWeight.bold,
),
@@ -1048,4 +1029,4 @@ class _MaintenanceHistoryScreenState extends State<MaintenanceHistoryScreen>
),
);
}
}
}

View File

@@ -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> {
),
);
}
}
}

View File

@@ -6,6 +6,7 @@ import '../../domain/entities/maintenance_schedule.dart';
import 'controllers/maintenance_controller.dart';
import 'maintenance_form_dialog.dart';
import 'components/maintenance_calendar.dart';
import 'package:superport/screens/common/theme_shadcn.dart';
class MaintenanceScheduleScreen extends StatefulWidget {
const MaintenanceScheduleScreen({super.key});
@@ -42,7 +43,7 @@ class _MaintenanceScheduleScreenState extends State<MaintenanceScheduleScreen>
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[100],
backgroundColor: ShadcnTheme.backgroundSecondary,
body: Column(
children: [
_buildHeader(),
@@ -97,15 +98,8 @@ class _MaintenanceScheduleScreenState extends State<MaintenanceScheduleScreen>
return Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.1),
spreadRadius: 1,
blurRadius: 3,
offset: const Offset(0, 2),
),
],
color: ShadcnTheme.card,
boxShadow: ShadcnTheme.shadowSm,
),
child: Column(
children: [
@@ -128,9 +122,7 @@ class _MaintenanceScheduleScreenState extends State<MaintenanceScheduleScreen>
'${controller.totalCount}건 | '
'예정 ${controller.upcomingCount}건 | '
'지연 ${controller.overdueCount}',
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Colors.grey[600],
),
style: ShadcnTheme.bodySmall.copyWith(color: ShadcnTheme.mutedForeground),
);
},
),
@@ -183,8 +175,8 @@ class _MaintenanceScheduleScreenState extends State<MaintenanceScheduleScreen>
return Container(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
decoration: BoxDecoration(
color: Colors.white,
border: Border(bottom: BorderSide(color: Colors.grey[300]!)),
color: ShadcnTheme.card,
border: Border(bottom: BorderSide(color: ShadcnTheme.border)),
),
child: Row(
children: [
@@ -201,7 +193,7 @@ class _MaintenanceScheduleScreenState extends State<MaintenanceScheduleScreen>
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[300]!),
border: Border.all(color: ShadcnTheme.border),
borderRadius: BorderRadius.circular(8),
),
child: Row(
@@ -464,7 +456,7 @@ class _MaintenanceScheduleScreenState extends State<MaintenanceScheduleScreen>
return Chip(
label: Text(
'${alert.daysUntilDue < 0 ? "지연 " : ""}${alert.daysUntilDue.abs()}',
style: TextStyle(fontSize: 12, color: Colors.white),
style: TextStyle(fontSize: 12, color: ShadcnTheme.primaryForeground),
),
backgroundColor: color,
padding: const EdgeInsets.symmetric(horizontal: 8),