사용하지 않는 파일 정리 전 백업 (Phase 10 완료 후 상태)

This commit is contained in:
JiWoong Sul
2025-08-29 15:11:59 +09:00
parent a740ff10c8
commit d916b281a7
333 changed files with 53617 additions and 22574 deletions

View File

@@ -0,0 +1,282 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
class ZipcodeSearchFilter extends StatefulWidget {
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;
final String? selectedGu;
const ZipcodeSearchFilter({
super.key,
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();
Timer? _debounceTimer;
bool _hasFilters = false;
@override
void dispose() {
_searchController.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) {
widget.onSidoChanged(value);
_updateHasFilters();
}
void _onGuChanged(String? value) {
widget.onGuChanged(value);
_updateHasFilters();
}
void _clearFilters() {
setState(() {
_searchController.clear();
_hasFilters = false;
});
_debounceTimer?.cancel();
widget.onClearFilters();
}
void _updateHasFilters() {
setState(() {
_hasFilters = _searchController.text.isNotEmpty ||
widget.selectedSido != null ||
widget.selectedGu != null;
});
}
@override
Widget build(BuildContext context) {
final theme = ShadTheme.of(context);
return Column(
children: [
// 첫 번째 행: 검색 입력
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,
children: [
Text(
'시도',
style: theme.textTheme.small?.copyWith(
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 6),
SizedBox(
width: double.infinity,
child: ShadSelect<String>(
placeholder: const Text('시도 선택'),
onChanged: _onSidoChanged,
options: [
const ShadOption(
value: null,
child: Text('전체'),
),
...widget.sidoList.map((sido) => ShadOption(
value: sido,
child: Text(sido),
)),
],
selectedOptionBuilder: (context, value) {
return Row(
children: [
Icon(
Icons.location_city,
size: 16,
color: theme.colorScheme.primary,
),
const SizedBox(width: 8),
Text(value ?? '전체'),
],
);
},
),
),
],
),
),
const SizedBox(width: 16),
// 구 선택
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'구/군',
style: theme.textTheme.small?.copyWith(
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 6),
SizedBox(
width: double.infinity,
child: ShadSelect<String>(
placeholder: Text(
widget.selectedSido == null
? '시도를 먼저 선택하세요'
: '구/군 선택'
),
onChanged: widget.selectedSido != null ? _onGuChanged : null,
options: [
const ShadOption(
value: null,
child: Text('전체'),
),
...widget.guList.map((gu) => ShadOption(
value: gu,
child: Text(gu),
)),
],
selectedOptionBuilder: (context, value) {
return Row(
children: [
Icon(
Icons.location_on,
size: 16,
color: widget.selectedSido != null
? theme.colorScheme.primary
: theme.colorScheme.mutedForeground,
),
const SizedBox(width: 8),
Text(value ?? '전체'),
],
);
},
),
),
],
),
),
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,
),
),
],
),
),
],
),
],
);
}
}

View File

@@ -0,0 +1,443 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:superport/data/models/zipcode_dto.dart';
class ZipcodeTable extends StatelessWidget {
final List<ZipcodeDto> zipcodes;
final int currentPage;
final int totalPages;
final Function(int) onPageChanged;
final Function(ZipcodeDto) onSelect;
const ZipcodeTable({
super.key,
required this.zipcodes,
required this.currentPage,
required this.totalPages,
required this.onPageChanged,
required this.onSelect,
});
void _copyToClipboard(BuildContext context, String text, String label) {
Clipboard.setData(ClipboardData(text: text));
ShadToaster.of(context).show(
ShadToast(
title: Text('$label 복사됨'),
description: Text(text),
duration: const Duration(seconds: 2),
),
);
}
@override
Widget build(BuildContext context) {
final theme = ShadTheme.of(context);
return Column(
children: [
Expanded(
child: ShadCard(
child: SingleChildScrollView(
child: DataTable(
horizontalMargin: 16,
columnSpacing: 24,
columns: const [
DataColumn(
label: Text(
'우편번호',
style: TextStyle(fontWeight: FontWeight.w600),
),
),
DataColumn(
label: Text(
'시도',
style: TextStyle(fontWeight: FontWeight.w600),
),
),
DataColumn(
label: Text(
'구/군',
style: TextStyle(fontWeight: FontWeight.w600),
),
),
DataColumn(
label: Text(
'상세주소',
style: TextStyle(fontWeight: FontWeight.w600),
),
),
DataColumn(
label: Text(
'작업',
style: TextStyle(fontWeight: FontWeight.w600),
),
),
],
rows: zipcodes.map((zipcode) {
return DataRow(
cells: [
// 우편번호
DataCell(
Row(
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
decoration: BoxDecoration(
color: theme.colorScheme.primary.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(6),
),
child: Text(
zipcode.zipcode.toString().padLeft(5, '0'),
style: TextStyle(
fontWeight: FontWeight.w600,
color: theme.colorScheme.primary,
fontFamily: 'monospace',
),
),
),
const SizedBox(width: 8),
ShadButton.ghost(
onPressed: () => _copyToClipboard(
context,
zipcode.zipcode.toString().padLeft(5, '0'),
'우편번호'
),
size: ShadButtonSize.sm,
child: Icon(
Icons.copy,
size: 14,
color: theme.colorScheme.mutedForeground,
),
),
],
),
),
// 시도
DataCell(
Row(
children: [
Icon(
Icons.location_city,
size: 16,
color: theme.colorScheme.mutedForeground,
),
const SizedBox(width: 6),
Text(
zipcode.sido,
style: const TextStyle(fontWeight: FontWeight.w500),
),
],
),
),
// 구/군
DataCell(
Row(
children: [
Icon(
Icons.location_on,
size: 16,
color: theme.colorScheme.mutedForeground,
),
const SizedBox(width: 6),
Text(
zipcode.gu,
style: const TextStyle(fontWeight: FontWeight.w500),
),
],
),
),
// 상세주소
DataCell(
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 300),
child: Row(
children: [
Expanded(
child: Text(
zipcode.etc,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: theme.colorScheme.foreground,
),
),
),
const SizedBox(width: 8),
ShadButton.ghost(
onPressed: () => _copyToClipboard(
context,
zipcode.fullAddress,
'전체주소'
),
size: ShadButtonSize.sm,
child: Icon(
Icons.copy,
size: 14,
color: theme.colorScheme.mutedForeground,
),
),
],
),
),
),
// 작업
DataCell(
Row(
mainAxisSize: MainAxisSize.min,
children: [
ShadButton(
onPressed: () => onSelect(zipcode),
size: ShadButtonSize.sm,
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.check, size: 14),
SizedBox(width: 4),
Text('선택'),
],
),
),
const SizedBox(width: 6),
ShadButton.outline(
onPressed: () => _showAddressDetails(context, zipcode),
size: ShadButtonSize.sm,
child: const Icon(Icons.info_outline, size: 14),
),
],
),
),
],
);
}).toList(),
),
),
),
),
// 페이지네이션
if (totalPages > 1)
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: theme.colorScheme.border,
width: 1,
),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ShadButton.ghost(
onPressed: currentPage > 1
? () => onPageChanged(currentPage - 1)
: null,
size: ShadButtonSize.sm,
child: const Icon(Icons.chevron_left, size: 16),
),
const SizedBox(width: 8),
// 페이지 번호 표시
...List.generate(
totalPages > 7 ? 7 : totalPages,
(index) {
int pageNumber;
if (totalPages <= 7) {
pageNumber = index + 1;
} else if (currentPage <= 4) {
pageNumber = index + 1;
} else if (currentPage >= totalPages - 3) {
pageNumber = totalPages - 6 + index;
} else {
pageNumber = currentPage - 3 + index;
}
if (pageNumber > totalPages) return const SizedBox.shrink();
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 2),
child: pageNumber == currentPage
? ShadButton(
onPressed: () => onPageChanged(pageNumber),
size: ShadButtonSize.sm,
child: Text(pageNumber.toString()),
)
: ShadButton.outline(
onPressed: () => onPageChanged(pageNumber),
size: ShadButtonSize.sm,
child: Text(pageNumber.toString()),
),
);
},
),
const SizedBox(width: 8),
ShadButton.ghost(
onPressed: currentPage < totalPages
? () => onPageChanged(currentPage + 1)
: null,
size: ShadButtonSize.sm,
child: const Icon(Icons.chevron_right, size: 16),
),
const SizedBox(width: 24),
// 페이지 정보
Text(
'페이지 $currentPage / $totalPages',
style: theme.textTheme.muted,
),
],
),
),
],
);
}
void _showAddressDetails(BuildContext context, ZipcodeDto zipcode) {
showDialog(
context: context,
builder: (context) => ShadDialog(
title: const Text('우편번호 상세정보'),
description: const Text('선택한 우편번호의 상세 정보입니다'),
child: Container(
width: 400,
padding: const EdgeInsets.all(16),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 우편번호
_buildInfoRow(
context,
'우편번호',
zipcode.zipcode.toString().padLeft(5, '0'),
Icons.local_post_office,
),
const SizedBox(height: 12),
// 시도
_buildInfoRow(
context,
'시도',
zipcode.sido,
Icons.location_city,
),
const SizedBox(height: 12),
// 구/군
_buildInfoRow(
context,
'구/군',
zipcode.gu,
Icons.location_on,
),
const SizedBox(height: 12),
// 상세주소
_buildInfoRow(
context,
'상세주소',
zipcode.etc,
Icons.home,
),
const SizedBox(height: 12),
// 전체주소
_buildInfoRow(
context,
'전체주소',
zipcode.fullAddress,
Icons.place,
),
const SizedBox(height: 20),
// 액션 버튼
Row(
children: [
Expanded(
child: ShadButton.outline(
onPressed: () => _copyToClipboard(
context,
zipcode.fullAddress,
'전체주소'
),
child: const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.copy, size: 16),
SizedBox(width: 6),
Text('주소 복사'),
],
),
),
),
const SizedBox(width: 8),
Expanded(
child: ShadButton(
onPressed: () {
Navigator.of(context).pop();
onSelect(zipcode);
},
child: const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.check, size: 16),
SizedBox(width: 6),
Text('선택'),
],
),
),
),
],
),
],
),
),
),
);
}
Widget _buildInfoRow(BuildContext context, String label, String value, IconData icon) {
final theme = ShadTheme.of(context);
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
icon,
size: 16,
color: theme.colorScheme.mutedForeground,
),
const SizedBox(width: 8),
SizedBox(
width: 60,
child: Text(
label,
style: theme.textTheme.small?.copyWith(
fontWeight: FontWeight.w600,
color: theme.colorScheme.mutedForeground,
),
),
),
const SizedBox(width: 8),
Expanded(
child: Text(
value,
style: theme.textTheme.small?.copyWith(
fontWeight: FontWeight.w500,
),
),
),
],
);
}
}

