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:
@@ -52,7 +52,7 @@ class _AppLayoutState extends State<AppLayout>
|
||||
static const double _sidebarExpandedWidth = 260.0;
|
||||
static const double _sidebarCollapsedWidth = 72.0;
|
||||
static const double _headerHeight = 64.0;
|
||||
static const double _maxContentWidth = 1440.0;
|
||||
static const double _maxContentWidth = 1600.0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -313,8 +313,9 @@ class _AppLayoutState extends State<AppLayout>
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Container(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: isWideScreen ? _maxContentWidth : double.infinity,
|
||||
// 최대 폭 제한을 해제하여(=무한대) 사이드바를 제외한 남은 전폭을 모두 사용
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: double.infinity,
|
||||
),
|
||||
padding: EdgeInsets.all(
|
||||
isWideScreen ? ShadcnTheme.spacing6 : ShadcnTheme.spacing4
|
||||
@@ -1267,13 +1268,13 @@ class SidebarMenu extends StatelessWidget {
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.orange,
|
||||
color: ShadcnTheme.warning,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Text(
|
||||
badge,
|
||||
style: ShadcnTheme.caption.copyWith(
|
||||
color: Colors.white,
|
||||
color: ShadcnTheme.primaryForeground,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
@@ -1390,4 +1391,4 @@ class SidebarMenu extends StatelessWidget {
|
||||
return outlinedIcon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ class BaseListScreen extends StatelessWidget {
|
||||
final VoidCallback? onRefresh;
|
||||
final String emptyMessage;
|
||||
final IconData emptyIcon;
|
||||
// 데이터 테이블 영역 좌우 패딩(기본: spacing6). 화면별로 전체폭 사용이 필요할 경우 0으로 설정.
|
||||
final EdgeInsetsGeometry dataAreaPadding;
|
||||
|
||||
const BaseListScreen({
|
||||
super.key,
|
||||
@@ -30,6 +32,8 @@ class BaseListScreen extends StatelessWidget {
|
||||
this.onRefresh,
|
||||
this.emptyMessage = '데이터가 없습니다',
|
||||
this.emptyIcon = Icons.inbox_outlined,
|
||||
// 기본값을 0으로 설정해 테이블 영역이 가용 폭을 모두 사용하도록 함
|
||||
this.dataAreaPadding = EdgeInsets.zero,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -78,7 +82,7 @@ class BaseListScreen extends StatelessWidget {
|
||||
// 데이터 테이블 - 헤더 고정, 바디만 스크롤
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: ShadcnTheme.spacing6),
|
||||
padding: dataAreaPadding,
|
||||
child: dataTable,
|
||||
),
|
||||
),
|
||||
@@ -125,7 +129,7 @@ class BaseListScreen extends StatelessWidget {
|
||||
onPressed: onRefresh,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: ShadcnTheme.primary,
|
||||
foregroundColor: Colors.white,
|
||||
foregroundColor: ShadcnTheme.primaryForeground,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
@@ -153,4 +157,4 @@ class BaseListScreen extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class FormLayoutTemplate extends StatelessWidget {
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
title,
|
||||
style: ShadcnTheme.headingH3.copyWith( // Phase 10: 표준 헤딩 스타일
|
||||
style: ShadcnTheme.headingH3.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: ShadcnTheme.foreground,
|
||||
),
|
||||
@@ -76,7 +76,7 @@ class FormLayoutTemplate extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
padding: EdgeInsets.fromLTRB(24, 16, 24, 24),
|
||||
padding: const EdgeInsets.fromLTRB(24, 16, 24, 24),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -122,30 +122,30 @@ class FormSection extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ShadcnCard(
|
||||
padding: padding ?? EdgeInsets.all(24),
|
||||
padding: padding ?? const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (title != null) ...[
|
||||
Text(
|
||||
title!,
|
||||
style: ShadcnTheme.bodyLarge.copyWith( // Phase 10: 표준 바디 라지
|
||||
style: ShadcnTheme.bodyLarge.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: ShadcnTheme.foreground, // Phase 10: 전경색
|
||||
color: ShadcnTheme.foreground,
|
||||
),
|
||||
),
|
||||
if (subtitle != null) ...[
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
subtitle!,
|
||||
style: ShadcnTheme.bodyMedium.copyWith( // Phase 10: 표준 바디 미디엄
|
||||
color: ShadcnTheme.mutedForeground, // Phase 10: 뮤트된 전경색
|
||||
style: ShadcnTheme.bodyMedium.copyWith(
|
||||
color: ShadcnTheme.mutedForeground,
|
||||
),
|
||||
),
|
||||
],
|
||||
SizedBox(height: 20),
|
||||
Divider(color: ShadcnTheme.border, height: 1), // Phase 10: 테두리 색상
|
||||
SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
Divider(color: ShadcnTheme.border, height: 1),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
if (children.isNotEmpty)
|
||||
...children.asMap().entries.map((entry) {
|
||||
@@ -153,7 +153,7 @@ class FormSection extends StatelessWidget {
|
||||
final child = entry.value;
|
||||
if (index < children.length - 1) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: 16),
|
||||
padding: const EdgeInsets.only(bottom: 16),
|
||||
child: child,
|
||||
);
|
||||
} else {
|
||||
@@ -190,33 +190,23 @@ class FormFieldWrapper extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF374151),
|
||||
),
|
||||
style: ShadcnTheme.labelMedium,
|
||||
),
|
||||
if (required)
|
||||
Text(
|
||||
' *',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFFEF4444),
|
||||
),
|
||||
style: ShadcnTheme.labelMedium.copyWith(color: ShadcnTheme.destructive),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (hint != null) ...[
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
hint!,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF6B7280),
|
||||
),
|
||||
style: ShadcnTheme.bodyXs,
|
||||
),
|
||||
],
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
child,
|
||||
],
|
||||
);
|
||||
@@ -236,10 +226,10 @@ class UIConstants {
|
||||
static const double columnWidthLarge = 200.0; // 긴 텍스트
|
||||
|
||||
// 색상
|
||||
static const Color backgroundColor = Color(0xFFF5F7FA);
|
||||
static const Color cardBackground = Colors.white;
|
||||
static const Color borderColor = Color(0xFFE5E7EB);
|
||||
static const Color textPrimary = Color(0xFF1A1F36);
|
||||
static const Color textSecondary = Color(0xFF6B7280);
|
||||
static const Color textMuted = Color(0xFF9CA3AF);
|
||||
}
|
||||
static const Color backgroundColor = ShadcnTheme.backgroundSecondary;
|
||||
static const Color cardBackground = ShadcnTheme.card;
|
||||
static const Color borderColor = ShadcnTheme.border;
|
||||
static const Color textPrimary = ShadcnTheme.foreground;
|
||||
static const Color textSecondary = ShadcnTheme.foregroundSecondary;
|
||||
static const Color textMuted = ShadcnTheme.foregroundMuted;
|
||||
}
|
||||
|
||||
@@ -132,21 +132,14 @@ class _AddressInputState extends State<AddressInput> {
|
||||
showWhenUnlinked: false,
|
||||
offset: const Offset(0, 45),
|
||||
child: Material(
|
||||
elevation: 4,
|
||||
elevation: 0,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border.all(color: Colors.grey.shade300),
|
||||
color: ShadcnTheme.card,
|
||||
border: Border.all(color: ShadcnTheme.border),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withValues(alpha: 0.3),
|
||||
spreadRadius: 1,
|
||||
blurRadius: 3,
|
||||
offset: const Offset(0, 1),
|
||||
),
|
||||
],
|
||||
boxShadow: ShadcnTheme.shadowSm,
|
||||
),
|
||||
constraints: BoxConstraints(maxHeight: maxHeight),
|
||||
child: SingleChildScrollView(
|
||||
@@ -244,7 +237,7 @@ class _AddressInputState extends State<AddressInput> {
|
||||
color:
|
||||
_selectedRegion.isEmpty
|
||||
? Colors.grey.shade600
|
||||
: Colors.black,
|
||||
: ShadcnTheme.foreground,
|
||||
),
|
||||
),
|
||||
const Icon(Icons.arrow_drop_down),
|
||||
|
||||
@@ -22,13 +22,20 @@ class Pagination extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 전체 페이지 수 계산
|
||||
final int totalPages = (totalCount / pageSize).ceil();
|
||||
// 방어적 계산: pageSize, currentPage, totalPages 모두 안전 범위로 보정
|
||||
final int safePageSize = pageSize <= 0 ? 1 : pageSize;
|
||||
final int computedTotalPages = (totalCount / safePageSize).ceil();
|
||||
final int totalPages = computedTotalPages < 1 ? 1 : computedTotalPages;
|
||||
final int current = currentPage < 1
|
||||
? 1
|
||||
: (currentPage > totalPages ? totalPages : currentPage);
|
||||
|
||||
// 페이지네이션 버튼 최대 10개
|
||||
final int maxButtons = 10;
|
||||
// 시작 페이지 계산
|
||||
int startPage = ((currentPage - 1) ~/ maxButtons) * maxButtons + 1;
|
||||
int endPage = (startPage + maxButtons - 1).clamp(1, totalPages);
|
||||
const int maxButtons = 10;
|
||||
// 시작/끝 페이지 계산
|
||||
int startPage = ((current - 1) ~/ maxButtons) * maxButtons + 1;
|
||||
int endPage = startPage + maxButtons - 1;
|
||||
if (endPage > totalPages) endPage = totalPages;
|
||||
|
||||
List<Widget> pageButtons = [];
|
||||
for (int i = startPage; i <= endPage; i++) {
|
||||
@@ -36,25 +43,25 @@ class Pagination extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: InkWell(
|
||||
onTap: i == currentPage ? null : () => onPageChanged(i),
|
||||
onTap: i == current ? null : () => onPageChanged(i),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
child: Container(
|
||||
height: 32,
|
||||
constraints: const BoxConstraints(minWidth: 32),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: i == currentPage ? ShadcnTheme.primary : Colors.transparent,
|
||||
color: i == current ? ShadcnTheme.primary : Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
border: Border.all(
|
||||
color: i == currentPage ? ShadcnTheme.primary : Colors.black,
|
||||
color: i == currentPage ? ShadcnTheme.primary : ShadcnTheme.border,
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'$i',
|
||||
style: ShadcnTheme.labelMedium.copyWith(
|
||||
color: i == currentPage
|
||||
? ShadcnTheme.primaryForeground
|
||||
color: i == current
|
||||
? ShadcnTheme.primaryForeground
|
||||
: ShadcnTheme.foreground,
|
||||
),
|
||||
),
|
||||
@@ -73,14 +80,14 @@ class Pagination extends StatelessWidget {
|
||||
_buildNavigationButton(
|
||||
icon: Icons.first_page,
|
||||
tooltip: '처음',
|
||||
onPressed: currentPage > 1 ? () => onPageChanged(1) : null,
|
||||
onPressed: current > 1 ? () => onPageChanged(1) : null,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
// 이전 페이지로 이동
|
||||
_buildNavigationButton(
|
||||
icon: Icons.chevron_left,
|
||||
tooltip: '이전',
|
||||
onPressed: currentPage > 1 ? () => onPageChanged(currentPage - 1) : null,
|
||||
onPressed: current > 1 ? () => onPageChanged(current - 1) : null,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
// 페이지 번호 버튼들
|
||||
@@ -90,8 +97,8 @@ class Pagination extends StatelessWidget {
|
||||
_buildNavigationButton(
|
||||
icon: Icons.chevron_right,
|
||||
tooltip: '다음',
|
||||
onPressed: currentPage < totalPages
|
||||
? () => onPageChanged(currentPage + 1)
|
||||
onPressed: current < totalPages
|
||||
? () => onPageChanged(current + 1)
|
||||
: null,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
@@ -99,7 +106,7 @@ class Pagination extends StatelessWidget {
|
||||
_buildNavigationButton(
|
||||
icon: Icons.last_page,
|
||||
tooltip: '마짉',
|
||||
onPressed: currentPage < totalPages ? () => onPageChanged(totalPages) : null,
|
||||
onPressed: current < totalPages ? () => onPageChanged(totalPages) : null,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -123,7 +130,7 @@ class Pagination extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
border: Border.all(
|
||||
color: isDisabled ? ShadcnTheme.muted : Colors.black,
|
||||
color: isDisabled ? ShadcnTheme.muted : ShadcnTheme.border,
|
||||
),
|
||||
),
|
||||
child: Icon(
|
||||
|
||||
@@ -141,7 +141,7 @@ class StandardActionButtons {
|
||||
text: text,
|
||||
onPressed: onPressed,
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
textColor: Colors.white,
|
||||
textColor: ShadcnTheme.primaryForeground,
|
||||
icon: Icon(icon, size: 16),
|
||||
);
|
||||
}
|
||||
@@ -237,7 +237,7 @@ class StandardFilterDropdown<T> extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.card,
|
||||
border: Border.all(color: Colors.black),
|
||||
border: Border.all(color: ShadcnTheme.border),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
child: DropdownButtonHideUnderline(
|
||||
@@ -252,4 +252,4 @@ class StandardFilterDropdown<T> extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ class StandardDataRow extends StatelessWidget {
|
||||
? ShadcnTheme.muted.withValues(alpha: 0.1)
|
||||
: null,
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.black),
|
||||
bottom: BorderSide(color: ShadcnTheme.border),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
@@ -418,4 +418,4 @@ class StandardActionButtons extends StatelessWidget {
|
||||
tooltip: tooltip,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,13 +76,13 @@ class StandardErrorState extends StatelessWidget {
|
||||
],
|
||||
if (onRetry != null) ...[
|
||||
const SizedBox(height: ShadcnTheme.spacing6),
|
||||
ShadcnButton(
|
||||
text: '다시 시도',
|
||||
onPressed: onRetry,
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
textColor: Colors.white,
|
||||
icon: const Icon(Icons.refresh, size: 16),
|
||||
),
|
||||
ShadcnButton(
|
||||
text: '다시 시도',
|
||||
onPressed: onRetry,
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
textColor: ShadcnTheme.primaryForeground,
|
||||
icon: const Icon(Icons.refresh, size: 16),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
@@ -185,10 +185,7 @@ class StandardInfoMessage extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Text(
|
||||
message,
|
||||
style: TextStyle(
|
||||
color: displayColor,
|
||||
fontSize: 14,
|
||||
),
|
||||
style: ShadcnTheme.bodySmall.copyWith(color: displayColor),
|
||||
),
|
||||
),
|
||||
if (onClose != null)
|
||||
@@ -235,14 +232,8 @@ class StandardStatCard extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.card,
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
border: Border.all(color: Colors.black),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
border: Border.all(color: ShadcnTheme.border),
|
||||
boxShadow: ShadcnTheme.shadowSm,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -294,4 +285,4 @@ class StandardStatCard extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class UnifiedSearchBar extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.card,
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
border: Border.all(color: Colors.black),
|
||||
border: Border.all(color: ShadcnTheme.border),
|
||||
),
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
@@ -77,7 +77,7 @@ class UnifiedSearchBar extends StatelessWidget {
|
||||
text: '검색',
|
||||
onPressed: onSearch,
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
textColor: Colors.white,
|
||||
textColor: ShadcnTheme.primaryForeground,
|
||||
icon: const Icon(Icons.search, size: 16),
|
||||
),
|
||||
),
|
||||
@@ -106,4 +106,4 @@ class UnifiedSearchBar extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user