Skip to content

Conversation

@Akkii88
Copy link

@Akkii88 Akkii88 commented Jan 16, 2026

Feature Preview

  • Reset Button Hover Effect: Added a hover state to the 'Reset to default' button in Settings > Shortcuts. It now changes color and background on hover for better visual feedback.
  • Shortcut Tile Layout: Improved the layout of shortcut tiles to prevent text overflow issues and ensure the 'Edit' button and keybindings are always properly aligned on the right side.

PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

Summary by Sourcery

Improve Android mobile toolbar positioning relative to the keyboard and refine the Settings shortcuts UI behavior and layout.

New Features:

  • Add hover styling for the 'Reset to default' shortcuts button, including background and icon/text color changes.

Bug Fixes:

  • Ensure the mobile editor toolbar on Android correctly tracks the visible keyboard height using viewInsets to avoid being obscured.
  • Prevent shortcut setting tile text from causing layout issues by allowing the label area to flex instead of forcing expansion.

Enhancements:

  • Add a small safety margin to the Android keyboard height calculation to keep the toolbar clear of the keyboard toolbar.
- 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
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 16, 2026

Reviewer's Guide

Adjusts 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 toolbar

sequenceDiagram
  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
Loading

Updated class diagram for mobile toolbar keyboard handling and shortcuts settings widgets

classDiagram
  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
  }
Loading

File-Level Changes

Change Details Files
Refined Android mobile toolbar positioning logic to better track keyboard height and avoid the toolbar being hidden.
  • Replaced max-based combination of cached keyboard height and viewInsets with logic that prefers non-zero viewInsets when the keyboard is visible.
  • Added fallback that uses the max of cached height and viewInsets when the keyboard is hiding.
  • Cached keyboard height whenever it is positive and added a small safety margin on Android to account for any keyboard toolbar before sizing the toolbar container.
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/appflowy_mobile_toolbar.dart
Enhanced Settings > Shortcuts reset button hover behavior and made shortcut tiles more robust against text overflow while keeping right-side controls aligned.
  • Configured FlowyHover with a hover style that changes background color and border radius and switched from a simple child to a builder to react to hover state.
  • Updated the reset icon and text colors to switch to the theme primary color on hover while using the strong text color otherwise.
  • Replaced an Expanded around the shortcut label text with Flexible to give more layout flexibility and reduce overflow while maintaining space for the Edit button and keybindings on the right.
frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_shortcuts_view.dart

Assessment against linked issues

Issue Objective Addressed Explanation
#8222 Make the reset shortcut button's hover effect consistent with other buttons in Settings, including changing text (and icon) color on hover.
#8222 Improve the layout of each shortcut tile so that keys are aligned toward the end (similar to justify-content: space-between) and reduce unnecessary blank space.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a 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 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.
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.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants