diff --git a/lib/screens/sake_detail/sections/sake_basic_info_section.dart b/lib/screens/sake_detail/sections/sake_basic_info_section.dart index 7aedffd..1cc620e 100644 --- a/lib/screens/sake_detail/sections/sake_basic_info_section.dart +++ b/lib/screens/sake_detail/sections/sake_basic_info_section.dart @@ -8,6 +8,10 @@ import '../../../constants/app_constants.dart'; import '../../../providers/theme_provider.dart'; import '../../../services/mbti_compatibility_service.dart'; +String _formatRecordedDate(DateTime date) { + return '${date.year}年${date.month}月${date.day}日に記録'; +} + /// 銘柄名・蔵元/都道府県・タグ・AI確信度バッジ・MBTI相性バッジ・キャッチコピーを表示するセクション class SakeBasicInfoSection extends ConsumerWidget { final SakeItem sake; @@ -161,6 +165,24 @@ class SakeBasicInfoSection extends ConsumerWidget { ), ), ), + const SizedBox(height: 8), + + // 記録日 + if (sake.itemType != ItemType.set) + Center( + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(LucideIcons.calendarDays, size: 11, color: appColors.textTertiary), + const SizedBox(width: 4), + Text( + _formatRecordedDate(sake.metadata.createdAt), + style: TextStyle(fontSize: 11, color: appColors.textTertiary), + ), + ], + ), + ), + const SizedBox(height: 20), // キャッチコピー(位置を銘柄名直下に移動して存在感を強調) diff --git a/lib/widgets/home/sake_list_item.dart b/lib/widgets/home/sake_list_item.dart index 195f75c..9ff50ce 100644 --- a/lib/widgets/home/sake_list_item.dart +++ b/lib/widgets/home/sake_list_item.dart @@ -188,6 +188,8 @@ class SakeListItem extends ConsumerWidget { if (!isMenuMode && sake.itemType != ItemType.set) ...[ const SizedBox(height: 6), _buildSpecLine(context, appColors), + const SizedBox(height: 4), + _buildRecordedDate(appColors), ], ], ), @@ -200,6 +202,36 @@ class SakeListItem extends ConsumerWidget { ); // Pressable } + /// 記録日(相対表示) + Widget _buildRecordedDate(AppColors appColors) { + final date = sake.metadata.createdAt; + final now = DateTime.now(); + final today = DateTime(now.year, now.month, now.day); + final itemDay = DateTime(date.year, date.month, date.day); + final diff = today.difference(itemDay).inDays; + + final String label; + if (diff == 0) { + label = '今日'; + } else if (diff == 1) { + label = '昨日'; + } else if (diff < 7) { + label = '$diff日前'; + } else if (date.year == now.year) { + label = '${date.month}/${date.day}'; + } else { + label = '${date.year}/${date.month}/${date.day}'; + } + + return Text( + label, + style: TextStyle( + fontSize: 10, + color: appColors.textTertiary, + ), + ); + } + /// 特定名称 + アルコール度数(どちらもある場合は両方、片方のみも対応) Widget _buildSpecLine(BuildContext context, AppColors appColors) { final type = sake.hiddenSpecs.type;