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:
@@ -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, // 실시간 검색 (디바운스 없음)
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user