fix(ui): address PR #30 review findings
- ViewportInfo.updateShouldNotify: compare layoutClass only (not width/height), avoiding unnecessary rebuilds on every resize frame within the same layout class. - ChatPanel: use BorderDirectional(start:) for RTL support. - ChatPanel: localize 'Close chat' tooltip via AppL10n.chatCloseAction. - Inline panel snackbar: localize via AppL10n.chatPanelCollapsedHint. New en/zh ARB entries added. - _saveCurrentDraft(): removed — it was a self-assignment no-op. Draft persistence relies on ChatDetailView's didUpdateWidget (fires onDraftChanged on target switch) and dispose (fires on panel tear-down), both of which already populate _chatDrafts correctly without an explicit save call. - _handleInlineChatViewport layout snackbar: use AppL10n. - Audio level-meter: switch from callback-count (% 3) to time-based gating (std::time::Duration::from_millis(33)), robust to cpal buffer-size or sample-rate changes. Remove level_decimation_counter. - chat_panel_test.dart: add AppL10n.localizationsDelegates so the test resolves l10n keys. Tests: 183 passed, 2 skipped. Dart analyze clean. cargo test -p chanora_audio --lib: 125 passed.
This commit is contained in:
@@ -57,8 +57,11 @@ class ViewportInfo extends InheritedWidget {
|
||||
bool get isWide => !isCompact;
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(ViewportInfo old) =>
|
||||
layoutClass != old.layoutClass ||
|
||||
width != old.width ||
|
||||
height != old.height;
|
||||
bool updateShouldNotify(ViewportInfo old) => layoutClass != old.layoutClass;
|
||||
// NOTE: width/height changes within the same layout class do NOT trigger
|
||||
// notification. Dependents who genuinely need pixel-level dimensions
|
||||
// (rare — most layouts should switch on layoutClass) must use a local
|
||||
// LayoutBuilder. Notifying on every pixel would rebuild every dependent
|
||||
// on every resize frame, which is the exact pessimisation this
|
||||
// InheritedWidget exists to avoid.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user