LunchPick(오늘 뭐 먹Z?) Flutter 앱의 초기 구현입니다. 주요 기능: - 네이버 지도 연동 맛집 추가 - 랜덤 메뉴 추천 시스템 - 날씨 기반 거리 조정 - 방문 기록 관리 - Bluetooth 맛집 공유 - 다크모드 지원 기술 스택: - Flutter 3.8.1+ - Riverpod 상태 관리 - Hive 로컬 DB - Clean Architecture 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
219 lines
8.5 KiB
Dart
219 lines
8.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import '../../../core/constants/app_colors.dart';
|
|
import '../../../core/constants/app_typography.dart';
|
|
|
|
class ShareScreen extends ConsumerStatefulWidget {
|
|
const ShareScreen({super.key});
|
|
|
|
@override
|
|
ConsumerState<ShareScreen> createState() => _ShareScreenState();
|
|
}
|
|
|
|
class _ShareScreenState extends ConsumerState<ShareScreen> {
|
|
String? _shareCode;
|
|
bool _isScanning = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
|
|
|
return Scaffold(
|
|
backgroundColor: isDark ? AppColors.darkBackground : AppColors.lightBackground,
|
|
appBar: AppBar(
|
|
title: const Text('리스트 공유'),
|
|
backgroundColor: isDark ? AppColors.darkPrimary : AppColors.lightPrimary,
|
|
foregroundColor: Colors.white,
|
|
elevation: 0,
|
|
),
|
|
body: SingleChildScrollView(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Column(
|
|
children: [
|
|
// 공유받기 섹션
|
|
Card(
|
|
color: isDark ? AppColors.darkSurface : AppColors.lightSurface,
|
|
elevation: 2,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(24),
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.lightPrimary.withOpacity(0.1),
|
|
shape: BoxShape.circle,
|
|
),
|
|
child: const Icon(
|
|
Icons.download_rounded,
|
|
size: 48,
|
|
color: AppColors.lightPrimary,
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
'리스트 공유받기',
|
|
style: AppTypography.heading2(isDark),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'다른 사람의 맛집 리스트를 받아보세요',
|
|
style: AppTypography.body2(isDark),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
const SizedBox(height: 20),
|
|
if (_shareCode != null) ...[
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.lightPrimary.withOpacity(0.1),
|
|
borderRadius: BorderRadius.circular(12),
|
|
border: Border.all(
|
|
color: AppColors.lightPrimary.withOpacity(0.3),
|
|
width: 2,
|
|
),
|
|
),
|
|
child: Text(
|
|
_shareCode!,
|
|
style: const TextStyle(
|
|
fontSize: 36,
|
|
fontWeight: FontWeight.bold,
|
|
letterSpacing: 6,
|
|
color: AppColors.lightPrimary,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
'이 코드를 상대방에게 알려주세요',
|
|
style: AppTypography.caption(isDark),
|
|
),
|
|
const SizedBox(height: 16),
|
|
TextButton.icon(
|
|
onPressed: () {
|
|
setState(() {
|
|
_shareCode = null;
|
|
});
|
|
},
|
|
icon: const Icon(Icons.close),
|
|
label: const Text('취소'),
|
|
style: TextButton.styleFrom(
|
|
foregroundColor: AppColors.lightError,
|
|
),
|
|
),
|
|
] else
|
|
ElevatedButton.icon(
|
|
onPressed: _generateShareCode,
|
|
icon: const Icon(Icons.qr_code),
|
|
label: const Text('공유 코드 생성'),
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: AppColors.lightPrimary,
|
|
foregroundColor: Colors.white,
|
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
// 공유하기 섹션
|
|
Card(
|
|
color: isDark ? AppColors.darkSurface : AppColors.lightSurface,
|
|
elevation: 2,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(24),
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.lightSecondary.withOpacity(0.1),
|
|
shape: BoxShape.circle,
|
|
),
|
|
child: const Icon(
|
|
Icons.upload_rounded,
|
|
size: 48,
|
|
color: AppColors.lightSecondary,
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
'내 리스트 공유하기',
|
|
style: AppTypography.heading2(isDark),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'내 맛집 리스트를 다른 사람과 공유하세요',
|
|
style: AppTypography.body2(isDark),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
const SizedBox(height: 20),
|
|
if (_isScanning) ...[
|
|
const CircularProgressIndicator(
|
|
color: AppColors.lightSecondary,
|
|
),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
'주변 기기를 검색 중...',
|
|
style: AppTypography.caption(isDark),
|
|
),
|
|
const SizedBox(height: 16),
|
|
TextButton.icon(
|
|
onPressed: () {
|
|
setState(() {
|
|
_isScanning = false;
|
|
});
|
|
},
|
|
icon: const Icon(Icons.stop),
|
|
label: const Text('스캔 중지'),
|
|
style: TextButton.styleFrom(
|
|
foregroundColor: AppColors.lightError,
|
|
),
|
|
),
|
|
] else
|
|
ElevatedButton.icon(
|
|
onPressed: () {
|
|
setState(() {
|
|
_isScanning = true;
|
|
});
|
|
},
|
|
icon: const Icon(Icons.radar),
|
|
label: const Text('주변 기기 스캔'),
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: AppColors.lightSecondary,
|
|
foregroundColor: Colors.white,
|
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
void _generateShareCode() {
|
|
// TODO: 실제 구현 시 랜덤 코드 생성
|
|
setState(() {
|
|
_shareCode = '123456';
|
|
});
|
|
}
|
|
} |