Compare commits

..

No commits in common. "d72587ac19e2a30b4cdf74930c46d3562630426f" and "5d8689b7eecfbcc8282af797242621a3d20655b9" have entirely different histories.

18 changed files with 211 additions and 246 deletions

View File

@ -28,5 +28,5 @@ GITEA_REPO=ponshu_room_lite
# VERCEL_PROJECT_ID=prj_xxxxxxxxxx
# APKビルド設定
MAITA_API_KEY=AIzaSy_YOUR_GEMINI_KEY_HERE
EIJI_API_KEY=AIzaSy_YOUR_GEMINI_KEY_HERE
MAITA_API_KEY=AIzaSyDjPZGOHy-xAstpLks081SIbUdTyb_iJpU
EIJI_API_KEY=AIzaSyBEwmTa9_2aiRrwr1mXE7Qriw8mIg1xr0U

View File

@ -1,13 +0,0 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
class QuotaLockoutNotifier extends Notifier<DateTime?> {
@override
DateTime? build() => null;
void set(DateTime? value) => state = value;
}
/// Gemini API 429
///
///
/// null = DateTime =
final quotaLockoutProvider = NotifierProvider<QuotaLockoutNotifier, DateTime?>(QuotaLockoutNotifier.new);

View File

@ -6,7 +6,6 @@ import 'package:lucide_icons/lucide_icons.dart';
import '../models/sake_item.dart';
import '../providers/gemini_provider.dart';
import '../providers/quota_lockout_provider.dart';
import '../providers/sakenowa_providers.dart';
import '../providers/theme_provider.dart';
import '../services/api_usage_service.dart';
@ -25,6 +24,7 @@ import '../widgets/analyzing_dialog.dart';
/// - _performSakenowaMatching() :
mixin CameraAnalysisMixin<T extends ConsumerStatefulWidget> on ConsumerState<T> {
final List<String> capturedImages = [];
DateTime? quotaLockoutTime;
Future<void> analyzeImages() async {
if (capturedImages.isEmpty) return;
@ -32,7 +32,6 @@ mixin CameraAnalysisMixin<T extends ConsumerStatefulWidget> on ConsumerState<T>
// async gap context
final messenger = ScaffoldMessenger.of(context);
final navigator = Navigator.of(context);
final appColors = Theme.of(context).extension<AppColors>()!;
final isOnline = await NetworkService.isOnline();
if (!isOnline) {
@ -45,25 +44,25 @@ mixin CameraAnalysisMixin<T extends ConsumerStatefulWidget> on ConsumerState<T>
if (!mounted) return;
messenger.showSnackBar(
SnackBar(
const SnackBar(
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(LucideIcons.wifiOff, color: Colors.white, size: 16),
const SizedBox(width: 8),
const Text('オフライン検知', style: TextStyle(fontWeight: FontWeight.bold)),
Icon(LucideIcons.wifiOff, color: Colors.orange, size: 16),
SizedBox(width: 8),
Text('オフライン検知', style: TextStyle(fontWeight: FontWeight.bold)),
],
),
const SizedBox(height: 4),
const Text('写真を「解析待ち」として保存しました。'),
const Text('オンライン復帰後、ホーム画面から解析できます。'),
SizedBox(height: 4),
Text('写真を「解析待ち」として保存しました。'),
Text('オンライン復帰後、ホーム画面から解析できます。'),
],
),
duration: const Duration(seconds: 5),
backgroundColor: appColors.warning,
duration: Duration(seconds: 5),
backgroundColor: Colors.orange,
),
);
@ -73,7 +72,7 @@ mixin CameraAnalysisMixin<T extends ConsumerStatefulWidget> on ConsumerState<T>
debugPrint('Draft save error: $e');
if (!mounted) return;
messenger.showSnackBar(
const SnackBar(content: Text('写真の一時保存に失敗しました。再度お試しください。')),
SnackBar(content: Text('Draft保存エラー: $e')),
);
return;
}
@ -94,11 +93,11 @@ mixin CameraAnalysisMixin<T extends ConsumerStatefulWidget> on ConsumerState<T>
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
const Row(
children: [
const Icon(LucideIcons.zap, color: Colors.white, size: 16),
const SizedBox(width: 8),
const Text('本日のAI解析上限20回に達しました',
Icon(LucideIcons.zap, color: Colors.orange, size: 16),
SizedBox(width: 8),
Text('本日のAI解析上限20回に達しました',
style: TextStyle(fontWeight: FontWeight.bold)),
],
),
@ -108,7 +107,7 @@ mixin CameraAnalysisMixin<T extends ConsumerStatefulWidget> on ConsumerState<T>
],
),
duration: const Duration(seconds: 6),
backgroundColor: appColors.warning,
backgroundColor: Colors.orange,
),
);
navigator.pop(); //
@ -116,7 +115,7 @@ mixin CameraAnalysisMixin<T extends ConsumerStatefulWidget> on ConsumerState<T>
debugPrint('Draft save error (quota): $e');
if (!mounted) return;
messenger.showSnackBar(
const SnackBar(content: Text('写真の一時保存に失敗しました。再度お試しください。')),
SnackBar(content: Text('保存エラー: $e')),
);
}
return;
@ -225,27 +224,30 @@ mixin CameraAnalysisMixin<T extends ConsumerStatefulWidget> on ConsumerState<T>
navigator.pop(); // Close Camera Screen (Return to Home)
// Success Message
final isDark = Theme.of(context).brightness == Brightness.dark;
final List<Widget> messageWidgets = [
Text('${sakeItem.displayData.displayName} を登録しました!'),
];
if (result.isFromCache) {
messageWidgets.add(const SizedBox(height: 4));
messageWidgets.add(Text(
messageWidgets.add(const Text(
'※ 解析済みの結果を使用(経験値なし)',
style: TextStyle(fontSize: 12, color: appColors.textTertiary),
style: TextStyle(fontSize: 12, color: Colors.grey),
));
} else {
messageWidgets.add(const SizedBox(height: 4));
messageWidgets.add(Row(
children: [
Icon(LucideIcons.sparkles, color: appColors.brandAccent, size: 16),
Icon(LucideIcons.sparkles,
color: isDark ? Colors.yellow.shade300 : Colors.yellow,
size: 16),
const SizedBox(width: 8),
Text(
'経験値 +$expGained GET!${isLevelUp ? " (Level UP!)" : ""}',
style: TextStyle(
fontWeight: FontWeight.bold,
color: appColors.brandAccent,
color: isDark ? Colors.yellow.shade200 : Colors.yellowAccent,
),
),
],
@ -264,7 +266,7 @@ mixin CameraAnalysisMixin<T extends ConsumerStatefulWidget> on ConsumerState<T>
'バッジ獲得: ${badge.name}',
style: TextStyle(
fontWeight: FontWeight.bold,
color: appColors.success,
color: isDark ? Colors.green.shade300 : Colors.greenAccent,
),
),
],
@ -295,25 +297,25 @@ mixin CameraAnalysisMixin<T extends ConsumerStatefulWidget> on ConsumerState<T>
if (!mounted) return;
navigator.pop(); // Close camera screen
messenger.showSnackBar(
SnackBar(
const SnackBar(
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Row(
Row(
children: [
Icon(LucideIcons.cloudOff, color: Colors.white, size: 16),
SizedBox(width: 8),
Text('AIサーバー混雑', style: TextStyle(fontWeight: FontWeight.bold)),
],
),
const SizedBox(height: 4),
const Text('写真を「解析待ち」として保存しました。'),
const Text('時間をおいてホーム画面から解析できます。'),
SizedBox(height: 4),
Text('写真を「解析待ち」として保存しました。'),
Text('時間をおいてホーム画面から解析できます。'),
],
),
duration: const Duration(seconds: 5),
backgroundColor: appColors.warning,
duration: Duration(seconds: 5),
backgroundColor: Colors.orange,
),
);
} catch (draftError) {
@ -331,7 +333,6 @@ mixin CameraAnalysisMixin<T extends ConsumerStatefulWidget> on ConsumerState<T>
if (errStr.contains('Quota') || errStr.contains('429')) {
try {
await DraftService.saveDraft(capturedImages, reason: DraftReason.quotaLimit);
ref.read(quotaLockoutProvider.notifier).set(DateTime.now().add(const Duration(minutes: 1)));
if (!mounted) return;
navigator.pop(); //
final resetTime = ApiUsageService.getNextResetTime();
@ -344,7 +345,7 @@ mixin CameraAnalysisMixin<T extends ConsumerStatefulWidget> on ConsumerState<T>
children: [
const Row(
children: [
Icon(LucideIcons.zap, color: Colors.white, size: 16),
Icon(LucideIcons.zap, color: Colors.orange, size: 16),
SizedBox(width: 8),
Text('本日のAI解析上限20回に達しました',
style: TextStyle(fontWeight: FontWeight.bold)),
@ -356,7 +357,7 @@ mixin CameraAnalysisMixin<T extends ConsumerStatefulWidget> on ConsumerState<T>
],
),
duration: const Duration(seconds: 6),
backgroundColor: appColors.warning,
backgroundColor: Colors.orange,
),
);
} catch (draftError) {
@ -369,10 +370,10 @@ mixin CameraAnalysisMixin<T extends ConsumerStatefulWidget> on ConsumerState<T>
return;
}
debugPrint('Analysis error: $e');
final appColors = Theme.of(context).extension<AppColors>()!;
messenger.showSnackBar(
SnackBar(
content: const Text('解析に失敗しました。時間をおいて再試行してください。'),
content: Text('解析エラー: $e'),
duration: const Duration(seconds: 5),
backgroundColor: appColors.error,
),

View File

@ -10,7 +10,6 @@ import 'package:gal/gal.dart';
import 'package:lucide_icons/lucide_icons.dart';
import 'package:image_picker/image_picker.dart'; // Gallery & Camera
import '../providers/quota_lockout_provider.dart';
import '../services/image_compression_service.dart';
import '../theme/app_colors.dart';
import 'camera_analysis_mixin.dart';
@ -166,11 +165,10 @@ class _CameraScreenState extends ConsumerState<CameraScreen> with SingleTickerPr
Future<void> _takePicture() async {
// Check Quota Lockout
final quotaLockout = ref.read(quotaLockoutProvider);
if (quotaLockout != null) {
final remaining = quotaLockout.difference(DateTime.now());
if (quotaLockoutTime != null) {
final remaining = quotaLockoutTime!.difference(DateTime.now());
if (remaining.isNegative) {
ref.read(quotaLockoutProvider.notifier).set(null);
setState(() => quotaLockoutTime = null); // Reset
} else {
final appColors = Theme.of(context).extension<AppColors>()!;
ScaffoldMessenger.of(context).showSnackBar(
@ -225,7 +223,7 @@ class _CameraScreenState extends ConsumerState<CameraScreen> with SingleTickerPr
final appColors = Theme.of(context).extension<AppColors>()!;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text('ギャラリーへの保存に失敗しました'),
content: Text('ギャラリー保存に失敗しました: $e'),
duration: const Duration(seconds: 4),
backgroundColor: appColors.warning,
),
@ -303,7 +301,6 @@ class _CameraScreenState extends ConsumerState<CameraScreen> with SingleTickerPr
// Batch handle - Notification only
if (mounted) {
final appColors = Theme.of(context).extension<AppColors>()!;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('${images.length}枚の画像を読み込みました。\n右下のボタンから解析を開始してください。'),
@ -311,7 +308,7 @@ class _CameraScreenState extends ConsumerState<CameraScreen> with SingleTickerPr
action: SnackBarAction(
label: '解析する',
onPressed: analyzeImages,
textColor: appColors.brandAccent,
textColor: Colors.yellow,
),
),
);
@ -370,8 +367,6 @@ class _CameraScreenState extends ConsumerState<CameraScreen> with SingleTickerPr
@override
Widget build(BuildContext context) {
final quotaLockout = ref.watch(quotaLockoutProvider);
final appColors = Theme.of(context).extension<AppColors>()!;
if (_cameraError != null) {
return Scaffold(
backgroundColor: Colors.black,
@ -569,22 +564,22 @@ class _CameraScreenState extends ConsumerState<CameraScreen> with SingleTickerPr
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: quotaLockout != null ? appColors.error : Colors.white,
color: quotaLockoutTime != null ? Colors.red : Colors.white,
width: 4
),
color: _isTakingPicture
? Colors.white.withValues(alpha: 0.5)
: (quotaLockout != null ? appColors.error.withValues(alpha: 0.2) : Colors.transparent),
: (quotaLockoutTime != null ? Colors.red.withValues(alpha: 0.2) : Colors.transparent),
),
child: Center(
child: quotaLockout != null
child: quotaLockoutTime != null
? const Icon(LucideIcons.timer, color: Colors.white, size: 30)
: Container(
height: 60,
width: 60,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: quotaLockout != null ? appColors.textTertiary : Colors.white,
color: quotaLockoutTime != null ? Colors.grey : Colors.white,
),
),
),
@ -596,7 +591,7 @@ class _CameraScreenState extends ConsumerState<CameraScreen> with SingleTickerPr
IconButton(
icon: Badge(
label: Text('${capturedImages.length}'),
child: Icon(LucideIcons.playCircle, color: appColors.success, size: 40),
child: const Icon(LucideIcons.playCircle, color: Colors.greenAccent, size: 40),
),
onPressed: analyzeImages,
tooltip: '解析を開始',

View File

@ -58,9 +58,8 @@ class _SommelierScreenState extends ConsumerState<SommelierScreen> {
);
} catch (e) {
if (mounted) {
debugPrint('Share error: $e');
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('シェアに失敗しました。再度お試しください。')),
SnackBar(content: Text('シェアに失敗しました: $e')),
);
}
} finally {
@ -542,7 +541,7 @@ class _SommelierScreenState extends ConsumerState<SommelierScreen> {
debugPrint('Diagnosis Error: $e');
if (!mounted) return;
navigator.pop();
messenger.showSnackBar(const SnackBar(content: Text('診断に失敗しました。時間をおいて再試行してください。')));
messenger.showSnackBar(SnackBar(content: Text('エラー: $e')));
}
}

View File

@ -95,7 +95,7 @@ class PdfPreviewScreen extends ConsumerWidget {
],
),
loadingWidget: const Center(child: CircularProgressIndicator()),
onError: (context, error) => const Center(child: Text('PDFの表示に失敗しました')),
onError: (context, error) => Center(child: Text('エラーが発生しました: $error')),
),
bottomNavigationBar: SafeArea(
child: Column(
@ -246,10 +246,9 @@ class PdfPreviewScreen extends ConsumerWidget {
filename: 'oshinagaki_${DateTime.now().toString().split(' ')[0]}.pdf',
);
} catch (e) {
debugPrint('PDF share error: $e');
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('PDFの共有に失敗しました。再度お試しください。')),
SnackBar(content: Text('共有エラー: $e')),
);
}
}
@ -285,7 +284,7 @@ class PdfPreviewScreen extends ConsumerWidget {
..name = fileName
..mimeType = 'application/pdf';
debugPrint('[PDF_DRIVE] Upload start: $fileName (${bytes.length} bytes)');
debugPrint('[PDF_DRIVE] 📤 アップロード開始: $fileName (${bytes.length} bytes)');
final uploadedFile = await driveApi.files.create(
driveFile,
uploadMedia: drive.Media(
@ -295,11 +294,11 @@ class PdfPreviewScreen extends ConsumerWidget {
);
if (uploadedFile.id == null) {
debugPrint('[PDF_DRIVE] Upload failed: no file ID returned');
debugPrint('[PDF_DRIVE] ❌ アップロード失敗: ID取得不可');
throw Exception('アップロードに失敗しましたIDなし');
}
debugPrint('[PDF_DRIVE] Upload complete: ID=${uploadedFile.id}');
debugPrint('[PDF_DRIVE] ✅ アップロード完了: ID=${uploadedFile.id}');
// 5. Success notification
if (context.mounted) {
@ -315,12 +314,11 @@ class PdfPreviewScreen extends ConsumerWidget {
);
}
} catch (e) {
debugPrint('Drive upload error: $e');
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Google Driveへの保存に失敗しました。再度お試しください。'),
duration: Duration(seconds: 4),
SnackBar(
content: Text('Driveアップロードエラー: $e'),
duration: const Duration(seconds: 4),
),
);
}
@ -338,10 +336,9 @@ class PdfPreviewScreen extends ConsumerWidget {
format: _getPageFormat(pdfSize, ref.read(pdfIsPortraitProvider)),
);
} catch (e) {
debugPrint('Print error: $e');
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('印刷に失敗しました。再度お試しください。')),
SnackBar(content: Text('印刷エラー: $e')),
);
}
}

