Skip to content

Introduce feat(chat): add global pinch-to-zoom text scaling via ChatTextScaleService#228

Closed
just-stuff-tm wants to merge 2 commits into
zjs81:mainfrom
just-stuff-tm:feature/chat-pinch-zoom-v2
Closed

Introduce feat(chat): add global pinch-to-zoom text scaling via ChatTextScaleService#228
just-stuff-tm wants to merge 2 commits into
zjs81:mainfrom
just-stuff-tm:feature/chat-pinch-zoom-v2

Conversation

@just-stuff-tm

@just-stuff-tm just-stuff-tm commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

This PR introduces device-local pinch-to-zoom text scaling for all chat interfaces, including:

  • Direct messages
  • Open channels
  • Room server conversations

The feature allows users to adjust chat text size using a two-finger pinch gesture. A double-tap gesture resets the scale to default.

Scaling affects only message text and related text elements. Layout, padding, bubble constraints, avatars, and scroll behavior remain unchanged.


Implementation Details

New Service

ChatTextScaleService

  • ChangeNotifier

  • Persists scale using PrefsManager

  • Clamp range: 0.81.8

  • Default: 1.0

  • Exposed globally via ChangeNotifierProvider

  • UI-only (no connector / protocol references)

New Widget

ChatZoomWrapper

  • Wraps chat ListView.builder
  • Detects two-finger pinch (pointerCount == 2)
  • Double-tap resets scale
  • Uses HitTestBehavior.translucent
  • Does not interfere with vertical scrolling

Integration

  • Registered in main.dart and initialized before runApp
  • Injected via MultiProvider
  • context.select<ChatTextScaleService, double> used inside ListView.builder
  • _MessageBubble and channel message builders receive textScale
  • Only font sizes are scaled (no structural/layout changes)

Performance Notes

  • Only text widgets rebuild via context.select
  • No Sliver/list re-creation
  • No protocol layer changes
  • No persistence layer coupling beyond preference storage

UX Behavior

  • Pinch in/out scales message text
  • Double-tap resets to default
  • Preference is device-local and shared across all chat views
  • Scale persists across app restarts

Scope

Modified:

  • lib/main.dart
  • lib/screens/chat_screen.dart
  • lib/screens/channel_chat_screen.dart

Added:

  • lib/services/chat_text_scale_service.dart
  • lib/widgets/chat_zoom_wrapper.dart

No backend, protocol, or RoomServer logic changed.


Validation

  • Android
  • iOS
  • Web
  • Windows
  • Manual verification of scroll stability and message rendering

Reference [Feature Request] Support changing font size #147

compressed_10mb.mp4

@just-stuff-tm

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f17e2382c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/services/chat_text_scale_service.dart Outdated
Comment thread lib/widgets/chat_zoom_wrapper.dart Outdated
@just-stuff-tm

Copy link
Copy Markdown
Contributor Author

@codex @446564 @zjs81 @wel97459 can you review

@just-stuff-tm just-stuff-tm marked this pull request as ready for review February 24, 2026 04:10
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@benallfree

Copy link
Copy Markdown
Contributor

That's kind of cool, how would you do it on the macos client for example?

@just-stuff-tm

Copy link
Copy Markdown
Contributor Author

I didn't test on apple products,(don't own any) feel free to test. I'm testing on Windows now.

@just-stuff-tm

Copy link
Copy Markdown
Contributor Author

Pinching trackpad on windows 11

Screen.Recording.2026-02-23.231929.mp4

@just-stuff-tm

Copy link
Copy Markdown
Contributor Author

Merged with #232

@just-stuff-tm just-stuff-tm deleted the feature/chat-pinch-zoom-v2 branch February 24, 2026 20:28
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