Skip to content

Conversation

@Dhyan761
Copy link

@Dhyan761 Dhyan761 commented Dec 16, 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 reset button and layout alignment in the shortcuts settings tile.

Enhancements:

  • Replace the custom reset gesture/hover implementation with a standardized ghost icon-text button in the shortcuts settings page.
  • Adjust the shortcut setting tile to right-align the keybinding editor/display with flexible layout handling.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 16, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors the shortcuts settings reset UI to use the shared ghost icon-text button with proper hover behavior and adjusts the shortcut tile layout for better right-aligned, flexible keybinding display.

Class diagram for updated reset button and shortcut tile layout

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

  class AFGhostIconTextButton {
    +AFGhostIconTextButton.primary(String text, VoidCallback onTap, Widget iconBuilder(BuildContext context, bool isHovering, bool disabled), EdgeInsets padding)
  }

  class FlowySvg {
    +FlowySvg(FlowySvgs icon, Size size, Color? color)
  }

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

  class ShortcutSettingTile {
  }

  class _ShortcutSettingTileState {
    +bool isEditing
    +Widget _renderKeybindEditor()
    +Widget _renderKeybindings(bool isHovering)
  }

  _ResetButton ..> AFGhostIconTextButton : uses_primary_constructor
  _ResetButton ..> FlowySvg : builds_icon
  _ResetButton ..> AFThemeExtension : reads_textColor

  ShortcutSettingTile o-- _ShortcutSettingTileState : state
  _ShortcutSettingTileState ..> _ResetButton : may_use_in_tile_layout
  _ShortcutSettingTileState ..> Widget : uses_Flexible_and_Align_for_right_alignment
Loading

File-Level Changes

Change Details Files
Replace the custom reset GestureDetector + FlowyHover row with a standardized AFGhostIconTextButton, including icon hover support and padding.
  • Remove the manual GestureDetector/FlowyHover wrapper and inline Row-based reset button implementation.
  • Instantiate AFGhostIconTextButton.primary with the localized reset label and onTap handler, defaulting to a no-op when onReset is null.
  • Provide an iconBuilder that renders the restore_s FlowySvg with theme-based textColor and 20x20 size.
  • Pass the previous symmetric vertical and horizontal padding directly into the AFGhostIconTextButton.
frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_shortcuts_view.dart
Adjust the shortcut setting tile layout so keybindings or the editor are right-aligned and flexibly sized instead of expanding.
  • Change the trailing widget container from Expanded to Flexible with loose fit to avoid over-constraining width.
  • Wrap the keybinding/editor widget in an Align aligned to centerRight to ensure right alignment within the row.
  • Preserve conditional rendering between _renderKeybindEditor and _renderKeybindings(isHovering).
frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_shortcuts_view.dart

Possibly linked issues

  • #: PR converts reset to a proper hoverable button and right-aligns shortcut key tiles, fixing both reported UI 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

@CLAassistant
Copy link

CLAassistant commented Dec 16, 2025

CLA assistant check
All committers have signed the CLA.

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 there - I've reviewed your changes - here's some feedback:

  • Using onReset ?? () {} means the button always appears enabled even when no callback is provided; consider passing onReset through directly so the AFGhostIconTextButton can naturally reflect the disabled state.
  • The iconBuilder currently ignores the isHovering and disabled arguments; if the design calls for a hover effect, consider adjusting the icon color or style based on these flags instead of always using textColor.
  • Switching from Expanded to Flexible with an Align wrapping _renderKeybindings changes the layout behavior; double-check long or wrapping shortcut labels to ensure they don't overflow or get clipped when right-aligned with loose fit.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Using `onReset ?? () {}` means the button always appears enabled even when no callback is provided; consider passing `onReset` through directly so the `AFGhostIconTextButton` can naturally reflect the disabled state.
- The `iconBuilder` currently ignores the `isHovering` and `disabled` arguments; if the design calls for a hover effect, consider adjusting the icon color or style based on these flags instead of always using `textColor`.
- Switching from `Expanded` to `Flexible` with an `Align` wrapping `_renderKeybindings` changes the layout behavior; double-check long or wrapping shortcut labels to ensure they don't overflow or get clipped when right-aligned with loose fit.

## Individual Comments

### Comment 1
<location> `frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_shortcuts_view.dart:152-154` </location>
<code_context>
-            ],
-          ),
-        ),
+    return AFGhostIconTextButton.primary(
+      text: LocaleKeys.settings_shortcutsPage_actions_resetDefault.tr(),
+      onTap: onReset ?? () {},
+      iconBuilder: (context, isHovering, disabled) => FlowySvg(
+        FlowySvgs.restore_s,
</code_context>

<issue_to_address>
**issue (bug_risk):** Avoid using a no-op callback when `onReset` is null to preserve disabled semantics.

Passing `onReset ?? () {}` makes the button appear tappable even when no reset behavior exists, changing the previous behavior where `null` disabled taps. If `null` means “no reset available”, pass `onReset` directly so the disabled state and UX remain consistent with the original implementation.
</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.

2 participants