refactor: UI 일관성 개선 및 회사 타입 배지 통일
- 회사 리스트 화면의 배지를 ShadcnBadge 컴포넌트로 통일 - 본사(Blue)와 지점(Purple) 색상 차별화로 시각적 구분 강화 - 고객사(Orange), 파트너사(Green) 색상 체계 개선 - 장비/라이선스 관리 화면과 동일한 배지 스타일 적용 - 불필요한 문서 파일 정리 - 라이선스 만료 요약 모델 업데이트 - 리스트 화면들의 페이지네이션 및 필터링 로직 개선 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,12 @@ import 'package:provider/provider.dart';
|
||||
import 'package:superport/models/warehouse_location_model.dart';
|
||||
import 'package:superport/screens/common/theme_shadcn.dart';
|
||||
import 'package:superport/screens/common/components/shadcn_components.dart';
|
||||
import 'package:superport/screens/common/widgets/pagination.dart';
|
||||
import 'package:superport/screens/common/widgets/unified_search_bar.dart';
|
||||
import 'package:superport/screens/common/widgets/standard_data_table.dart' as std_table;
|
||||
import 'package:superport/screens/common/widgets/standard_action_bar.dart';
|
||||
import 'package:superport/screens/common/widgets/standard_states.dart';
|
||||
import 'package:superport/screens/common/layouts/base_list_screen.dart';
|
||||
import 'package:superport/screens/warehouse_location/controllers/warehouse_location_list_controller.dart';
|
||||
import 'package:superport/utils/constants.dart';
|
||||
|
||||
@@ -97,37 +103,6 @@ class _WarehouseLocationListRedesignState
|
||||
value: _controller,
|
||||
child: Consumer<WarehouseLocationListController>(
|
||||
builder: (context, controller, child) {
|
||||
// 로딩 중일 때
|
||||
if (controller.isLoading && controller.warehouseLocations.isEmpty) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
|
||||
// 에러가 있을 때
|
||||
if (controller.error != null) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.error_outline, size: 48, color: Colors.red),
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
'오류가 발생했습니다',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(controller.error!),
|
||||
SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: _reload,
|
||||
child: Text('다시 시도'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final int totalCount = controller.warehouseLocations.length;
|
||||
final int startIndex = (_currentPage - 1) * _pageSize;
|
||||
final int endIndex =
|
||||
@@ -138,258 +113,223 @@ class _WarehouseLocationListRedesignState
|
||||
? controller.warehouseLocations.sublist(startIndex, endIndex)
|
||||
: [];
|
||||
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(ShadcnTheme.spacing6),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 헤더 액션 바
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('총 ${totalCount}개 입고지', style: ShadcnTheme.bodyMuted),
|
||||
if (controller.searchQuery.isNotEmpty)
|
||||
Text(
|
||||
'"${controller.searchQuery}" 검색 결과',
|
||||
style: ShadcnTheme.bodyMuted.copyWith(fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
ShadcnButton(
|
||||
text: '입고지 추가',
|
||||
onPressed: _navigateToAdd,
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
textColor: Colors.white,
|
||||
icon: Icon(Icons.add),
|
||||
),
|
||||
],
|
||||
),
|
||||
return BaseListScreen(
|
||||
isLoading: controller.isLoading && controller.warehouseLocations.isEmpty,
|
||||
error: controller.error,
|
||||
onRefresh: _reload,
|
||||
emptyMessage:
|
||||
controller.searchQuery.isNotEmpty
|
||||
? '검색 결과가 없습니다'
|
||||
: '등록된 입고지가 없습니다',
|
||||
emptyIcon: Icons.warehouse_outlined,
|
||||
|
||||
const SizedBox(height: ShadcnTheme.spacing4),
|
||||
// 검색바 (기본 비어있음)
|
||||
searchBar: Container(),
|
||||
|
||||
// 테이블 컨테이너
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
// 액션바
|
||||
actionBar: StandardActionBar(
|
||||
leftActions: [
|
||||
ShadcnButton(
|
||||
text: '입고지 추가',
|
||||
onPressed: _navigateToAdd,
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
textColor: Colors.white,
|
||||
icon: Icon(Icons.add),
|
||||
),
|
||||
],
|
||||
totalCount: totalCount,
|
||||
onRefresh: _reload,
|
||||
statusMessage:
|
||||
controller.searchQuery.isNotEmpty
|
||||
? '"${controller.searchQuery}" 검색 결과'
|
||||
: null,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 테이블 헤더
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: ShadcnTheme.spacing4,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.black),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text('번호', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text('입고지명', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Text('주소', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text('비고', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text('관리', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// 테이블 데이터
|
||||
if (controller.isLoading)
|
||||
Container(
|
||||
padding: const EdgeInsets.all(ShadcnTheme.spacing8),
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
CircularProgressIndicator(),
|
||||
SizedBox(height: 8),
|
||||
Text('데이터를 불러오는 중...', style: ShadcnTheme.bodyMuted),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
else if (pagedLocations.isEmpty)
|
||||
Container(
|
||||
padding: const EdgeInsets.all(ShadcnTheme.spacing8),
|
||||
child: Center(
|
||||
child: Text(
|
||||
controller.searchQuery.isNotEmpty
|
||||
? '검색 결과가 없습니다.'
|
||||
: '등록된 입고지가 없습니다.',
|
||||
style: ShadcnTheme.bodyMuted,
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
...pagedLocations.asMap().entries.map((entry) {
|
||||
final int index = entry.key;
|
||||
final WarehouseLocation location = entry.value;
|
||||
// 데이터 테이블
|
||||
dataTable: _buildDataTable(pagedLocations, startIndex),
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: ShadcnTheme.spacing4,
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.black),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
// 번호
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
'${startIndex + index + 1}',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
// 입고지명
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
location.name,
|
||||
style: ShadcnTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
// 주소
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Text(
|
||||
'${location.address.region} ${location.address.detailAddress}',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// 비고
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
location.remark ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// 관리
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: IconButton(
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 30,
|
||||
minHeight: 30,
|
||||
),
|
||||
padding: const EdgeInsets.all(4),
|
||||
icon: Icon(
|
||||
Icons.edit,
|
||||
size: 16,
|
||||
color: ShadcnTheme.primary,
|
||||
),
|
||||
onPressed: () => _navigateToEdit(location),
|
||||
tooltip: '수정',
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: IconButton(
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 30,
|
||||
minHeight: 30,
|
||||
),
|
||||
padding: const EdgeInsets.all(4),
|
||||
icon: Icon(
|
||||
Icons.delete,
|
||||
size: 16,
|
||||
color: ShadcnTheme.destructive,
|
||||
),
|
||||
onPressed: () =>
|
||||
_showDeleteDialog(location.id),
|
||||
tooltip: '삭제',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
],
|
||||
),
|
||||
),
|
||||
// 페이지네이션 (항상 표시)
|
||||
const SizedBox(height: ShadcnTheme.spacing6),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ShadcnButton(
|
||||
text: '이전',
|
||||
onPressed:
|
||||
_currentPage > 1
|
||||
? () {
|
||||
setState(() {
|
||||
_currentPage--;
|
||||
});
|
||||
}
|
||||
: null,
|
||||
variant: ShadcnButtonVariant.secondary,
|
||||
size: ShadcnButtonSize.small,
|
||||
),
|
||||
const SizedBox(width: ShadcnTheme.spacing2),
|
||||
Text(
|
||||
totalCount > 0
|
||||
? '$_currentPage / ${(totalCount / _pageSize).ceil()}'
|
||||
: '1 / 1',
|
||||
style: ShadcnTheme.bodyMuted,
|
||||
),
|
||||
const SizedBox(width: ShadcnTheme.spacing2),
|
||||
ShadcnButton(
|
||||
text: '다음',
|
||||
onPressed:
|
||||
_currentPage < (totalCount / _pageSize).ceil() && totalCount > _pageSize
|
||||
? () {
|
||||
setState(() {
|
||||
_currentPage++;
|
||||
});
|
||||
}
|
||||
: null,
|
||||
variant: ShadcnButtonVariant.secondary,
|
||||
size: ShadcnButtonSize.small,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
// 페이지네이션
|
||||
pagination: totalCount > _pageSize ? Pagination(
|
||||
totalCount: totalCount,
|
||||
currentPage: _currentPage,
|
||||
pageSize: _pageSize,
|
||||
onPageChanged: (page) {
|
||||
setState(() {
|
||||
_currentPage = page;
|
||||
});
|
||||
},
|
||||
) : null,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 데이터 테이블
|
||||
Widget _buildDataTable(List<WarehouseLocation> pagedLocations, int startIndex) {
|
||||
if (pagedLocations.isEmpty) {
|
||||
return StandardEmptyState(
|
||||
title:
|
||||
_controller.searchQuery.isNotEmpty
|
||||
? '검색 결과가 없습니다'
|
||||
: '등록된 입고지가 없습니다',
|
||||
icon: Icons.warehouse_outlined,
|
||||
action:
|
||||
_controller.searchQuery.isEmpty
|
||||
? StandardActionButtons.addButton(
|
||||
text: '첫 입고지 추가하기',
|
||||
onPressed: _navigateToAdd,
|
||||
)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 테이블 헤더
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: ShadcnTheme.spacing4,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.black),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text('번호', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text('입고지명', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Text('주소', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text('비고', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text('관리', style: ShadcnTheme.bodyMedium),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// 테이블 데이터
|
||||
...pagedLocations.asMap().entries.map((entry) {
|
||||
final int index = entry.key;
|
||||
final WarehouseLocation location = entry.value;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: ShadcnTheme.spacing4,
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.black),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
// 번호
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
'${startIndex + index + 1}',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
// 입고지명
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
location.name,
|
||||
style: ShadcnTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
// 주소
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Text(
|
||||
'${location.address.region} ${location.address.detailAddress}',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// 비고
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
location.remark ?? '-',
|
||||
style: ShadcnTheme.bodySmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// 관리
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: IconButton(
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 30,
|
||||
minHeight: 30,
|
||||
),
|
||||
padding: const EdgeInsets.all(4),
|
||||
icon: Icon(
|
||||
Icons.edit,
|
||||
size: 16,
|
||||
color: ShadcnTheme.primary,
|
||||
),
|
||||
onPressed: () => _navigateToEdit(location),
|
||||
tooltip: '수정',
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: IconButton(
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 30,
|
||||
minHeight: 30,
|
||||
),
|
||||
padding: const EdgeInsets.all(4),
|
||||
icon: Icon(
|
||||
Icons.delete,
|
||||
size: 16,
|
||||
color: ShadcnTheme.destructive,
|
||||
),
|
||||
onPressed: () =>
|
||||
_showDeleteDialog(location.id),
|
||||
tooltip: '삭제',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user