-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
fix(settings): improve shortcuts reset button hover and tile layout #8435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(settings): improve shortcuts reset button hover and tile layout #8435
Conversation
- Improved keyboard height calculation to prioritize viewInsets.bottom when keyboard is visible - Added 8px safety margin on Android to account for keyboard toolbar - Ensures toolbar stays visible above the keyboard in all scenarios Fixes AppFlowy-IO#8433
…O#8222) - Add hover effect to reset button (icon and text change to primary color) - Change shortcut tile layout from Expanded to Flexible for better spacing - Fixes inconsistent button hover behavior - Improves visual alignment by reducing blank space in shortcut tiles
|
|
Reviewer's GuideAdjusts Android mobile toolbar keyboard height handling for more accurate positioning above the keyboard and improves the Settings > Shortcuts reset button hover state and tile layout to prevent text overflow and keep controls aligned. Sequence diagram for updated Android keyboard height handling in mobile toolbarsequenceDiagram
actor User
participant FlutterFramework
participant MobileToolbarState
participant MediaQuery
User->>FlutterFramework: Focuses text field (Android)
FlutterFramework->>MobileToolbarState: onKeyboardHeightChanged(height)
MobileToolbarState->>MobileToolbarState: keyboardHeight = height
alt Platform is android and not showingMenu
MobileToolbarState->>MediaQuery: get viewInsetsBottom
MediaQuery-->>MobileToolbarState: viewInsetsBottom
alt viewInsetsBottom > 0
MobileToolbarState->>MobileToolbarState: keyboardHeight = viewInsetsBottom
else viewInsetsBottom <= 0
MobileToolbarState->>MobileToolbarState: keyboardHeight = max(keyboardHeight, viewInsetsBottom)
end
end
alt keyboardHeight > 0
MobileToolbarState->>MobileToolbarState: _globalCachedKeyboardHeight = keyboardHeight
alt Platform is android
MobileToolbarState->>MobileToolbarState: keyboardHeight += 8.0
end
end
MobileToolbarState-->>FlutterFramework: return SizedBox(height: keyboardHeight)
FlutterFramework-->>User: Toolbar positioned above keyboard
Updated class diagram for mobile toolbar keyboard handling and shortcuts settings widgetsclassDiagram
class _MobileToolbarState {
+double _globalCachedKeyboardHeight
+Widget build(BuildContext context)
+void onKeyboardHeightChanged(double height)
}
class _ResetButton {
+VoidCallback onReset
+Widget build(BuildContext context)
}
class FlowyHover {
+HoverStyle style
+Widget Function(BuildContext context, bool isHovering) builder
}
class HoverStyle {
+Color hoverColor
+BorderRadius borderRadius
}
class _ShortcutSettingTileState {
+Widget build(BuildContext context)
}
_MobileToolbarState --> _ShortcutSettingTileState : same_screen_usage
_ResetButton --> FlowyHover : wraps
FlowyHover --> HoverStyle : uses
_ShortcutSettingTileState --> _ResetButton : contains
_MobileToolbarState --> MediaQuery : reads_viewInsetsBottom
class MediaQuery {
+EdgeInsets viewInsets
}
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've left some high level feedback:
- In the Android keyboard handling logic, the
elsebranch that is supposed to "use cached height when keyboard is hiding" currently just doeskeyboardHeight = max(keyboardHeight, viewInsetsBottom)(whereviewInsetsBottomis 0), so it never actually uses_globalCachedKeyboardHeight; consider using the cached value there or updating the comment/logic for clarity. - You add the 8.0 safety margin to
keyboardHeightafter updating_globalCachedKeyboardHeight, so the cached value and the actual used height diverge; consider whether the safety margin should also be reflected in the cached value or applied consistently wherever the cache is consumed.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the Android keyboard handling logic, the `else` branch that is supposed to "use cached height when keyboard is hiding" currently just does `keyboardHeight = max(keyboardHeight, viewInsetsBottom)` (where `viewInsetsBottom` is 0), so it never actually uses `_globalCachedKeyboardHeight`; consider using the cached value there or updating the comment/logic for clarity.
- You add the 8.0 safety margin to `keyboardHeight` after updating `_globalCachedKeyboardHeight`, so the cached value and the actual used height diverge; consider whether the safety margin should also be reflected in the cached value or applied consistently wherever the cache is consumed.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Feature Preview
PR Checklist
Summary by Sourcery
Improve Android mobile toolbar positioning relative to the keyboard and refine the Settings shortcuts UI behavior and layout.
New Features:
Bug Fixes:
Enhancements: