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