View File

@ -194,11 +194,10 @@ class _PendingAnalysisScreenState extends ConsumerState<PendingAnalysisScreen> {
}
} catch (e) {
if (!mounted) return;
debugPrint('Draft delete error: $e');
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('削除に失敗しました。再度お試しください。'),
duration: Duration(seconds: 5),
SnackBar(
content: Text('削除エラー: $e'),
duration: const Duration(seconds: 5),
),
);
}

View File

@ -101,7 +101,7 @@ class SakeBasicInfoSection extends ConsumerWidget {
decoration: BoxDecoration(
color: badgeColor!.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(20),
border: Border.all(color: badgeColor.withValues(alpha: 0.4)),
border: Border.all(color: badgeColor!.withValues(alpha: 0.4)),
),
child: Row(
mainAxisSize: MainAxisSize.min,
@ -109,7 +109,7 @@ class SakeBasicInfoSection extends ConsumerWidget {
Icon(LucideIcons.brainCircuit, size: 12, color: badgeColor),
const SizedBox(width: 4),
Text(
'$mbtiType ${mbtiResult.starDisplay}',
'$mbtiType ${mbtiResult!.starDisplay}',
style: TextStyle(
color: badgeColor,
fontWeight: FontWeight.bold,

View File

@ -234,10 +234,9 @@ class _SakePhotoEditModalState extends State<SakePhotoEditModal> {
await _saveNewPhoto(savedPath);
} catch (e) {
debugPrint('Photo pick error: $e');
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('写真の追加に失敗しました。再度お試しください。')),
SnackBar(content: Text('エラー: $e')),
);
}
}

View File

@ -19,7 +19,6 @@ import '../widgets/sake_detail/sake_detail_specs.dart';
import 'sake_detail/widgets/sake_photo_edit_modal.dart';
import 'sake_detail/sections/sake_mbti_stamp_section.dart';
import '../providers/license_provider.dart';
import '../providers/quota_lockout_provider.dart';
import 'sake_detail/sections/sake_basic_info_section.dart';
import 'sake_detail/widgets/sake_detail_sliver_app_bar.dart';
import '../services/mbti_compatibility_service.dart';
@ -37,9 +36,10 @@ class SakeDetailScreen extends ConsumerStatefulWidget {
}
class _SakeDetailScreenState extends ConsumerState<SakeDetailScreen> {
// To trigger rebuilds if we don't switch to a stream
late SakeItem _sake;
int _currentImageIndex = 0;
bool _isAnalyzing = false;
// Memo logic moved to SakeDetailMemo
@override
@ -119,12 +119,15 @@ class _SakeDetailScreenState extends ConsumerState<SakeDetailScreen> {
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Theme.of(context).scaffoldBackgroundColor,
Theme.of(context).brightness == Brightness.dark
? appColors.brandSurface
: Theme.of(context).primaryColor.withValues(alpha: 0.05),
],
colors: Theme.of(context).brightness == Brightness.dark
? [
const Color(0xFF121212), // Scaffold Background
const Color(0xFF1E1E1E), // Slightly lighter surface
]
: [
Theme.of(context).scaffoldBackgroundColor,
Theme.of(context).primaryColor.withValues(alpha: 0.05),
],
),
),
padding: const EdgeInsets.all(24.0),
@ -278,6 +281,10 @@ class _SakeDetailScreenState extends ConsumerState<SakeDetailScreen> {
);
}
bool _isAnalyzing = false;
DateTime? _quotaLockoutTime;
Future<void> _toggleFavorite() async {
HapticFeedback.mediumImpact();
final box = Hive.box<SakeItem>('sake_items');
@ -302,18 +309,13 @@ class _SakeDetailScreenState extends ConsumerState<SakeDetailScreen> {
// 1. Check Locks
if (_isAnalyzing) return;
// async gap context
final nav = Navigator.of(context);
final messenger = ScaffoldMessenger.of(context);
// 2. Check Quota Lockout
final quotaLockout = ref.read(quotaLockoutProvider);
if (quotaLockout != null) {
final remaining = quotaLockout.difference(DateTime.now());
if (_quotaLockoutTime != null) {
final remaining = _quotaLockoutTime!.difference(DateTime.now());
if (remaining.isNegative) {
ref.read(quotaLockoutProvider.notifier).set(null);
setState(() => _quotaLockoutTime = null); // Reset if time passed
} else {
messenger.showSnackBar(
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('AI利用制限中です。あと${remaining.inSeconds}秒お待ちください。')),
);
return;
@ -330,6 +332,8 @@ class _SakeDetailScreenState extends ConsumerState<SakeDetailScreen> {
}
}
if (!mounted) return;
final nav = Navigator.of(context);
final messenger = ScaffoldMessenger.of(context);
if (existingPaths.isEmpty) {
messenger.showSnackBar(
@ -341,8 +345,13 @@ class _SakeDetailScreenState extends ConsumerState<SakeDetailScreen> {
setState(() => _isAnalyzing = true);
try {
// ignore: use_build_context_synchronously
showDialog(context: context, barrierDismissible: false, builder: (context) => const AnalyzingDialog());
// ignore: use_build_context_synchronously
// mounted 334 await
showDialog(
context: context,
barrierDismissible: false,
builder: (context) => const AnalyzingDialog(),
);
final geminiService = ref.read(geminiServiceProvider);
final result = await geminiService.analyzeSakeLabel(existingPaths, forceRefresh: true);
@ -387,12 +396,13 @@ class _SakeDetailScreenState extends ConsumerState<SakeDetailScreen> {
// Check for Quota Error to set Lockout
if (e.toString().contains('Quota') || e.toString().contains('429')) {
ref.read(quotaLockoutProvider.notifier).set(DateTime.now().add(const Duration(minutes: 1)));
setState(() {
_quotaLockoutTime = DateTime.now().add(const Duration(minutes: 1));
});
}
debugPrint('Reanalyze error: $e');
messenger.showSnackBar(
const SnackBar(content: Text('再解析に失敗しました。時間をおいて再試行してください。')),
SnackBar(content: Text('エラー: $e')),
);
}
} finally {
@ -403,11 +413,11 @@ class _SakeDetailScreenState extends ConsumerState<SakeDetailScreen> {
}
Future<void> _showTagEditDialog(BuildContext context) async {
void _showTagEditDialog(BuildContext context) {
final TextEditingController tagController = TextEditingController();
final allTags = _sake.hiddenSpecs.flavorTags.toSet();
try {
await showDialog(
showDialog(
context: context,
builder: (ctx) => StatefulBuilder(
builder: (context, setModalState) {
@ -488,9 +498,6 @@ class _SakeDetailScreenState extends ConsumerState<SakeDetailScreen> {
}
),
);
} finally {
tagController.dispose();
}
}
Future<void> _updateTags(List<String> newTags) async {
@ -574,37 +581,33 @@ class _SakeDetailScreenState extends ConsumerState<SakeDetailScreen> {
required Future<void> Function(String) onSave,
}) async {
final controller = TextEditingController(text: initialValue);
try {
await showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(title),
content: TextField(
controller: controller,
decoration: const InputDecoration(
border: OutlineInputBorder(),
),
autofocus: true,
maxLines: null,
await showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(title),
content: TextField(
controller: controller,
decoration: const InputDecoration(
border: OutlineInputBorder(),
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('キャンセル'),
),
ElevatedButton(
onPressed: () async {
await onSave(controller.text);
if (context.mounted) Navigator.pop(context);
},
child: const Text('保存'),
),
],
autofocus: true,
maxLines: null,
),
);
} finally {
controller.dispose();
}
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('キャンセル'),
),
ElevatedButton(
onPressed: () async {
await onSave(controller.text);
if (context.mounted) Navigator.pop(context);
},
child: const Text('保存'),
),
],
),
);
}
/// MBTI相性詳細ダイアログを表示
@ -729,57 +732,52 @@ class _SakeDetailScreenState extends ConsumerState<SakeDetailScreen> {
Future<void> _showBreweryEditDialog(BuildContext context) async {
final breweryController = TextEditingController(text: _sake.displayData.displayBrewery);
final prefectureController = TextEditingController(text: _sake.displayData.displayPrefecture);
try {
await showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('酒蔵・都道府県を編集'),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextField(
controller: breweryController,
decoration: const InputDecoration(
labelText: '酒蔵',
border: OutlineInputBorder(),
),
await showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('酒蔵・都道府県を編集'),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextField(
controller: breweryController,
decoration: const InputDecoration(
labelText: '酒蔵',
border: OutlineInputBorder(),
),
const SizedBox(height: 16),
TextField(
controller: prefectureController,
decoration: const InputDecoration(
labelText: '都道府県',
border: OutlineInputBorder(),
),
),
],
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('キャンセル'),
),
ElevatedButton(
onPressed: () async {
final box = Hive.box<SakeItem>('sake_items');
final updated = _sake.copyWith(
brand: breweryController.text,
prefecture: prefectureController.text,
isUserEdited: true,
);
await box.put(_sake.key, updated);
setState(() => _sake = updated);
if (context.mounted) Navigator.pop(context);
},
child: const Text('保存'),
const SizedBox(height: 16),
TextField(
controller: prefectureController,
decoration: const InputDecoration(
labelText: '都道府県',
border: OutlineInputBorder(),
),
),
],
),
);
} finally {
breweryController.dispose();
prefectureController.dispose();
}
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('キャンセル'),
),
ElevatedButton(
onPressed: () async {
final box = Hive.box<SakeItem>('sake_items');
final updated = _sake.copyWith(
brand: breweryController.text,
prefecture: prefectureController.text,
isUserEdited: true,
);
await box.put(_sake.key, updated);
setState(() => _sake = updated);
if (context.mounted) Navigator.pop(context);
},
child: const Text('保存'),
),
],
),
);
}
///

