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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user