backup: 사용하지 않는 파일 삭제 전 복구 지점

- 전체 371개 파일 중 82개 미사용 파일 식별
- Phase 1: 33개 파일 삭제 예정 (100% 안전)
- Phase 2: 30개 파일 삭제 검토 예정
- Phase 3: 19개 파일 수동 검토 예정

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
JiWoong Sul
2025-09-02 19:51:40 +09:00
parent 650cd4be55
commit c419f8f458
149 changed files with 12934 additions and 3644 deletions

View File

@@ -1,12 +1,10 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
class ZipcodeSearchFilter extends StatefulWidget {
class ZipcodeSearchFilter extends StatelessWidget {
final Function(String) onSearch;
final Function(String?) onSidoChanged;
final Function(String?) onGuChanged;
final VoidCallback onClearFilters;
final List<String> sidoList;
final List<String> guList;
final String? selectedSido;
@@ -17,72 +15,33 @@ class ZipcodeSearchFilter extends StatefulWidget {
required this.onSearch,
required this.onSidoChanged,
required this.onGuChanged,
required this.onClearFilters,
required this.sidoList,
required this.guList,
this.selectedSido,
this.selectedGu,
});
@override
State<ZipcodeSearchFilter> createState() => _ZipcodeSearchFilterState();
}
class _ZipcodeSearchFilterState extends State<ZipcodeSearchFilter> {
final TextEditingController _searchController = TextEditingController();
final ScrollController _sidoScrollController = ScrollController();
final ScrollController _guScrollController = ScrollController();
Timer? _debounceTimer;
bool _hasFilters = false;
@override
void dispose() {
_searchController.dispose();
_sidoScrollController.dispose();
_guScrollController.dispose();
_debounceTimer?.cancel();
super.dispose();
}
void _onSearchChanged(String value) {
// 디바운스 처리 (300ms)
_debounceTimer?.cancel();
_debounceTimer = Timer(const Duration(milliseconds: 300), () {
widget.onSearch(value);
});
_updateHasFilters();
}
void _onSidoChanged(String? value) {
// 빈 문자열을 null로 변환
final actualValue = (value == '') ? null : value;
widget.onSidoChanged(actualValue);
_updateHasFilters();
final actualValue = (value == '' || value == '전체') ? null : value;
onSidoChanged(actualValue);
}
void _onGuChanged(String? value) {
// 빈 문자열을 null로 변환
final actualValue = (value == '') ? null : value;
widget.onGuChanged(actualValue);
_updateHasFilters();
final actualValue = (value == '' || value == '전체') ? null : value;
onGuChanged(actualValue);
}
void _clearFilters() {
setState(() {
_searchController.clear();
_hasFilters = false;
});
_debounceTimer?.cancel();
widget.onClearFilters();
}
void _updateHasFilters() {
setState(() {
_hasFilters = _searchController.text.isNotEmpty ||
widget.selectedSido != null ||
widget.selectedGu != null;
});
Widget _buildDisabledPlaceholder(String text, ShadThemeData theme) {
return Container(
height: 38,
alignment: Alignment.centerLeft,
padding: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
border: Border.all(color: theme.colorScheme.border),
borderRadius: BorderRadius.circular(6),
),
child: Text(text, style: theme.textTheme.muted),
);
}
@override
@@ -91,69 +50,10 @@ class _ZipcodeSearchFilterState extends State<ZipcodeSearchFilter> {
return Column(
children: [
// 첫 번째 행: 검색 입력
// 첫 번째 행: 2개 드롭다운
Row(
children: [
// 검색 입력
Expanded(
flex: 3,
child: Row(
children: [
Icon(
Icons.search,
size: 18,
color: theme.colorScheme.mutedForeground,
),
const SizedBox(width: 12),
Expanded(
child: ShadInputFormField(
controller: _searchController,
placeholder: const Text('우편번호, 시도, 구/군, 상세주소로 검색'),
onChanged: _onSearchChanged,
),
),
if (_searchController.text.isNotEmpty) ...[
const SizedBox(width: 8),
ShadButton.ghost(
onPressed: () {
_searchController.clear();
_onSearchChanged('');
},
size: ShadButtonSize.sm,
child: Icon(
Icons.clear,
size: 16,
color: theme.colorScheme.mutedForeground,
),
),
],
],
),
),
const SizedBox(width: 16),
// 필터 초기화 버튼
if (_hasFilters)
ShadButton.outline(
onPressed: _clearFilters,
size: ShadButtonSize.sm,
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.filter_alt_off, size: 16),
SizedBox(width: 6),
Text('초기화'),
],
),
),
],
),
const SizedBox(height: 16),
// 두 번째 행: 시도/구 선택
Row(
children: [
// 시도 선택
// 시도 드롭다운
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -165,17 +65,8 @@ class _ZipcodeSearchFilterState extends State<ZipcodeSearchFilter> {
),
),
const SizedBox(height: 6),
widget.sidoList.isEmpty
? Container(
height: 38,
alignment: Alignment.centerLeft,
padding: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
border: Border.all(color: theme.colorScheme.border),
borderRadius: BorderRadius.circular(6),
),
child: Text('로딩 중...', style: theme.textTheme.muted),
)
sidoList.isEmpty
? _buildDisabledPlaceholder('로딩 중...', theme)
: SizedBox(
width: double.infinity,
child: ShadSelect<String>(
@@ -184,20 +75,19 @@ class _ZipcodeSearchFilterState extends State<ZipcodeSearchFilter> {
shrinkWrap: true,
showScrollToBottomChevron: true,
showScrollToTopChevron: true,
scrollController: _sidoScrollController,
onChanged: (value) => _onSidoChanged(value),
onChanged: _onSidoChanged,
options: [
const ShadOption(
value: '',
value: '전체',
child: Text('전체'),
),
...widget.sidoList.map((sido) => ShadOption(
...sidoList.map((sido) => ShadOption(
value: sido,
child: Text(sido),
)),
],
selectedOptionBuilder: (context, value) {
if (value == '') {
if (value == '전체') {
return const Text('전체');
}
return Text(value);
@@ -207,9 +97,10 @@ class _ZipcodeSearchFilterState extends State<ZipcodeSearchFilter> {
],
),
),
const SizedBox(width: 16),
// 구 선택
// 구/군 드롭다운
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -221,17 +112,8 @@ class _ZipcodeSearchFilterState extends State<ZipcodeSearchFilter> {
),
),
const SizedBox(height: 6),
widget.selectedSido == null
? Container(
height: 38,
alignment: Alignment.centerLeft,
padding: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
border: Border.all(color: theme.colorScheme.border),
borderRadius: BorderRadius.circular(6),
),
child: Text('시도를 먼저 선택하세요', style: theme.textTheme.muted),
)
selectedSido == null
? _buildDisabledPlaceholder('시도를 먼저 선택하세요', theme)
: SizedBox(
width: double.infinity,
child: ShadSelect<String>(
@@ -240,20 +122,19 @@ class _ZipcodeSearchFilterState extends State<ZipcodeSearchFilter> {
shrinkWrap: true,
showScrollToBottomChevron: true,
showScrollToTopChevron: true,
scrollController: _guScrollController,
onChanged: (value) => _onGuChanged(value),
onChanged: _onGuChanged,
options: [
const ShadOption(
value: '',
value: '전체',
child: Text('전체'),
),
...widget.guList.map((gu) => ShadOption(
...guList.map((gu) => ShadOption(
value: gu,
child: Text(gu),
)),
],
selectedOptionBuilder: (context, value) {
if (value == '') {
if (value == '전체') {
return const Text('전체');
}
return Text(value);
@@ -263,35 +144,24 @@ class _ZipcodeSearchFilterState extends State<ZipcodeSearchFilter> {
],
),
),
const SizedBox(width: 16),
// 빠른 검색 팁
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: theme.colorScheme.accent.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: theme.colorScheme.accent.withValues(alpha: 0.2),
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.tips_and_updates_outlined,
size: 16,
color: theme.colorScheme.accent,
),
const SizedBox(width: 6),
Text(
'팁: 우편번호나 동네 이름으로 빠르게 검색하세요',
style: theme.textTheme.small.copyWith(
color: theme.colorScheme.accent,
fontSize: 11,
),
),
],
],
),
const SizedBox(height: 16),
// 두 번째 행: 텍스트 검색
Row(
children: [
Icon(
Icons.search,
size: 18,
color: theme.colorScheme.mutedForeground,
),
const SizedBox(width: 12),
Expanded(
child: ShadInputFormField(
placeholder: const Text('동/읍/면, 상세주소 검색'),
onChanged: onSearch, // 실시간 검색 (디바운스 없음)
),
),
],

View File

@@ -1,9 +1,8 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:injectable/injectable.dart';
import 'package:superport/data/models/zipcode_dto.dart';
import 'package:superport/domain/usecases/zipcode_usecase.dart';
import 'package:superport/utils/constants.dart';
import 'package:superport/core/constants/app_constants.dart';
@injectable
class ZipcodeController extends ChangeNotifier {
@@ -11,7 +10,7 @@ class ZipcodeController extends ChangeNotifier {
ZipcodeController(this._zipcodeUseCase);
// 상태 변수들
// 핵심 상태만 유지
List<ZipcodeDto> _zipcodes = [];
ZipcodeDto? _selectedZipcode;
bool _isLoading = false;
@@ -21,20 +20,17 @@ class ZipcodeController extends ChangeNotifier {
int _currentPage = 1;
int _totalPages = 1;
int _totalCount = 0;
final int _pageSize = PaginationConstants.defaultPageSize;
final int _pageSize = AppConstants.defaultPageSize;
// 검색 및 필터
String _searchQuery = '';
// 단순한 필터 (2개 드롭다운 + 1개 텍스트)
String? _selectedSido;
String? _selectedGu;
String? _selectedGu;
String _searchQuery = '';
// 시도/구 목록 캐시
// Hierarchy 데이터 (단 2개만)
List<String> _sidoList = [];
List<String> _guList = [];
// 디바운스를 위한 타이머
Timer? _debounceTimer;
// Getters
List<ZipcodeDto> get zipcodes => _zipcodes;
ZipcodeDto? get selectedZipcode => _selectedZipcode;
@@ -51,20 +47,20 @@ class ZipcodeController extends ChangeNotifier {
bool get hasNextPage => _currentPage < _totalPages;
bool get hasPreviousPage => _currentPage > 1;
// 초기 데이터 로드
// 초기화 (단순함)
Future<void> initialize() async {
try {
_isLoading = true;
_setLoading(true);
_zipcodes = [];
_selectedZipcode = null;
_errorMessage = null;
notifyListeners();
// 시도 목록 로드
// 시도 목록 로드 (Hierarchy API만 사용)
await _loadSidoList();
// 초기 우편번호 목록 로드 (첫 페이지)
await searchZipcodes();
await _executeSearch();
} catch (e) {
_errorMessage = '초기화 중 오류가 발생했습니다.';
_isLoading = false;
@@ -72,8 +68,94 @@ class ZipcodeController extends ChangeNotifier {
}
}
// 우편번호 검색
Future<void> searchZipcodes({bool refresh = false}) async {
// 시도 선택 (단순함)
Future<void> setSido(String? sido) async {
try {
_selectedSido = sido;
_selectedGu = null; // 구 초기화
_guList = [];
notifyListeners();
// 선택된 시도의 구 목록 로드
if (sido != null && sido.isNotEmpty) {
await _loadGuListBySido(sido);
}
// 실시간 검색 실행
await _executeSearch();
} catch (e) {
debugPrint('시도 선택 오류: $e');
}
}
// 구 선택 (단순함)
Future<void> setGu(String? gu) async {
try {
_selectedGu = gu;
notifyListeners();
// 실시간 검색 실행
await _executeSearch();
} catch (e) {
debugPrint('구 선택 오류: $e');
}
}
// 검색어 설정 (실시간, 디바운스 없음)
void setSearchQuery(String query) {
_searchQuery = query;
notifyListeners();
_executeSearch(); // 실시간 검색
}
// 필터 초기화 (단순함)
Future<void> clearFilters() async {
_searchQuery = '';
_selectedSido = null;
_selectedGu = null;
_guList = [];
_currentPage = 1;
notifyListeners();
await _executeSearch();
}
// 페이지 이동
Future<void> goToPage(int page) async {
if (page < 1 || page > _totalPages) return;
_currentPage = page;
await _executeSearch();
}
// 다음 페이지
Future<void> nextPage() async {
if (hasNextPage) {
await goToPage(_currentPage + 1);
}
}
// 이전 페이지
Future<void> previousPage() async {
if (hasPreviousPage) {
await goToPage(_currentPage - 1);
}
}
// 우편번호 선택
void selectZipcode(ZipcodeDto zipcode) {
_selectedZipcode = zipcode;
notifyListeners();
}
// 선택 초기화
void clearSelection() {
_selectedZipcode = null;
notifyListeners();
}
// 검색 실행 (핵심 로직)
Future<void> _executeSearch({bool refresh = false}) async {
if (refresh) {
_currentPage = 1;
}
@@ -103,154 +185,35 @@ class ZipcodeController extends ChangeNotifier {
}
}
// 특정 우편번호로 정확한 주소 조회
Future<void> getZipcodeByNumber(int zipcode) async {
_setLoading(true);
_clearError();
try {
_selectedZipcode = await _zipcodeUseCase.getZipcodeByNumber(zipcode);
notifyListeners();
} catch (e) {
_setError('우편번호 조회에 실패했습니다: ${e.toString()}');
} finally {
_setLoading(false);
}
}
// 주소로 우편번호 빠른 검색
Future<List<ZipcodeDto>> quickSearchByAddress(String address) async {
if (address.trim().isEmpty) return [];
try {
return await _zipcodeUseCase.searchByAddress(address);
} catch (e) {
return [];
}
}
// 검색어 설정 (디바운스 적용)
void setSearchQuery(String query) {
_searchQuery = query;
notifyListeners();
// 디바운스 처리 (500ms 대기 후 검색 실행)
_debounceTimer?.cancel();
_debounceTimer = Timer(const Duration(milliseconds: 500), () {
searchZipcodes(refresh: true);
});
}
// 즉시 검색 실행 (디바운스 무시)
Future<void> executeSearch() async {
_debounceTimer?.cancel();
_currentPage = 1;
await searchZipcodes();
}
// 시도 선택
Future<void> setSido(String? sido) async {
try {
_selectedSido = sido;
_selectedGu = null; // 시도 변경 시 구 초기화
_guList = []; // 구 목록 초기화
notifyListeners();
// 선택된 시도에 따른 구 목록 로드
if (sido != null && sido.isNotEmpty) {
await _loadGuListBySido(sido);
}
// 검색 새로고침
await searchZipcodes(refresh: true);
} catch (e) {
debugPrint('시도 선택 오류: $e');
}
}
// 구 선택
Future<void> setGu(String? gu) async {
try {
_selectedGu = gu;
notifyListeners();
// 검색 새로고침
await searchZipcodes(refresh: true);
} catch (e) {
debugPrint('구 선택 오류: $e');
}
}
// 필터 초기화
Future<void> clearFilters() async {
_searchQuery = '';
_selectedSido = null;
_selectedGu = null;
_guList = [];
_currentPage = 1;
notifyListeners();
await searchZipcodes();
}
// 페이지 이동
Future<void> goToPage(int page) async {
if (page < 1 || page > _totalPages) return;
_currentPage = page;
await searchZipcodes();
}
// 다음 페이지
Future<void> nextPage() async {
if (hasNextPage) {
await goToPage(_currentPage + 1);
}
}
// 이전 페이지
Future<void> previousPage() async {
if (hasPreviousPage) {
await goToPage(_currentPage - 1);
}
}
// 시도 목록 로드 (캐시)
// 시도 목록 로드 (Hierarchy API만 사용, fallback 없음)
Future<void> _loadSidoList() async {
try {
_sidoList = await _zipcodeUseCase.getAllSidoList();
debugPrint('=== 시도 목록 로드 완료 ===');
debugPrint('총 시도 개수: ${_sidoList.length}');
debugPrint('시도 목록: $_sidoList');
final response = await _zipcodeUseCase.getHierarchySidos();
_sidoList = response.data;
debugPrint('=== Hierarchy 시도 목록 로드 완료 ===');
debugPrint('시도 개수: ${response.meta.total}');
debugPrint('시도 목록: ${response.data}');
} catch (e) {
debugPrint('시도 목록 로드 실패: $e');
debugPrint('Hierarchy 시도 목록 로드 실패: $e');
_sidoList = [];
}
}
// 선택된 시도의 구 목록 로드
// 구 목록 로드 (Hierarchy API만 사용, fallback 없음)
Future<void> _loadGuListBySido(String sido) async {
try {
_guList = await _zipcodeUseCase.getGuListBySido(sido);
final response = await _zipcodeUseCase.getHierarchyGusBySido(sido);
_guList = response.data;
debugPrint('=== Hierarchy 구 목록 로드 완료 ===');
debugPrint('시도: $sido, 구 개수: ${response.meta.total}');
notifyListeners();
} catch (e) {
debugPrint('구 목록 로드 실패: $e');
debugPrint('Hierarchy 구 목록 로드 실패: $e');
_guList = [];
notifyListeners();
}
}
// 우편번호 선택
void selectZipcode(ZipcodeDto zipcode) {
_selectedZipcode = zipcode;
notifyListeners();
}
// 선택 초기화
void clearSelection() {
_selectedZipcode = null;
notifyListeners();
}
// 내부 헬퍼 메서드
void _setLoading(bool loading) {
_isLoading = loading;
@@ -268,7 +231,6 @@ class ZipcodeController extends ChangeNotifier {
@override
void dispose() {
_debounceTimer?.cancel();
_zipcodes = [];
_selectedZipcode = null;
super.dispose();

View File

@@ -134,7 +134,6 @@ class _ZipcodeSearchScreenState extends State<ZipcodeSearchScreen> {
onSearch: controller.setSearchQuery,
onSidoChanged: controller.setSido,
onGuChanged: controller.setGu,
onClearFilters: controller.clearFilters,
sidoList: controller.sidoList,
guList: controller.guList,
selectedSido: controller.selectedSido,