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:
@@ -190,6 +190,7 @@ class _UserListState extends State<UserList> {
|
||||
isLoading: _controller.isLoading && _controller.users.isEmpty,
|
||||
error: _controller.error,
|
||||
onRefresh: () => _controller.loadUsers(refresh: true),
|
||||
dataAreaPadding: EdgeInsets.zero,
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -298,55 +299,109 @@ class _UserListState extends State<UserList> {
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: ShadTable.list(
|
||||
header: const [
|
||||
ShadTableCell.header(child: Text('번호')),
|
||||
ShadTableCell.header(child: Text('이름')),
|
||||
ShadTableCell.header(child: Text('이메일')),
|
||||
ShadTableCell.header(child: Text('회사')),
|
||||
ShadTableCell.header(child: Text('권한')),
|
||||
ShadTableCell.header(child: Text('상태')),
|
||||
ShadTableCell.header(child: Text('작업')),
|
||||
],
|
||||
children: [
|
||||
for (int index = 0; index < users.length; index++)
|
||||
[
|
||||
// 번호
|
||||
ShadTableCell(child: Text(((_controller.currentPage - 1) * _controller.pageSize + index + 1).toString(), style: ShadcnTheme.bodySmall)),
|
||||
// 이름
|
||||
ShadTableCell(child: Text(users[index].name, overflow: TextOverflow.ellipsis)),
|
||||
// 이메일
|
||||
ShadTableCell(child: Text(users[index].email ?? '-', overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodySmall)),
|
||||
// 회사
|
||||
ShadTableCell(child: Text(users[index].companyName ?? '-', overflow: TextOverflow.ellipsis)),
|
||||
// 권한
|
||||
ShadTableCell(child: _buildUserRoleBadge(users[index].role)),
|
||||
// 상태
|
||||
ShadTableCell(child: _buildStatusChip(users[index].isActive)),
|
||||
// 작업
|
||||
ShadTableCell(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ShadButton.ghost(
|
||||
onPressed: users[index].id != null ? () => _navigateToEdit(users[index].id!) : null,
|
||||
child: const Icon(Icons.edit, size: 16),
|
||||
),
|
||||
const SizedBox(width: ShadcnTheme.spacing1),
|
||||
ShadButton.ghost(
|
||||
onPressed: () => _showStatusChangeDialog(users[index]),
|
||||
child: Icon(users[index].isActive ? Icons.person_off : Icons.person, size: 16),
|
||||
),
|
||||
const SizedBox(width: ShadcnTheme.spacing1),
|
||||
ShadButton.ghost(
|
||||
onPressed: users[index].id != null ? () => _showDeleteDialog(users[index].id!, users[index].name) : null,
|
||||
child: const Icon(Icons.delete, size: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
// 고정폭 + 마지막 filler 컬럼
|
||||
const double actionsW = 240.0; // 아이콘 3개
|
||||
const double minTableWidth = 64 + 200 + 300 + 200 + 120 + 120 + actionsW + 24;
|
||||
final double tableWidth = constraints.maxWidth >= minTableWidth
|
||||
? constraints.maxWidth
|
||||
: minTableWidth;
|
||||
const double emailColumnWidth = 300.0;
|
||||
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: SizedBox(
|
||||
width: tableWidth,
|
||||
child: ShadTable.list(
|
||||
columnSpanExtent: (index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return const FixedTableSpanExtent(64); // 번호
|
||||
case 1:
|
||||
return const FixedTableSpanExtent(200); // 이름
|
||||
case 2:
|
||||
return const FixedTableSpanExtent(emailColumnWidth); // 이메일
|
||||
case 3:
|
||||
return const FixedTableSpanExtent(200); // 회사
|
||||
case 4:
|
||||
return const FixedTableSpanExtent(120); // 권한
|
||||
case 5:
|
||||
return const FixedTableSpanExtent(120); // 상태
|
||||
case 6:
|
||||
return const FixedTableSpanExtent(actionsW); // 작업
|
||||
case 7:
|
||||
return const RemainingTableSpanExtent(); // filler
|
||||
default:
|
||||
return const FixedTableSpanExtent(100);
|
||||
}
|
||||
},
|
||||
header: [
|
||||
const ShadTableCell.header(child: Text('번호')),
|
||||
const ShadTableCell.header(child: Text('이름')),
|
||||
ShadTableCell.header(child: SizedBox(width: emailColumnWidth, child: const Text('이메일'))),
|
||||
const ShadTableCell.header(child: Text('회사')),
|
||||
const ShadTableCell.header(child: Text('권한')),
|
||||
const ShadTableCell.header(child: Text('상태')),
|
||||
ShadTableCell.header(child: SizedBox(width: actionsW, child: const Text('작업'))),
|
||||
const ShadTableCell.header(child: SizedBox.shrink()),
|
||||
],
|
||||
children: [
|
||||
for (int index = 0; index < users.length; index++)
|
||||
[
|
||||
// 번호
|
||||
ShadTableCell(child: Text(((_controller.currentPage - 1) * _controller.pageSize + index + 1).toString(), style: ShadcnTheme.bodySmall)),
|
||||
// 이름
|
||||
ShadTableCell(child: Text(users[index].name, overflow: TextOverflow.ellipsis)),
|
||||
// 이메일
|
||||
ShadTableCell(
|
||||
child: SizedBox(
|
||||
width: emailColumnWidth,
|
||||
child: Text(users[index].email ?? '-', overflow: TextOverflow.ellipsis, style: ShadcnTheme.bodySmall),
|
||||
),
|
||||
),
|
||||
// 회사
|
||||
ShadTableCell(child: Text(users[index].companyName ?? '-', overflow: TextOverflow.ellipsis)),
|
||||
// 권한
|
||||
ShadTableCell(child: _buildUserRoleBadge(users[index].role)),
|
||||
// 상태
|
||||
ShadTableCell(child: _buildStatusChip(users[index].isActive)),
|
||||
// 작업 (오버플로우 방지)
|
||||
ShadTableCell(
|
||||
child: SizedBox(
|
||||
width: actionsW,
|
||||
child: FittedBox(
|
||||
alignment: Alignment.centerLeft,
|
||||
fit: BoxFit.scaleDown,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ShadButton.ghost(
|
||||
onPressed: users[index].id != null ? () => _navigateToEdit(users[index].id!) : null,
|
||||
child: const Icon(Icons.edit, size: 16),
|
||||
),
|
||||
const SizedBox(width: ShadcnTheme.spacing1),
|
||||
ShadButton.ghost(
|
||||
onPressed: () => _showStatusChangeDialog(users[index]),
|
||||
child: Icon(users[index].isActive ? Icons.person_off : Icons.person, size: 16),
|
||||
),
|
||||
const SizedBox(width: ShadcnTheme.spacing1),
|
||||
ShadButton.ghost(
|
||||
onPressed: users[index].id != null ? () => _showDeleteDialog(users[index].id!, users[index].name) : null,
|
||||
child: const Icon(Icons.delete, size: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const ShadTableCell(child: SizedBox.shrink()),
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -355,8 +410,6 @@ class _UserListState extends State<UserList> {
|
||||
// (Deprecated) 기존 커스텀 테이블 빌더 유틸들은 ShadTable 전환으로 제거되었습니다.
|
||||
|
||||
Widget _buildPagination() {
|
||||
if (_controller.totalPages <= 1) return const SizedBox();
|
||||
|
||||
return Pagination(
|
||||
currentPage: _controller.currentPage,
|
||||
totalCount: _controller.total,
|
||||
|
||||
Reference in New Issue
Block a user