View File

@@ -0,0 +1,256 @@
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';
@injectable
class ZipcodeController extends ChangeNotifier {
final ZipcodeUseCase _zipcodeUseCase;
ZipcodeController(this._zipcodeUseCase);
// 상태 변수들
List<ZipcodeDto> _zipcodes = [];
ZipcodeDto? _selectedZipcode;
bool _isLoading = false;
String? _errorMessage;
// 페이지네이션
int _currentPage = 1;
int _totalPages = 1;
int _totalCount = 0;
final int _pageSize = PaginationConstants.defaultPageSize;
// 검색 및 필터
String _searchQuery = '';
String? _selectedSido;
String? _selectedGu;
// 시도/구 목록 캐시
List<String> _sidoList = [];
List<String> _guList = [];
// 디바운스를 위한 타이머
Timer? _debounceTimer;
// Getters
List<ZipcodeDto> get zipcodes => _zipcodes;
ZipcodeDto? get selectedZipcode => _selectedZipcode;
bool get isLoading => _isLoading;
String? get errorMessage => _errorMessage;
int get currentPage => _currentPage;
int get totalPages => _totalPages;
int get totalCount => _totalCount;
String get searchQuery => _searchQuery;
String? get selectedSido => _selectedSido;
String? get selectedGu => _selectedGu;
List<String> get sidoList => _sidoList;
List<String> get guList => _guList;
bool get hasNextPage => _currentPage < _totalPages;
bool get hasPreviousPage => _currentPage > 1;
// 초기 데이터 로드
Future<void> initialize() async {
_isLoading = true;
notifyListeners();
// 시도 목록 로드
await _loadSidoList();
// 초기 우편번호 목록 로드 (첫 페이지)
await searchZipcodes();
}
// 우편번호 검색
Future<void> searchZipcodes({bool refresh = false}) async {
if (refresh) {
_currentPage = 1;
}
_setLoading(true);
_clearError();
try {
final response = await _zipcodeUseCase.searchZipcodes(
page: _currentPage,
limit: _pageSize,
search: _searchQuery.isNotEmpty ? _searchQuery : null,
sido: _selectedSido,
gu: _selectedGu,
);
_zipcodes = response.items;
_totalCount = response.totalCount;
_totalPages = response.totalPages;
_currentPage = response.currentPage;
notifyListeners();
} catch (e) {
_setError('우편번호 검색에 실패했습니다: ${e.toString()}');
} finally {
_setLoading(false);
}
}
// 특정 우편번호로 정확한 주소 조회
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 {
_selectedSido = sido;
_selectedGu = null; // 시도 변경 시 구 초기화
_guList = []; // 구 목록 초기화
notifyListeners();
// 선택된 시도에 따른 구 목록 로드
if (sido != null) {
await _loadGuListBySido(sido);
}
// 검색 새로고침
await searchZipcodes(refresh: true);
}
// 구 선택
Future<void> setGu(String? gu) async {
_selectedGu = gu;
notifyListeners();
// 검색 새로고침
await searchZipcodes(refresh: true);
}
// 필터 초기화
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);
}
}
// 시도 목록 로드 (캐시)
Future<void> _loadSidoList() async {
try {
_sidoList = await _zipcodeUseCase.getAllSidoList();
} catch (e) {
debugPrint('시도 목록 로드 실패: $e');
_sidoList = [];
}
}
// 선택된 시도의 구 목록 로드
Future<void> _loadGuListBySido(String sido) async {
try {
_guList = await _zipcodeUseCase.getGuListBySido(sido);
notifyListeners();
} catch (e) {
debugPrint('구 목록 로드 실패: $e');
_guList = [];
}
}
// 우편번호 선택
void selectZipcode(ZipcodeDto zipcode) {
_selectedZipcode = zipcode;
notifyListeners();
}
// 선택 초기화
void clearSelection() {
_selectedZipcode = null;
notifyListeners();
}
// 내부 헬퍼 메서드
void _setLoading(bool loading) {
_isLoading = loading;
notifyListeners();
}
void _setError(String message) {
_errorMessage = message;
notifyListeners();
}
void _clearError() {
_errorMessage = null;
}
@override
void dispose() {
_debounceTimer?.cancel();
_zipcodes = [];
_selectedZipcode = null;
super.dispose();
}
}

