LunchPick(오늘 뭐 먹Z?) Flutter 앱의 초기 구현입니다. 주요 기능: - 네이버 지도 연동 맛집 추가 - 랜덤 메뉴 추천 시스템 - 날씨 기반 거리 조정 - 방문 기록 관리 - Bluetooth 맛집 공유 - 다크모드 지원 기술 스택: - Flutter 3.8.1+ - Riverpod 상태 관리 - Hive 로컬 DB - Clean Architecture 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
230 lines
8.9 KiB
Dart
230 lines
8.9 KiB
Dart
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 {
|
|
final Restaurant restaurant;
|
|
final VoidCallback onReroll;
|
|
final VoidCallback onConfirmVisit;
|
|
|
|
const RecommendationResultDialog({
|
|
super.key,
|
|
required this.restaurant,
|
|
required this.onReroll,
|
|
required this.onConfirmVisit,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
|
|
|
return Dialog(
|
|
backgroundColor: Colors.transparent,
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: isDark ? AppColors.darkSurface : AppColors.lightSurface,
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
// 상단 이미지 영역
|
|
Container(
|
|
height: 150,
|
|
decoration: BoxDecoration(
|
|
color: AppColors.lightPrimary,
|
|
borderRadius: const BorderRadius.vertical(
|
|
top: Radius.circular(20),
|
|
),
|
|
),
|
|
child: Stack(
|
|
children: [
|
|
Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const Icon(
|
|
Icons.restaurant_menu,
|
|
size: 64,
|
|
color: Colors.white,
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'오늘의 추천!',
|
|
style: AppTypography.heading2(false).copyWith(
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Positioned(
|
|
top: 8,
|
|
right: 8,
|
|
child: IconButton(
|
|
icon: const Icon(Icons.close, color: Colors.white),
|
|
onPressed: () => Navigator.pop(context),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
|
|
// 맛집 정보
|
|
Padding(
|
|
padding: const EdgeInsets.all(24),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// 가게 이름
|
|
Center(
|
|
child: Text(
|
|
restaurant.name,
|
|
style: AppTypography.heading1(isDark),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
|
|
// 카테고리
|
|
Center(
|
|
child: Container(
|
|
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,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
|
|
if (restaurant.description != null) ...[
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
restaurant.description!,
|
|
style: AppTypography.body2(isDark),
|
|
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,
|
|
),
|
|
const SizedBox(width: 8),
|
|
Expanded(
|
|
child: Text(
|
|
restaurant.roadAddress,
|
|
style: AppTypography.body2(isDark),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
if (restaurant.phoneNumber != null) ...[
|
|
const SizedBox(height: 8),
|
|
Row(
|
|
children: [
|
|
Icon(
|
|
Icons.phone,
|
|
size: 20,
|
|
color: isDark ? AppColors.darkTextSecondary : AppColors.lightTextSecondary,
|
|
),
|
|
const SizedBox(width: 8),
|
|
Text(
|
|
restaurant.phoneNumber!,
|
|
style: AppTypography.body2(isDark),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
|
|
const SizedBox(height: 24),
|
|
|
|
// 버튼들
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: OutlinedButton(
|
|
onPressed: onReroll,
|
|
style: OutlinedButton.styleFrom(
|
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
|
side: const BorderSide(color: AppColors.lightPrimary),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
child: const Text(
|
|
'다시 뽑기',
|
|
style: TextStyle(color: AppColors.lightPrimary),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
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();
|
|
},
|
|
style: ElevatedButton.styleFrom(
|
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
|
backgroundColor: AppColors.lightPrimary,
|
|
foregroundColor: Colors.white,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
child: const Text('여기로 갈게요!'),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |