Skip to content

Conversation

@Dhyan761
Copy link

@Dhyan761 Dhyan761 commented Dec 30, 2025

Feature Preview


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 the shortcuts settings UI interactions and layout for reset and keybinding controls.

Enhancements:

  • Add hover cursor and primary color highlight to the reset-to-default shortcut action.
  • Adjust shortcut setting tile layout to right-align keybinding editor/display and size it more flexibly without using a spacer.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 30, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refines the shortcuts settings UI by making the reset button visually interactive on hover and improving the layout and alignment of shortcut keybindings within the settings tiles.

Class diagram for updated shortcuts settings UI components

classDiagram
  class _ResetButton {
    +VoidCallback onReset
    +Widget build(BuildContext context)
  }

  class FlowyHover {
    +MouseCursor cursor
    +Widget Function(BuildContext ctx, bool isHovering) builder
  }

  class FlowySvg {
    +FlowySvgs asset
    +Size size
    +Color? color
  }

  class FlowyText {
    +static Widget regular(String text, Color color)
  }

  class AFThemeExtension {
    +static AFThemeExtension of(BuildContext context)
    +Color strongText
  }

  class ShortcutSettingTile {
    +ShortcutCommand command
  }

  class _ShortcutSettingTileState {
    +bool isEditing
    +Widget build(BuildContext context)
    +Widget _renderKeybindings(bool isHovering)
  }

  class ShortcutCommand {
    +List<Keybinding> keybindings
  }

  class Keybinding {
  }

  _ResetButton --> FlowyHover : uses
  _ResetButton --> FlowySvg : uses
  _ResetButton --> FlowyText : uses
  _ResetButton --> AFThemeExtension : uses

  _ShortcutSettingTileState --> ShortcutSettingTile : has
  _ShortcutSettingTileState --> ShortcutCommand : uses
  _ShortcutSettingTileState --> Keybinding : uses
Loading

File-Level Changes

Change Details Files
Make the shortcuts reset button visually interactive and indicate clickability on hover.
  • Add a click mouse cursor to the reset button hover wrapper
  • Use FlowyHover.builder to expose hover state to child widgets
  • Change the reset icon color to the theme primary color on hover while keeping default styling otherwise
  • Change the reset text color to the theme primary color on hover while preserving strong text color when not hovering
frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_shortcuts_view.dart
Improve layout and alignment of shortcut keybindings within shortcut setting tiles.
  • Replace Expanded with Flexible to allow the keybinding area to size more naturally
  • Wrap the keybinding/editor widget in Align aligned to centerRight to right-align content
  • Set the keybindings Row mainAxisSize to min so it wraps content instead of stretching
  • Remove the trailing Spacer now that right-alignment is handled explicitly
frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_shortcuts_view.dart

Possibly linked issues

  • #unknown: PR precisely implements the issue’s two UI fixes: reset button hover styling and right-aligned shortcut key tiles.

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 found 1 issue, and left some high level feedback:

  • Inside the FlowyHover builder you’re already given ctx, so consider using Theme.of(ctx)/AFThemeExtension.of(ctx) instead of the outer context to keep the widget’s dependencies localized to the subtree being built.
  • The hover-state primary color logic for the reset icon and text is duplicated; consider extracting this into a local variable or helper to keep the styling consistent and easier to adjust later.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Inside the `FlowyHover` builder you’re already given `ctx`, so consider using `Theme.of(ctx)`/`AFThemeExtension.of(ctx)` instead of the outer `context` to keep the widget’s dependencies localized to the subtree being built.
- The hover-state primary color logic for the reset icon and text is duplicated; consider extracting this into a local variable or helper to keep the styling consistent and easier to adjust later.

## Individual Comments

### Comment 1
<location> `frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_shortcuts_view.dart:157-166` </location>
<code_context>
       child: FlowyHover(
-        child: Padding(
+        cursor: SystemMouseCursors.click,
+        builder: (ctx, isHovering) => Padding(
           padding: const EdgeInsets.symmetric(
             vertical: 4.0,
             horizontal: 6,
           ),
           child: Row(
             children: [
-              const FlowySvg(
+              FlowySvg(
                 FlowySvgs.restore_s,
                 size: Size.square(20),
+                color: isHovering ? Theme.of(context).colorScheme.primary : null,
               ),
               const HSpace(6),
</code_context>

<issue_to_address>
**suggestion:** Use the builder context instead of the outer `context` for theming inside the hover builder.

Inside the `FlowyHover` builder you’re ignoring `ctx` and still calling `Theme.of(context)`. Prefer `Theme.of(ctx)` (or rename the parameter to `context`) so the widget correctly respects any future changes to the inherited theme in this subtree and remains easier to read.
</issue_to_address>

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant