From 0616d6944f9b2f31e3482a7f583995267bd6526c Mon Sep 17 00:00:00 2001 From: PiscesXD Date: Mon, 14 Sep 2026 23:11:27 +0800 Subject: [PATCH] fix(earthquake): align report day headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix(zh-Hant): 地震報告日期與筆數固定對齊 Fix(en-US): align earthquake report dates and counts consistently --- .../presentation/pages/report_list_page.dart | 77 ++++++++++--------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/lib/features/earthquake/presentation/pages/report_list_page.dart b/lib/features/earthquake/presentation/pages/report_list_page.dart index 15f8fafe4..1d21a38d0 100644 --- a/lib/features/earthquake/presentation/pages/report_list_page.dart +++ b/lib/features/earthquake/presentation/pages/report_list_page.dart @@ -244,39 +244,47 @@ class _DaySection extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.only( - left: AppSpacing.xs, - bottom: AppSpacing.sm, - ), - child: Row( - children: [ - Flexible( - child: Text( - _dayLabel(day, l10n, locale), - style: theme.textTheme.titleSmall?.copyWith( - color: colors.primary, - fontWeight: FontWeight.w700, + SizedBox( + width: double.infinity, + child: Padding( + padding: const EdgeInsets.only( + left: AppSpacing.xs, + bottom: AppSpacing.sm, + ), + child: Row( + children: [ + Expanded( + child: FittedBox( + fit: BoxFit.scaleDown, + alignment: Alignment.centerLeft, + child: Text( + _dayLabel(day, l10n, locale), + softWrap: false, + style: theme.textTheme.titleSmall?.copyWith( + color: colors.primary, + fontWeight: FontWeight.w700, + ), + ), ), ), - ), - const SizedBox(width: AppSpacing.sm), - Expanded( - child: Divider( - height: 1, - thickness: 1, - color: colors.outlineVariant.withValues(alpha: 0.55), + const SizedBox(width: AppSpacing.sm), + Expanded( + child: Divider( + height: 1, + thickness: 1, + color: colors.outlineVariant.withValues(alpha: 0.55), + ), ), - ), - const SizedBox(width: AppSpacing.sm), - Text( - l10n.reportListDayCount(reports.length), - style: theme.textTheme.labelMedium?.copyWith( - color: colors.onSurfaceVariant, - fontFeatures: const [FontFeature.tabularFigures()], + const SizedBox(width: AppSpacing.sm), + Text( + l10n.reportListDayCount(reports.length), + style: theme.textTheme.labelMedium?.copyWith( + color: colors.onSurfaceVariant, + fontFeatures: const [FontFeature.tabularFigures()], + ), ), - ), - ], + ], + ), ), ), Material( @@ -310,20 +318,13 @@ class _DaySection extends StatelessWidget { } else if (day == today.subtract(const Duration(days: 1))) { relative = l10n.reportListYesterday; } - if (relative != null) { - final date = _relativeDayFormats - .putIfAbsent(locale, () => DateFormat.yMMMd(locale)) - .format(day); - return '$relative ($date)'; - } - // Parsing a locale's pattern is not free — memoised per locale. - return _dayFormats + final date = _dayFormats .putIfAbsent(locale, () => DateFormat.yMMMEd(locale)) .format(day); + return relative == null ? date : '$date ($relative)'; } static final Map _dayFormats = {}; - static final Map _relativeDayFormats = {}; } class _ReportTile extends StatelessWidget {