Skip to content

Conversation

@ShashwatXD
Copy link

@ShashwatXD ShashwatXD commented Dec 18, 2025

PR Description

Added tap-to-focus functionality for JSON previewer on mobile/tablet devices to enable easy copying of values (like authentication tokens). This mimics the existing hover-to-focus behavior on desktop, ensuring consistent UX across all platforms.

Changes:

  • Mobile/Tablet: Tap on JSON values → shows copy button (similar to hover on desktop)
  • Arrow icon exclusively controls expand/collapse for objects/arrays
  • Row tap controls focus/unfocus for copy button visibility
  • Used Text widget on mobile (instead of SelectableText) to prevent gesture conflicts

Technical Implementation:

  • Platform detection: !kIsWeb && (Platform.isIOS || Platform.isAndroid)
  • Added unfocusAllExcept() method to JsonExplorerStore for focus management
  • Arrow icon wrapped with GestureDetector for independent expand/collapse
  • Adjusted copy button padding (12px → 6px) for better mobile spacing

Related Issues

Checklist

  • I have gone through the contributing guide
  • I have updated my branch and synced it with project main branch before making this PR
  • I am using the latest Flutter stable branch (run flutter upgrade and verify)
  • I have run the tests (flutter test) and all tests are passing

Added/updated tests?

We encourage you to add relevant test cases.

  • Yes
  • No, and this is why: This feature adds mobile-specific gesture handling that requires manual testing on actual devices. The changes preserve existing desktop behavior which is already covered by existing tests.

OS on which you have developed and tested the feature?

  • Windows
  • macOS
  • Linux

Additional Testing:

  • ✅ Tested on macOS - desktop hover behavior unchanged
  • ✅ Tested on Android mobile - tap-to-focus works correctly
  • ✅ Full objects/arrays can be copied on mobile

Demo video attached showing tap-to-focus functionality on mobile device.

VID_20251219000641.mp4

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.

[Mobile] Making copying values (like tokens) from JSON previewer easy for end users

1 participant