Skip to content

feat: message menu, selectable prose, and the phone and settle fixes - #37

Open
divyanshub024 wants to merge 12 commits into
mainfrom
feat/message-menu-and-text-selection
Open

feat: message menu, selectable prose, and the phone and settle fixes#37
divyanshub024 wants to merge 12 commits into
mainfrom
feat/message-menu-and-text-selection

Conversation

@divyanshub024

@divyanshub024divyanshub024 commented Aug 29, 2026

Copy link
Copy Markdown
Member

Summary

One PR for what was the stack #35, #36, #37: retargeted to main with the commits unchanged, so the two PRs beneath are folded in here and closed.

Message menu and selectable prose (the tip, #37)

  • FlowThread.messageMenu(message) hands back a message's entries (FlowMenuOptions and dividers, labels the host's) and onMessageMenuSelected(message, id) reports the pick; FlowMessage takes the pair as menuEntries and onMenuSelected. A long-press with a haptic on touch, a right-click on pointer platforms; the phone sheet or a popover at the pointer, by the theme's platform like the other menus. Hit-testing defers to the child, so the blank run beside a user bubble is not the message, and controls with their own long-press (tooltips, code blocks) keep it.
  • FlowMenu's entry-to-rows and sheet builders move to flow_menu_entries.dart and are shared with the message menu, so one entries list reads the same wherever it opens.
  • FlowThread.selectable (on by default) makes the conversation a SelectionArea on pointer platforms; it sits above the messages, so their gestures still win and right-click still opens the menu. Phones select from the menu instead: showFlowTextSelection pushes a full-screen page of a message's text, typeset through FlowMarkdown inside a SelectionArea, and FlowMessageData.plainText is the text to hand it.
  • Example: copy, select text, feedback, regenerate and delete in the menu. Playground: a Long-press menu variant on the thread stage. Docs sections for both.

Phone pass: touch targets, control names, the caret (was #36)

  • New FlowTouchTarget widens hit areas to a finger's 44 to 48px on touch platforms without changing layout, sized per site so a neighbour's taps stay its own; applied to the message actions, the attach, send, stop, remove and error-dismiss discs, the menu triggers and the code block's copy. Pointer platforms pass straight through.
  • FlowComposer.sendTooltip and stopTooltip name the discs, so VoiceOver no longer announces an unnamed button.
  • New FlowSelectionTheme derives the caret, selection wash, handles and Cupertino primary from FlowColors, so a host on a stock ThemeData no longer gets Material's purple; wraps the chat view and the composer.
  • The example gates its web-only drop and paste callbacks with kIsWeb, silencing the two runtime warnings it logged on iOS.

Thread settle (was #35)

  • Fixes the thread stranding at a scroll offset outside its range: the newest message clipped under the list's bottom edge, or a blank band above the oldest. The keyboard is the way in: a drag dismisses it, the viewport grows mid-gesture while a reply is still growing, and the range collapses under the offset, which RangeMaintainingScrollPhysics then carries.
  • FlowThread now clamps an idle position back into range, on every metrics change and on every scroll end, each covering the other's blind spot. The list gets its own controller when the host passes none; a host sharing one controller across lists opts out of the settle.

Screenshots

The menu sheet, the select text page and the caret before and after are attached on the original PRs (#36, #37 comments). The settle fix removes a broken state rather than changing a drawn one.

How this was verified

  • iPhone 17 Pro simulator, example app, light and dark: hold on a user bubble opens the sheet with Copy and Delete; hold on assistant prose, then Select text, opens the typeset page; a hold on the actions row still shows its tooltip. Caret colour after hot reload; layout unchanged around the message actions, composer row and code block header; XXXL Dynamic Type still lays out. Send with the keyboard up, drag the thread to dismiss it while the reply streams; the reply stays pinned above the composer and the settled thread reads from the top.
  • Desktop SelectionArea path is analyzer-verified only; it is not exercisable on iOS.
  • flutter analyze clean at the root and in example/ and playground/; dart format . applied.

Checklist

  • flutter analyze lib and flutter analyze in example/ and playground/ are clean
  • dart format . applied
  • Exercised in the playground — with a stage demo added or updated if this is a new component or variant
  • Any new entry under dependencies: in pubspec.yaml is flutter.dev-published, forces no configuration on hosts that never use the feature, and is argued in this PR
  • Nothing model-facing — no prompts, schemas, or provider/network calls
  • New public API is exported from lib/flow_ui.dart and documented in docs/ and the README table
  • CHANGELOG.md updated for user-facing changes, with breaking changes called out
  • PR title follows conventional commits (feat:, fix:, refactor:, docs:, chore:)

@divyanshub024
divyanshub024force-pushed the fix/mobile-touch-targets-and-caret branch from c7949f5 to b4d4d37CompareAugust 29, 2026 22:15
@divyanshub024
divyanshub024force-pushed the feat/message-menu-and-text-selection branch from 51e42af to bc6e368CompareAugust 29, 2026 22:16
Comment threadlib/src/widgets/flow_text_selection.dart
@divyanshub024
divyanshub024force-pushed the fix/mobile-touch-targets-and-caret branch from b4d4d37 to 8edf666CompareAugust 30, 2026 07:43
@divyanshub024
divyanshub024force-pushed the feat/message-menu-and-text-selection branch from bc6e368 to f7a766eCompareAugust 30, 2026 07:43
Comment threadlib/src/widgets/flow_text_selection.dart
@divyanshub024
divyanshub024force-pushed the feat/message-menu-and-text-selection branch from f7a766e to f14a149CompareAugust 30, 2026 08:07
@divyanshub024
divyanshub024force-pushed the feat/message-menu-and-text-selection branch from f14a149 to b5bb110CompareAugust 30, 2026 08:24
Comment threadlib/src/widgets/flow_thread.dart Outdated
@divyanshub024
divyanshub024force-pushed the feat/message-menu-and-text-selection branch from b5bb110 to 7630fb1CompareAugust 30, 2026 08:36

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7630fb1. Configure here.

Comment threadlib/src/widgets/flow_text_selection.dart Outdated
@divyanshub024divyanshub024 changed the title feat: message menu on long-press, and selectable prosefeat: message menu, selectable prose, and the phone and settle fixesAug 30, 2026
@divyanshub024
divyanshub024 changed the base branch from fix/mobile-touch-targets-and-caret to mainAugust 30, 2026 11:55
Sign up for freeto 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

@divyanshub024