feat(app): add manual entry and sharing flows

This commit is contained in:
JiWoong Sul
2025-11-19 16:36:39 +09:00
parent 5ade584370
commit 947fe59486
110 changed files with 5937 additions and 3781 deletions

View File

@@ -74,14 +74,14 @@ class CategoryMapper {
if (_iconMap.containsKey(category)) {
return _iconMap[category]!;
}
// 부분 일치 검색 (키워드 포함)
for (final entry in _iconMap.entries) {
if (category.contains(entry.key) || entry.key.contains(category)) {
return entry.value;
}
}
// 기본 아이콘
return Icons.restaurant_menu;
}
@@ -92,14 +92,14 @@ class CategoryMapper {
if (_colorMap.containsKey(category)) {
return _colorMap[category]!;
}
// 부분 일치 검색 (키워드 포함)
for (final entry in _colorMap.entries) {
if (category.contains(entry.key) || entry.key.contains(category)) {
return entry.value;
}
}
// 카테고리 문자열 기반 색상 생성 (일관된 색상)
final hash = category.hashCode;
final hue = (hash % 360).toDouble();
@@ -129,14 +129,14 @@ class CategoryMapper {
if (category == '음식점' && subCategory != null && subCategory.isNotEmpty) {
return subCategory;
}
// ">"로 구분된 카테고리의 경우 가장 구체적인 부분 사용
if (category.contains('>')) {
final parts = category.split('>').map((s) => s.trim()).toList();
// 마지막 부분이 가장 구체적
return parts.last;
}
return category;
}
}
}

View File

@@ -12,7 +12,8 @@ class DistanceCalculator {
final double dLat = _toRadians(lat2 - lat1);
final double dLon = _toRadians(lon2 - lon1);
final double a = math.sin(dLat / 2) * math.sin(dLat / 2) +
final double a =
math.sin(dLat / 2) * math.sin(dLat / 2) +
math.cos(_toRadians(lat1)) *
math.cos(_toRadians(lat2)) *
math.sin(dLon / 2) *
@@ -79,7 +80,7 @@ class DistanceCalculator {
required double currentLon,
}) {
final List<T> sortedItems = List<T>.from(items);
sortedItems.sort((a, b) {
final distanceA = calculateDistance(
lat1: currentLat,
@@ -87,24 +88,21 @@ class DistanceCalculator {
lat2: getLat(a),
lon2: getLon(a),
);
final distanceB = calculateDistance(
lat1: currentLat,
lon1: currentLon,
lat2: getLat(b),
lon2: getLon(b),
);
return distanceA.compareTo(distanceB);
});
return sortedItems;
}
static Map<String, double> getDefaultLocationForKorea() {
return {
'latitude': 37.5665,
'longitude': 126.9780,
};
return {'latitude': 37.5665, 'longitude': 126.9780};
}
}
}

View File

@@ -23,16 +23,16 @@ class Validators {
if (value == null || value.isEmpty) {
return null;
}
final lat = double.tryParse(value);
if (lat == null) {
return '올바른 위도 값을 입력해주세요';
}
if (lat < -90 || lat > 90) {
return '위도는 -90도에서 90도 사이여야 합니다';
}
return null;
}
@@ -40,16 +40,16 @@ class Validators {
if (value == null || value.isEmpty) {
return null;
}
final lng = double.tryParse(value);
if (lng == null) {
return '올바른 경도 값을 입력해주세요';
}
if (lng < -180 || lng > 180) {
return '경도는 -180도에서 180도 사이여야 합니다';
}
return null;
}
@@ -76,7 +76,7 @@ class Validators {
static bool isValidEmail(String? email) {
if (email == null || email.isEmpty) return false;
final emailRegex = RegExp(
r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$',
);
@@ -85,8 +85,8 @@ class Validators {
static bool isValidPhoneNumber(String? phone) {
if (phone == null || phone.isEmpty) return false;
final phoneRegex = RegExp(r'^[0-9-+() ]+$');
return phoneRegex.hasMatch(phone) && phone.length >= 10;
}
}
}