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

@@ -1,28 +1,24 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:lunchpick/core/constants/app_colors.dart';
import 'package:lunchpick/core/constants/app_typography.dart';
import 'package:lunchpick/core/services/notification_service.dart';
import 'package:lunchpick/domain/entities/restaurant.dart';
import 'package:lunchpick/presentation/providers/settings_provider.dart';
import 'package:lunchpick/presentation/providers/visit_provider.dart';
class RecommendationResultDialog extends ConsumerWidget {
class RecommendationResultDialog extends StatelessWidget {
final Restaurant restaurant;
final VoidCallback onReroll;
final VoidCallback onConfirmVisit;
final Future<void> Function() onReroll;
final Future<void> Function() onClose;
const RecommendationResultDialog({
super.key,
required this.restaurant,
required this.onReroll,
required this.onConfirmVisit,
required this.onClose,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
Widget build(BuildContext context) {
final isDark = Theme.of(context).brightness == Brightness.dark;
return Dialog(
backgroundColor: Colors.transparent,
child: Container(
@@ -56,9 +52,9 @@ class RecommendationResultDialog extends ConsumerWidget {
const SizedBox(height: 8),
Text(
'오늘의 추천!',
style: AppTypography.heading2(false).copyWith(
color: Colors.white,
),
style: AppTypography.heading2(
false,
).copyWith(color: Colors.white),
),
],
),
@@ -68,13 +64,15 @@ class RecommendationResultDialog extends ConsumerWidget {
right: 8,
child: IconButton(
icon: const Icon(Icons.close, color: Colors.white),
onPressed: () => Navigator.pop(context),
onPressed: () async {
await onClose();
},
),
),
],
),
),
// 맛집 정보
Padding(
padding: const EdgeInsets.all(24),
@@ -90,24 +88,27 @@ class RecommendationResultDialog extends ConsumerWidget {
),
),
const SizedBox(height: 8),
// 카테고리
Center(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 4,
),
decoration: BoxDecoration(
color: AppColors.lightPrimary.withOpacity(0.1),
borderRadius: BorderRadius.circular(12),
),
child: Text(
'${restaurant.category} > ${restaurant.subCategory}',
style: AppTypography.body2(isDark).copyWith(
color: AppColors.lightPrimary,
),
style: AppTypography.body2(
isDark,
).copyWith(color: AppColors.lightPrimary),
),
),
),
if (restaurant.description != null) ...[
const SizedBox(height: 16),
Text(
@@ -116,18 +117,20 @@ class RecommendationResultDialog extends ConsumerWidget {
textAlign: TextAlign.center,
),
],
const SizedBox(height: 16),
const Divider(),
const SizedBox(height: 16),
// 주소
Row(
children: [
Icon(
Icons.location_on,
size: 20,
color: isDark ? AppColors.darkTextSecondary : AppColors.lightTextSecondary,
color: isDark
? AppColors.darkTextSecondary
: AppColors.lightTextSecondary,
),
const SizedBox(width: 8),
Expanded(
@@ -138,7 +141,7 @@ class RecommendationResultDialog extends ConsumerWidget {
),
],
),
if (restaurant.phoneNumber != null) ...[
const SizedBox(height: 8),
Row(
@@ -146,7 +149,9 @@ class RecommendationResultDialog extends ConsumerWidget {
Icon(
Icons.phone,
size: 20,
color: isDark ? AppColors.darkTextSecondary : AppColors.lightTextSecondary,
color: isDark
? AppColors.darkTextSecondary
: AppColors.lightTextSecondary,
),
const SizedBox(width: 8),
Text(
@@ -156,18 +161,22 @@ class RecommendationResultDialog extends ConsumerWidget {
],
),
],
const SizedBox(height: 24),
// 버튼들
Row(
children: [
Expanded(
child: OutlinedButton(
onPressed: onReroll,
onPressed: () async {
await onReroll();
},
style: OutlinedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 12),
side: const BorderSide(color: AppColors.lightPrimary),
side: const BorderSide(
color: AppColors.lightPrimary,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
@@ -182,29 +191,7 @@ class RecommendationResultDialog extends ConsumerWidget {
Expanded(
child: ElevatedButton(
onPressed: () async {
final recommendationTime = DateTime.now();
// 알림 설정 확인
final notificationEnabled = await ref.read(notificationEnabledProvider.future);
if (notificationEnabled) {
// 알림 예약
final notificationService = NotificationService();
await notificationService.scheduleVisitReminder(
restaurantId: restaurant.id,
restaurantName: restaurant.name,
recommendationTime: recommendationTime,
);
}
// 방문 기록 자동 생성 (미확인 상태로)
await ref.read(visitNotifierProvider.notifier).createVisitFromRecommendation(
restaurantId: restaurant.id,
recommendationTime: recommendationTime,
);
// 기존 콜백 실행
onConfirmVisit();
await onClose();
},
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 12),
@@ -214,7 +201,7 @@ class RecommendationResultDialog extends ConsumerWidget {
borderRadius: BorderRadius.circular(8),
),
),
child: const Text('여기로 갈게요!'),
child: const Text('닫기'),
),
),
],
@@ -227,4 +214,4 @@ class RecommendationResultDialog extends ConsumerWidget {
),
);
}
}
}