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:
@@ -4,6 +4,11 @@ import 'package:superport/models/license_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/license/controllers/license_list_controller.dart';
|
||||
import 'package:superport/utils/constants.dart';
|
||||
import 'package:superport/services/mock_data_service.dart';
|
||||
@@ -244,26 +249,31 @@ class _LicenseListRedesignState extends State<LicenseListRedesign> {
|
||||
value: _controller,
|
||||
child: Consumer<LicenseListController>(
|
||||
builder: (context, controller, child) {
|
||||
return Container(
|
||||
color: ShadcnTheme.background,
|
||||
child: Column(
|
||||
children: [
|
||||
// 상단 통계 카드
|
||||
_buildStatisticsCards(),
|
||||
|
||||
// 필터 및 액션 바
|
||||
_buildFilterBar(),
|
||||
|
||||
// 라이선스 테이블
|
||||
Expanded(
|
||||
child: controller.isLoading && controller.licenses.isEmpty
|
||||
? _buildLoadingState()
|
||||
: controller.error != null
|
||||
? _buildErrorState()
|
||||
: _buildLicenseTable(),
|
||||
),
|
||||
],
|
||||
),
|
||||
final licenses = controller.licenses;
|
||||
final totalCount = licenses.length;
|
||||
|
||||
return BaseListScreen(
|
||||
headerSection: _buildStatisticsCards(),
|
||||
searchBar: _buildSearchBar(),
|
||||
actionBar: _buildActionBar(),
|
||||
dataTable: _buildDataTable(),
|
||||
pagination: totalCount > _pageSize
|
||||
? Pagination(
|
||||
totalCount: totalCount,
|
||||
currentPage: _currentPage,
|
||||
pageSize: _pageSize,
|
||||
onPageChanged: (page) {
|
||||
setState(() {
|
||||
_currentPage = page;
|
||||
});
|
||||
},
|
||||
)
|
||||
: null,
|
||||
isLoading: controller.isLoading && controller.licenses.isEmpty,
|
||||
error: controller.error,
|
||||
onRefresh: () => _controller.loadData(),
|
||||
emptyMessage: '등록된 라이선스가 없습니다',
|
||||
emptyIcon: Icons.description_outlined,
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -351,267 +361,168 @@ class _LicenseListRedesignState extends State<LicenseListRedesign> {
|
||||
);
|
||||
}
|
||||
|
||||
/// 필터 바
|
||||
Widget _buildFilterBar() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
children: [
|
||||
// 검색 및 필터 섹션
|
||||
Row(
|
||||
children: [
|
||||
// 검색 입력
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.card,
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
border: Border.all(color: Colors.black),
|
||||
),
|
||||
child: TextField(
|
||||
controller: _searchController,
|
||||
onSubmitted: (_) => _onSearch(),
|
||||
decoration: InputDecoration(
|
||||
hintText: '제품명, 라이선스 키, 벤더명, 현위치 검색...',
|
||||
hintStyle: TextStyle(color: ShadcnTheme.mutedForeground.withValues(alpha: 0.8), fontSize: 14),
|
||||
prefixIcon: Icon(Icons.search, color: ShadcnTheme.muted, size: 20),
|
||||
border: InputBorder.none,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
),
|
||||
style: ShadcnTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
/// 검색바
|
||||
Widget _buildSearchBar() {
|
||||
return Row(
|
||||
children: [
|
||||
// 검색 입력
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.card,
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
border: Border.all(color: Colors.black),
|
||||
),
|
||||
child: TextField(
|
||||
controller: _searchController,
|
||||
onSubmitted: (_) => _onSearch(),
|
||||
decoration: InputDecoration(
|
||||
hintText: '제품명, 라이선스 키, 벤더명, 현위치 검색...',
|
||||
hintStyle: TextStyle(color: ShadcnTheme.mutedForeground.withValues(alpha: 0.8), fontSize: 14),
|
||||
prefixIcon: Icon(Icons.search, color: ShadcnTheme.muted, size: 20),
|
||||
border: InputBorder.none,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
|
||||
// 검색 버튼
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: ShadcnButton(
|
||||
text: '검색',
|
||||
onPressed: _onSearch,
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
textColor: Colors.white,
|
||||
icon: const Icon(Icons.search, size: 16),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
|
||||
// 상태 필터 드롭다운
|
||||
Container(
|
||||
height: 40,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.card,
|
||||
border: Border.all(color: Colors.black),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
child: DropdownButtonHideUnderline(
|
||||
child: DropdownButton<LicenseStatusFilter>(
|
||||
value: _controller.statusFilter,
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
_controller.changeStatusFilter(value);
|
||||
}
|
||||
},
|
||||
style: TextStyle(fontSize: 14, color: ShadcnTheme.foreground),
|
||||
icon: const Icon(Icons.arrow_drop_down, size: 20),
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: LicenseStatusFilter.all,
|
||||
child: Text('전체'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: LicenseStatusFilter.active,
|
||||
child: Text('활성'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: LicenseStatusFilter.inactive,
|
||||
child: Text('비활성'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: LicenseStatusFilter.expiringSoon,
|
||||
child: Text('만료예정'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: LicenseStatusFilter.expired,
|
||||
child: Text('만료됨'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
style: ShadcnTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 액션 버튼들 및 상태 표시
|
||||
Row(
|
||||
children: [
|
||||
// 액션 버튼들
|
||||
ShadcnButton(
|
||||
text: '유지보수 연장',
|
||||
onPressed: _navigateToAdd,
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
textColor: Colors.white,
|
||||
icon: const Icon(Icons.add, size: 16),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
|
||||
ShadcnButton(
|
||||
text: '삭제',
|
||||
onPressed: _controller.selectedCount > 0 ? _showBulkDeleteDialog : null,
|
||||
variant: _controller.selectedCount > 0
|
||||
? ShadcnButtonVariant.destructive
|
||||
: ShadcnButtonVariant.secondary,
|
||||
icon: const Icon(Icons.delete, size: 16),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
|
||||
ShadcnButton(
|
||||
text: '엑셀 내보내기',
|
||||
onPressed: _showExportInfo,
|
||||
variant: ShadcnButtonVariant.secondary,
|
||||
icon: const Icon(Icons.download, size: 16),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
|
||||
ShadcnButton(
|
||||
text: '엑셀 가져오기',
|
||||
onPressed: _showImportInfo,
|
||||
variant: ShadcnButtonVariant.secondary,
|
||||
icon: const Icon(Icons.upload, size: 16),
|
||||
),
|
||||
|
||||
const Spacer(),
|
||||
|
||||
// 선택 및 총 개수 표시
|
||||
if (_controller.selectedCount > 0)
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8,
|
||||
horizontal: 16,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.muted.withValues(alpha: 0.3),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusSm),
|
||||
),
|
||||
child: Text(
|
||||
'${_controller.selectedCount}개 선택됨',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
if (_controller.selectedCount > 0) const SizedBox(width: 12),
|
||||
|
||||
Text(
|
||||
'총 ${_controller.licenses.length}개',
|
||||
style: ShadcnTheme.bodyMuted,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
|
||||
// 새로고침 버튼
|
||||
IconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
onPressed: () => _controller.refresh(),
|
||||
tooltip: '새로고침',
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 로딩 상태
|
||||
Widget _buildLoadingState() {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(color: ShadcnTheme.primary),
|
||||
const SizedBox(height: 16),
|
||||
Text('라이선스 데이터를 불러오는 중...', style: ShadcnTheme.bodyMuted),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 에러 상태
|
||||
Widget _buildErrorState() {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.error_outline, size: 48, color: ShadcnTheme.destructive),
|
||||
const SizedBox(height: 16),
|
||||
Text('데이터를 불러오는 중 오류가 발생했습니다.', style: ShadcnTheme.bodyMuted),
|
||||
const SizedBox(height: 8),
|
||||
Text(_controller.error ?? '', style: ShadcnTheme.bodySmall),
|
||||
const SizedBox(height: 16),
|
||||
ShadcnButton(
|
||||
text: '다시 시도',
|
||||
onPressed: () => _controller.refresh(),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
|
||||
// 검색 버튼
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: ShadcnButton(
|
||||
text: '검색',
|
||||
onPressed: _onSearch,
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
textColor: Colors.white,
|
||||
icon: const Icon(Icons.search, size: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
|
||||
// 상태 필터 드롭다운
|
||||
Container(
|
||||
height: 40,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: ShadcnTheme.card,
|
||||
border: Border.all(color: Colors.black),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
child: DropdownButtonHideUnderline(
|
||||
child: DropdownButton<LicenseStatusFilter>(
|
||||
value: _controller.statusFilter,
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
_controller.changeStatusFilter(value);
|
||||
}
|
||||
},
|
||||
style: TextStyle(fontSize: 14, color: ShadcnTheme.foreground),
|
||||
icon: const Icon(Icons.arrow_drop_down, size: 20),
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: LicenseStatusFilter.all,
|
||||
child: Text('전체'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: LicenseStatusFilter.active,
|
||||
child: Text('활성'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: LicenseStatusFilter.inactive,
|
||||
child: Text('비활성'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: LicenseStatusFilter.expiringSoon,
|
||||
child: Text('만료예정'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: LicenseStatusFilter.expired,
|
||||
child: Text('만료됨'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// 라이선스 테이블
|
||||
Widget _buildLicenseTable() {
|
||||
/// 액션 바
|
||||
Widget _buildActionBar() {
|
||||
return StandardActionBar(
|
||||
leftActions: [
|
||||
ShadcnButton(
|
||||
text: '유지보수 연장',
|
||||
onPressed: _navigateToAdd,
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
textColor: Colors.white,
|
||||
icon: const Icon(Icons.add, size: 16),
|
||||
),
|
||||
|
||||
ShadcnButton(
|
||||
text: '삭제',
|
||||
onPressed: _controller.selectedCount > 0 ? _showBulkDeleteDialog : null,
|
||||
variant: _controller.selectedCount > 0
|
||||
? ShadcnButtonVariant.destructive
|
||||
: ShadcnButtonVariant.secondary,
|
||||
icon: const Icon(Icons.delete, size: 16),
|
||||
),
|
||||
|
||||
ShadcnButton(
|
||||
text: '엑셀 내보내기',
|
||||
onPressed: _showExportInfo,
|
||||
variant: ShadcnButtonVariant.secondary,
|
||||
icon: const Icon(Icons.download, size: 16),
|
||||
),
|
||||
|
||||
ShadcnButton(
|
||||
text: '엑셀 가져오기',
|
||||
onPressed: _showImportInfo,
|
||||
variant: ShadcnButtonVariant.secondary,
|
||||
icon: const Icon(Icons.upload, size: 16),
|
||||
),
|
||||
],
|
||||
selectedCount: _controller.selectedCount,
|
||||
totalCount: _controller.licenses.length,
|
||||
onRefresh: () => _controller.refresh(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/// 데이터 테이블
|
||||
Widget _buildDataTable() {
|
||||
final licenses = _controller.licenses;
|
||||
|
||||
if (licenses.isEmpty) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.description_outlined,
|
||||
size: 48,
|
||||
color: ShadcnTheme.mutedForeground,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text('등록된 라이선스가 없습니다.', style: ShadcnTheme.bodyMuted),
|
||||
const SizedBox(height: 16),
|
||||
ShadcnButton(
|
||||
text: '라이선스 추가',
|
||||
onPressed: _navigateToAdd,
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
textColor: Colors.white,
|
||||
icon: const Icon(Icons.add, size: 16),
|
||||
),
|
||||
],
|
||||
return StandardEmptyState(
|
||||
title: '등록된 라이선스가 없습니다',
|
||||
icon: Icons.description_outlined,
|
||||
action: StandardActionButtons.addButton(
|
||||
text: '첫 라이선스 추가하기',
|
||||
onPressed: _navigateToAdd,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final pagedLicenses = _getPagedLicenses();
|
||||
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
children: [
|
||||
// 테이블 컨테이너 (가로 스크롤 지원)
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
controller: _horizontalScrollController,
|
||||
child: Container(
|
||||
constraints: BoxConstraints(
|
||||
minWidth: MediaQuery.of(context).size.width - 48, // padding 고려
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
child: SizedBox(
|
||||
width: 1360, // 모든 컬럼 너비의 합
|
||||
child: Column(
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black),
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
controller: _horizontalScrollController,
|
||||
child: SizedBox(
|
||||
width: 1360, // 모든 컬럼 너비의 합
|
||||
child: Column(
|
||||
children: [
|
||||
// 테이블 헤더
|
||||
Container(
|
||||
@@ -858,24 +769,8 @@ class _LicenseListRedesignState extends State<LicenseListRedesign> {
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// 페이지네이션 컴포넌트 (항상 표시)
|
||||
if (licenses.length > _pageSize)
|
||||
Pagination(
|
||||
totalCount: licenses.length,
|
||||
currentPage: _currentPage,
|
||||
pageSize: _pageSize,
|
||||
onPageChanged: (page) {
|
||||
setState(() {
|
||||
_currentPage = page;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 라이선스 상태 표시 배지
|
||||
|
||||
Reference in New Issue
Block a user