View File

@ -77,10 +77,10 @@ class _ScanARScreenState extends ConsumerState<ScanARScreen>
_isInitializing = false;
});
}
debugPrint('[Scanner] Controller created successfully');
debugPrint('✅ Scanner: Controller created successfully');
} catch (e) {
debugPrint('[Scanner] Error during initialization: $e');
debugPrint('❌ Scanner: Error during initialization: $e');
if (mounted) {
setState(() {
_isInitializing = false;
@ -395,7 +395,7 @@ class _DigitalSakeCardDialog extends StatelessWidget {
const SizedBox(height: 8),
Text(
'$brewery / $prefecture',
style: TextStyle(fontSize: 14, color: appColors.textTertiary),
style: const TextStyle(fontSize: 14, color: Colors.grey),
),
const SizedBox(height: 20),

View File

@ -148,22 +148,17 @@ class LicenseService {
if (cached == null) return LicenseStatus.free;
// _validateKeyWithServer
// _getCachedStatus
//
// TTL _cacheValidSeconds = 24h:
// - free / offline free
// - pro :
// - revoked:
// TTL isNoExpiryStatus
// freeにフォールバック
// pro revoked proは購入者を締め出さないrevokedは誤って復活させない
if (cachedAt != null) {
final age = DateTime.now().difference(DateTime.parse(cachedAt));
final isNoExpiryStatus = cached == LicenseStatus.pro.name || cached == LicenseStatus.revoked.name;
if (age.inSeconds > _cacheValidSeconds && !isNoExpiryStatus) {
final isPermanentStatus = cached == LicenseStatus.pro.name || cached == LicenseStatus.revoked.name;
if (age.inSeconds > _cacheValidSeconds && !isPermanentStatus) {
return LicenseStatus.free;
}
}
// Pro
return LicenseStatus.values.firstWhere(
(s) => s.name == cached,
orElse: () => LicenseStatus.free,

View File

@ -104,7 +104,7 @@ class _AddSetItemDialogState extends ConsumerState<AddSetItemDialog> {
final newlyUnlockedBadges = await GamificationService.checkAndUnlockBadges(ref);
if (newlyUnlockedBadges.isNotEmpty) {
debugPrint('[Gamification] Badges Unlocked: ${newlyUnlockedBadges.map((b) => b.name).join(", ")}');
debugPrint('🏅 Badges Unlocked: ${newlyUnlockedBadges.map((b) => b.name).join(", ")}');
}
if (mounted) {

View File

@ -37,7 +37,7 @@ class ActivityStats extends ConsumerWidget {
final apiColor = isExhausted
? appColors.error
: isLow
? appColors.warning
? Colors.orange
: appColors.brandPrimary;
// Bento Grid: 2
@ -192,7 +192,7 @@ class ActivityStats extends ConsumerWidget {
const SizedBox(height: 6),
Text(
'残り$remaining回です',
style: TextStyle(fontSize: 10, color: appColors.warning),
style: const TextStyle(fontSize: 10, color: Colors.orange),
),
],
],

View File

@ -2,21 +2,19 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../providers/filter_providers.dart';
import 'package:lucide_icons/lucide_icons.dart';
import '../../theme/app_colors.dart';
class SakeNoMatchState extends ConsumerWidget {
const SakeNoMatchState({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final appColors = Theme.of(context).extension<AppColors>()!;
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(LucideIcons.filterX, size: 48, color: appColors.textTertiary),
Icon(LucideIcons.filterX, size: 48, color: Colors.grey[400]),
const SizedBox(height: 16),
Text('条件に一致するお酒が見つかりません', style: TextStyle(color: appColors.textTertiary)),
Text('条件に一致するお酒が見つかりません', style: TextStyle(color: Colors.grey[600])),
TextButton(
child: const Text('フィルタを解除'),
onPressed: () {

View File

@ -3,7 +3,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:lucide_icons/lucide_icons.dart';
import '../services/draft_service.dart';
import '../screens/pending_analysis_screen.dart';
import '../theme/app_colors.dart';
/// Draft
///
@ -25,21 +24,19 @@ class PendingAnalysisBanner extends ConsumerWidget {
return const SizedBox.shrink();
}
final appColors = Theme.of(context).extension<AppColors>()!;
return Container(
margin: const EdgeInsets.all(12),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
appColors.warning,
appColors.warning.withValues(alpha: 0.85),
Colors.orange.shade600,
Colors.orange.shade400,
],
),
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: appColors.warning.withValues(alpha: 0.3),
color: Colors.orange.withValues(alpha: 0.3),
blurRadius: 8,
offset: const Offset(0, 2),
),
@ -101,7 +98,7 @@ class PendingAnalysisBanner extends ConsumerWidget {
child: Text(
'$pendingCount件',
style: TextStyle(
color: appColors.warning,
color: Colors.orange.shade700,
fontSize: 14,
fontWeight: FontWeight.bold,
),

View File

@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.43+50
version: 1.0.42+49
environment:
sdk: ^3.10.1
@ -35,8 +35,8 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
google_fonts: ^6.3.3
flutter_riverpod: ^3.1.0
riverpod_annotation: 3.0.0-dev.3
flutter_riverpod:
riverpod_annotation:
hive: ^2.2.3
hive_flutter: ^1.1.0
google_generative_ai: ^0.4.7
@ -85,7 +85,7 @@ dev_dependencies:
flutter_lints: ^6.0.0
build_runner:
hive_generator:
riverpod_generator: 3.0.0-dev.11
riverpod_generator:
flutter_launcher_icons: ^0.13.1
flutter_native_splash: ^2.4.4

View File

@ -1,21 +1,21 @@
{
"version": "v1.0.43",
"name": "Ponshu Room 1.0.43 (2026-04-18)",
"date": "2026-04-18",
"apks": {
"maita": {
"lite": {
"filename": "ponshu_room_consumer_maita.apk",
"url": "https://posimai-lab.tail72e846.ts.net/mai/ponshu-room-lite/releases/download/v1.0.43/ponshu_room_consumer_maita.apk",
"size_mb": 89
}
},
"eiji": {
"lite": {
"filename": "ponshu_room_consumer_eiji.apk",
"url": "https://posimai-lab.tail72e846.ts.net/mai/ponshu-room-lite/releases/download/v1.0.43/ponshu_room_consumer_eiji.apk",
"size_mb": 89
}
}
}
{
"date": "2026-04-16",
"name": "Ponshu Room 1.0.42 (2026-04-16)",
"version": "v1.0.42",
"apks": {
"eiji": {
"lite": {
"url": "https://posimai-lab.tail72e846.ts.net/mai/ponshu-room-lite/releases/download/v1.0.42/ponshu_room_consumer_eiji.apk",
"size_mb": 89.2,
"filename": "ponshu_room_consumer_eiji.apk"
}
},
"maita": {
"lite": {
"url": "https://posimai-lab.tail72e846.ts.net/mai/ponshu-room-lite/releases/download/v1.0.42/ponshu_room_consumer_maita.apk",
"size_mb": 89.2,
"filename": "ponshu_room_consumer_maita.apk"
}
}
}
}