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

@@ -155,46 +155,7 @@ class _AdministratorListState extends State<AdministratorList> {
);
}
/// 데이터 테이블 컬럼 정의
List<DataColumn> get _columns => [
const DataColumn(label: Text('이름')),
const DataColumn(label: Text('이메일')),
const DataColumn(label: Text('전화번호')),
const DataColumn(label: Text('휴대폰')),
const DataColumn(label: Text('작업')),
];
/// 데이터 테이블 행 생성
List<DataRow> _buildRows(List<AdministratorDto> administrators) {
return administrators.map((admin) {
return DataRow(
cells: [
DataCell(Text(admin.name)),
DataCell(Text(admin.email)),
DataCell(Text(admin.phone)),
DataCell(Text(admin.mobile)),
DataCell(
Row(
mainAxisSize: MainAxisSize.min,
children: [
ShadButton.ghost(
size: ShadButtonSize.sm,
onPressed: () => _showEditDialog(admin),
child: const Icon(Icons.edit, size: 16),
),
const SizedBox(width: 4),
ShadButton.ghost(
size: ShadButtonSize.sm,
onPressed: () => _showDeleteDialog(admin),
child: const Icon(Icons.delete, size: 16, color: Colors.red),
),
],
),
),
],
);
}).toList();
}
// 기존 DataTable 구현 제거 (ShadTable.list로 이식)
@override
Widget build(BuildContext context) {
@@ -333,52 +294,113 @@ class _AdministratorListState extends State<AdministratorList> {
),
),
// Data Table
// Data Table (ShadTable.list)
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ShadCard(
child: controller.administrators.isEmpty
? const Padding(
padding: EdgeInsets.all(64),
child: Center(
child: Column(
children: [
Icon(Icons.inbox, size: 64, color: Colors.grey),
SizedBox(height: 16),
Text(
'관리자가 없습니다',
style: TextStyle(fontSize: 18, color: Colors.grey),
),
],
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ShadCard(
child: controller.administrators.isEmpty
? const Padding(
padding: EdgeInsets.all(64),
child: Center(
child: Column(
children: [
Icon(Icons.inbox, size: 64, color: Colors.grey),
SizedBox(height: 16),
Text('관리자가 없습니다', style: TextStyle(fontSize: 18, color: Colors.grey)),
],
),
)
: DataTable(
columns: _columns,
rows: _buildRows(controller.administrators),
columnSpacing: 24,
headingRowHeight: 56,
dataRowMinHeight: 48,
dataRowMaxHeight: 56,
),
),
)
: LayoutBuilder(
builder: (context, constraints) {
// 최소 폭 추정: 이름(160) + 이메일(260) + 전화(160) + 휴대폰(160) + 작업(160) + 여백(24)
const double minW = 160 + 260 + 160 + 160 + 160 + 24;
final double tableW = constraints.maxWidth >= minW ? constraints.maxWidth : minW;
const double emailBase = 260.0;
final double emailW = emailBase; // 고정 폭, 남는 폭은 filler가 흡수
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: SizedBox(
width: tableW,
child: ShadTable.list(
columnSpanExtent: (index) {
switch (index) {
case 0:
return const FixedTableSpanExtent(160); // 이름
case 1:
return FixedTableSpanExtent(emailW); // 이메일
case 2:
return const FixedTableSpanExtent(160); // 전화
case 3:
return const FixedTableSpanExtent(160); // 휴대폰
case 4:
return const FixedTableSpanExtent(160); // 작업
case 5:
return const RemainingTableSpanExtent(); // filler
default:
return const FixedTableSpanExtent(100);
}
},
header: [
const ShadTableCell.header(child: Text('이름')),
ShadTableCell.header(child: SizedBox(width: emailW, child: const Text('이메일'))),
const ShadTableCell.header(child: Text('전화번호')),
const ShadTableCell.header(child: Text('휴대폰')),
const ShadTableCell.header(child: Text('작업')),
const ShadTableCell.header(child: SizedBox.shrink()),
],
children: controller.administrators.map((admin) {
return [
ShadTableCell(child: Text(admin.name, overflow: TextOverflow.ellipsis)),
ShadTableCell(
child: SizedBox(
width: emailW,
child: Text(admin.email, overflow: TextOverflow.ellipsis)),
),
ShadTableCell(child: Text(admin.phone, overflow: TextOverflow.ellipsis)),
ShadTableCell(child: Text(admin.mobile, overflow: TextOverflow.ellipsis)),
ShadTableCell(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
ShadButton.ghost(
size: ShadButtonSize.sm,
onPressed: () => _showEditDialog(admin),
child: const Icon(Icons.edit, size: 16),
),
const SizedBox(width: 4),
ShadButton.ghost(
size: ShadButtonSize.sm,
onPressed: () => _showDeleteDialog(admin),
child: const Icon(Icons.delete, size: 16, color: Colors.red),
),
],
),
),
const ShadTableCell(child: SizedBox.shrink()),
];
}).toList(),
),
),
);
},
),
),
),
),
// Pagination
if (controller.totalPages > 1)
Padding(
padding: const EdgeInsets.all(16),
child: Pagination(
totalCount: controller.totalCount,
currentPage: controller.currentPage,
pageSize: controller.pageSize,
onPageChanged: (page) => controller.goToPage(page),
),
// Pagination (항상 표시)
Padding(
padding: const EdgeInsets.all(16),
child: Pagination(
totalCount: controller.totalCount,
currentPage: controller.currentPage,
pageSize: controller.pageSize,
onPageChanged: (page) => controller.goToPage(page),
),
),
],
);
},