View File

@@ -0,0 +1,244 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
import 'package:superport/screens/zipcode/controllers/zipcode_controller.dart';
import 'package:superport/screens/zipcode/components/zipcode_search_filter.dart';
import 'package:superport/screens/zipcode/components/zipcode_table.dart';
class ZipcodeSearchScreen extends StatefulWidget {
const ZipcodeSearchScreen({super.key});
@override
State<ZipcodeSearchScreen> createState() => _ZipcodeSearchScreenState();
}
class _ZipcodeSearchScreenState extends State<ZipcodeSearchScreen> {
late ZipcodeController _controller;
@override
void initState() {
super.initState();
_controller = context.read<ZipcodeController>();
// 위젯이 완전히 빌드된 후에 초기화 실행
WidgetsBinding.instance.addPostFrameCallback((_) {
_controller.initialize();
});
}
void _showSuccessToast(String message) {
if (mounted) {
ShadToaster.of(context).show(
ShadToast(
title: const Text('성공'),
description: Text(message),
duration: const Duration(seconds: 3),
),
);
}
}
void _showErrorToast(String message) {
if (mounted) {
ShadToaster.of(context).show(
ShadToast.destructive(
title: Text('오류'),
description: Text(message),
duration: const Duration(seconds: 5),
),
);
}
}
@override
Widget build(BuildContext context) {
final theme = ShadTheme.of(context);
return Consumer<ZipcodeController>(
builder: (context, controller, child) {
// 에러 메시지 표시
if (controller.errorMessage != null) {
WidgetsBinding.instance.addPostFrameCallback((_) {
_showErrorToast(controller.errorMessage!);
});
}
return Scaffold(
backgroundColor: theme.colorScheme.background,
body: Column(
children: [
// 헤더 섹션
Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
color: theme.colorScheme.card,
border: Border(
bottom: BorderSide(
color: theme.colorScheme.border,
width: 1,
),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 제목 및 설명
Row(
children: [
Icon(
Icons.location_on,
size: 28,
color: theme.colorScheme.primary,
),
const SizedBox(width: 12),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'우편번호 검색',
style: theme.textTheme.h3,
),
const SizedBox(height: 4),
Text(
'전국의 우편번호를 검색하고 정확한 주소를 찾을 수 있습니다',
style: theme.textTheme.muted,
),
],
),
const Spacer(),
// 통계 정보
Container(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
decoration: BoxDecoration(
color: theme.colorScheme.primary.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(8),
),
child: Text(
'${controller.totalCount}개 우편번호',
style: TextStyle(
color: theme.colorScheme.primary,
fontWeight: FontWeight.w600,
),
),
),
],
),
const SizedBox(height: 24),
// 검색 및 필터 영역
ZipcodeSearchFilter(
onSearch: controller.setSearchQuery,
onSidoChanged: controller.setSido,
onGuChanged: controller.setGu,
onClearFilters: controller.clearFilters,
sidoList: controller.sidoList,
guList: controller.guList,
selectedSido: controller.selectedSido,
selectedGu: controller.selectedGu,
),
],
),
),
// 메인 컨텐츠 영역
Expanded(
child: Container(
padding: const EdgeInsets.all(24),
child: controller.isLoading && controller.zipcodes.isEmpty
? const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(),
SizedBox(height: 16),
Text('우편번호를 검색하고 있습니다...'),
],
),
)
: controller.zipcodes.isEmpty
? Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.search_off,
size: 64,
color: theme.colorScheme.mutedForeground,
),
const SizedBox(height: 16),
Text(
'검색 결과가 없습니다',
style: theme.textTheme.h4,
),
const SizedBox(height: 8),
Text(
'다른 검색어나 필터를 사용해 보세요',
style: theme.textTheme.muted,
),
const SizedBox(height: 24),
ShadButton.outline(
onPressed: controller.clearFilters,
child: const Text('필터 초기화'),
),
],
),
)
: Column(
children: [
// 결과 정보
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: theme.colorScheme.muted.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(8),
),
child: Row(
children: [
Icon(
Icons.info_outline,
size: 16,
color: theme.colorScheme.mutedForeground,
),
const SizedBox(width: 8),
Text(
'${controller.totalCount}개 중 ${controller.zipcodes.length}개 표시',
style: theme.textTheme.small,
),
const Spacer(),
if (controller.isLoading)
const SizedBox(
width: 16,
height: 16,
child: CircularProgressIndicator(strokeWidth: 2),
),
],
),
),
const SizedBox(height: 16),
// 테이블
Expanded(
child: ZipcodeTable(
zipcodes: controller.zipcodes,
currentPage: controller.currentPage,
totalPages: controller.totalPages,
onPageChanged: controller.goToPage,
onSelect: (zipcode) {
controller.selectZipcode(zipcode);
_showSuccessToast('우편번호 ${zipcode.zipcode}를 선택했습니다');
},
),
),
],
),
),
),
],
),
);
},
);
}
}