Skip to content

雨量圖例修復、地震報告與重播地圖的圖層選單 - #555

Open
PiscesXD wants to merge 2 commits into
mainfrom
fix-map
Open

雨量圖例修復、地震報告與重播地圖的圖層選單#555
PiscesXD wants to merge 2 commits into
mainfrom
fix-map

Conversation

@PiscesXD

@PiscesXD PiscesXD commented Aug 25, 2026

Copy link
Copy Markdown
Member

摘要

修復雨量圖例的兩個渲染問題(色帶整條消失、展開即拋 layout assertion),並為地震報告詳情頁與重播頁的地圖加上跟強震監視器一樣的右上角圖層選單——詳細街道圖(OSM)、地形立體感、鄉鎮名稱,設定全部存進 sqlite、與地圖頁共用。

變更內容

🐛 雨量圖例修復

兩個互相獨立的壞因,任一個都會讓雨量圖例變得不可用:

  • 色帶整條隱形:色帶的 ColoredBox 沒有 intrinsic width,在 Column 預設 cross axis 下被 loose constraints 縮成零寬——邊界數字照常渲染,但數字左邊完全沒有顏色。改為 CrossAxisAlignment.stretch 讓每個色塊填滿 swatch 寬度。
  • 展開即拋 layout assertion:邊界標籤欄是 Row 裡的一個 Stack,而 Stack 拒絕無界寬度——圖例放在收合 chip(AnimatedSize)裡,展開瞬間每幀拋 assertion,debug 下圖例根本長不出來。改為以 TextPainter 量測最寬標籤、讓標籤欄自帶寬度(含文字縮放)。

新增回歸測試:在 chip 內展開、semantics 開啟(對齊 VoiceOver 場景),斷言無例外且 17 個 CWA 色塊各 8px 寬。

🗺️ 地震報告/重播地圖的圖層選單

  • 詳情頁與重播頁地圖右上角新增跟強震監視器同一個 MapBasemapMenu:詳細街道圖(OSM)、地形立體感、鄉鎮名稱三個 toggle;指南針移到選單下方,與其他頁一致
  • 三個設定經 SettingsStore 寫入 sqlite 的 settings 表,與地圖頁共用同一組 key——任何一頁切換,其他頁跟著變,重開 app 也維持
  • 詳情頁:sheet 完全展開時右上角與左上角返回鍵一起隱藏(同一個 _sheetExpanded 模式);重播頁沒有 sheet,控制項常駐

♻️ 共用基礎

  • MapScaffold 的基底圖層同步迴圈(terrain / OSM 的 add-remove 與互斥、style reload 重置)抽成共用的 BasemapOverlaySync——地圖頁、詳情頁、重播頁三個 surface 用同一份實作
  • RecordingMapController 補上 8 個測試:terrain 掛載/移除、GSI 掛載/拆除/群組可見性批次更新、style reload 後的狀態重置、controller 換手中止同步

測試

  • tool/check.sh 全綠(format / analyze / l10n / layering / storage / codegen / 1724 tests)
  • 新增 basemap_overlay_sync_test.dart(8 tests)與 rain_legend_test.dart(1 test,先驗證過對未修復程式碼會失敗)

怎麼驗

  1. 地圖頁 > 圖層 > 雨量:展開左上角圖例——17 段 CWA 色帶與右側數字都在,數字左側緊鄰對應顏色
  2. 資料 > 地震報告 > 任一報告:右上角 tune 選單切換詳細街道圖/地形立體感/鄉鎮名稱,立即生效;殺掉 app 重開,設定維持
  3. 同報告按「重播」:右上角同樣的選單可用
  4. 詳情頁把 sheet 拉到全開:右上角控制項與左上角返回鍵一起消失;拉回後重現

備註

  • 所有新 UI 字串皆沿用既有 l10n key(MapBasemapMenu 及其列),無新增 ARB
  • 已知既有問題(本 PR 未處理):重播較舊的報告時,伺服器的 RTS 快照已過保留期限,輪詢會持續 404 並刷 log——另案處理

The banded (CWA) legend had two independent failures, either of which
made the 雨量 legend useless:
- the swatch cells are plain ColoredBoxes (no intrinsic width), so under
  the Column's default cross axis they collapsed to zero and the whole
  band strip vanished — the boundary numbers kept rendering with no
  colour beside them;
- the boundary-label column is a Stack inside a Row, and a Stack refuses
  unbounded width, so expanding the legend inside the collapsed chip
  (AnimatedSize) threw a layout assertion every frame and, in debug, the
  legend never appeared at all. The column now measures the widest label
  and carries its own width (text scaling included).

Fix(zh-Hant): 雨量圖例的色階色帶恢復顯示,每個數字左側的顏色不再消失
Fix(en-US): the rainfall legend's colour bands paint again — every boundary number has its colour back on the left
資料 > 地震報告 的詳情地圖與重播地圖,右上角現在都有跟強震監視器
一樣的圖層選單:詳細街道圖(OSM)、地形立體感、鄉鎮名稱,全部經
SettingsStore 寫入 sqlite 的 settings 表,與地圖頁共用同一組 key,
重開 app 維持原樣。詳情頁的右上角在 sheet 完全展開時與左上角返回鍵
一起隱藏,重播頁沒有 sheet 則常駐。

為此把 MapScaffold 的基底圖層同步迴圈(terrain / OSM 的 add-remove
與互斥)抽成共用的 BasemapOverlaySync,三個 surface 用同一份實作,
並用 RecordingMapController 補上 8 個測試。

New(zh-Hant): 地震報告與重播地圖右上角新增圖層選單——詳細街道圖、地形立體感、鄉鎮名稱都可切換,設定會記住
New(en-US): the earthquake-report and replay maps gain a layer menu — street detail, terrain relief and township names — in their top-right corner, remembered between sessions
@PiscesXD PiscesXD changed the title Fix map 雨量圖例修復、地震報告與重播地圖的圖層選單 Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant