- 기록/통계 탭에 디버그 토글 배너 추가 및 테스트 데이터 주입 로직 상태화\n- 리스트 공유 화면에 디버그 프리뷰 토글, 광고 관문, 디버그 전송 흐름 반영\n- 모의 전면 광고는 대기 시간 종료 시 자동 완료되도록 변경\n- AGENTS.md에 코멘트는 한국어로 작성 규칙 명시\n\n테스트: flutter analyze; flutter test
93 lines
3.3 KiB
Dart
93 lines
3.3 KiB
Dart
import 'package:flutter/foundation.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/presentation/providers/debug_test_data_provider.dart';
|
|
|
|
class DebugTestDataBanner extends ConsumerWidget {
|
|
final EdgeInsetsGeometry? margin;
|
|
|
|
const DebugTestDataBanner({super.key, this.margin});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
if (!kDebugMode) {
|
|
return const SizedBox.shrink();
|
|
}
|
|
|
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
|
final state = ref.watch(debugTestDataNotifierProvider);
|
|
final notifier = ref.read(debugTestDataNotifierProvider.notifier);
|
|
|
|
return Card(
|
|
margin: margin ?? const EdgeInsets.all(16),
|
|
color: isDark ? AppColors.darkSurface : AppColors.lightSurface,
|
|
elevation: 1,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(12),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
const Icon(
|
|
Icons.science_outlined,
|
|
color: AppColors.lightPrimary,
|
|
size: 20,
|
|
),
|
|
const SizedBox(width: 8),
|
|
Text(
|
|
'테스트 데이터 미리보기',
|
|
style: AppTypography.body1(
|
|
isDark,
|
|
).copyWith(fontWeight: FontWeight.w600),
|
|
),
|
|
const Spacer(),
|
|
if (state.isProcessing)
|
|
const SizedBox(
|
|
width: 20,
|
|
height: 20,
|
|
child: CircularProgressIndicator(strokeWidth: 2),
|
|
),
|
|
const SizedBox(width: 8),
|
|
Switch.adaptive(
|
|
value: state.isEnabled,
|
|
onChanged: state.isProcessing
|
|
? null
|
|
: (value) async {
|
|
if (value) {
|
|
await notifier.enableTestData();
|
|
} else {
|
|
await notifier.disableTestData();
|
|
}
|
|
},
|
|
activeColor: AppColors.lightPrimary,
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
state.isEnabled
|
|
? '디버그 빌드에서만 적용됩니다. 기록/통계 UI를 테스트용 데이터로 확인하세요.'
|
|
: '디버그 빌드에서만 사용 가능합니다. 스위치를 켜면 추천·방문 기록이 자동으로 채워집니다.',
|
|
style: AppTypography.caption(isDark),
|
|
),
|
|
if (state.errorMessage != null) ...[
|
|
const SizedBox(height: 6),
|
|
Text(
|
|
state.errorMessage!,
|
|
style: AppTypography.caption(isDark).copyWith(
|
|
color: AppColors.lightError,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|