feat: show current UI zoom state on workspace settings page#8620
Open
Herrtian wants to merge 2 commits intoAppFlowy-IO:mainfrom
Open
feat: show current UI zoom state on workspace settings page#8620Herrtian wants to merge 2 commits intoAppFlowy-IO:mainfrom
Herrtian wants to merge 2 commits intoAppFlowy-IO:mainfrom
Conversation
Display the current UI scale/zoom percentage in the Workspace settings page under the Appearance section, with a hint about keyboard shortcuts (Ctrl+/-/0 or ⌘+/-/0) to adjust the zoom level. Closes AppFlowy-IO#5396
Contributor
Reviewer's GuideAdds a new UI scale display section to the Workspace settings Appearance area, reading the current zoom factor from WindowSizeManager and rendering it as a percentage with platform-specific keyboard shortcut guidance. Sequence diagram for loading and displaying UI scale in workspace settingssequenceDiagram
actor User
participant SettingsWorkspaceView
participant UIScaleFactorDisplay
participant UIScaleFactorDisplayState
participant WindowSizeManager
User->>SettingsWorkspaceView: Open workspace settings
activate SettingsWorkspaceView
SettingsWorkspaceView->>UIScaleFactorDisplay: Build UIScaleFactorDisplay
activate UIScaleFactorDisplay
UIScaleFactorDisplay->>UIScaleFactorDisplayState: createState
deactivate UIScaleFactorDisplay
activate UIScaleFactorDisplayState
UIScaleFactorDisplayState->>UIScaleFactorDisplayState: initState
UIScaleFactorDisplayState->>WindowSizeManager: getScaleFactor
activate WindowSizeManager
WindowSizeManager-->>UIScaleFactorDisplayState: scaleFactor (double)
deactivate WindowSizeManager
UIScaleFactorDisplayState->>UIScaleFactorDisplayState: setState update _scaleFactor
UIScaleFactorDisplayState->>SettingsWorkspaceView: build SettingsCategory with percentage
deactivate UIScaleFactorDisplayState
SettingsWorkspaceView-->>User: Show UI Scale section with current zoom and shortcuts
deactivate SettingsWorkspaceView
Class diagram for new UI scale display in workspace settingsclassDiagram
class SettingsWorkspaceView {
+build(context)
}
class UIScaleFactorDisplay {
+UIScaleFactorDisplay()
+createState() UIScaleFactorDisplayState
}
class UIScaleFactorDisplayState {
-WindowSizeManager _windowSizeManager
-double _scaleFactor
+initState()
+_loadScaleFactor() Future~void~
+build(context)
}
class WindowSizeManager {
+WindowSizeManager()
+getScaleFactor() Future~double~
}
class SettingsCategory {
+title
+description
+children
}
class Row {
+children
}
class FlowyText {
+semibold(text, fontSize)
}
SettingsWorkspaceView --> UIScaleFactorDisplay : contains
UIScaleFactorDisplay --> UIScaleFactorDisplayState : creates
UIScaleFactorDisplayState --> WindowSizeManager : uses
UIScaleFactorDisplayState --> SettingsCategory : builds
UIScaleFactorDisplayState --> Row : builds
UIScaleFactorDisplayState --> FlowyText : displays_percentage
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- All user-facing strings in
_UIScaleFactorDisplay(title, description text) are hard-coded; consider moving these into the existing localization system (LocaleKeys) to match the rest of the settings UI. - The scale factor is only read once in
initState; if the zoom can change while the settings page is open, consider wiring this to existing state (e.g., a Cubit/stream or a listener onWindowSizeManager) so the displayed percentage stays in sync with the actual UI scale.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- All user-facing strings in `_UIScaleFactorDisplay` (title, description text) are hard-coded; consider moving these into the existing localization system (`LocaleKeys`) to match the rest of the settings UI.
- The scale factor is only read once in `initState`; if the zoom can change while the settings page is open, consider wiring this to existing state (e.g., a Cubit/stream or a listener on `WindowSizeManager`) so the displayed percentage stays in sync with the actual UI scale.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
- Add WidgetsBindingObserver to reload scale factor when app resumes, keeping the displayed value in sync with hotkey-triggered changes. - Add TODO for moving strings to LocaleKeys (follow-up).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
How it works
WindowSizeManagerCloses #5396
Screenshots
N/A (text-only display of current zoom percentage)
Summary by Sourcery
New Features: