Skip to content

Allow the editor in read-only to tighten to the actual necessary width - #530

Merged
amantoux merged 3 commits into
masterfrom
text_width_basis
Aug 2, 2025
Merged

Allow the editor in read-only to tighten to the actual necessary width#530
amantoux merged 3 commits into
masterfrom
text_width_basis

Conversation

@amantoux

@amantoux amantoux commented Aug 1, 2025

Copy link
Copy Markdown
Member

This PR allows editor to shrink to max content size in read-only

To acheive this, one can use a new paramter textWidthBasis

FleatherEditor(
   controller: controller,
   scrollable: false,
   readOnly: true,
   enableInteractiveSelection: false,
   textWidthBasis: TextWidthBasis.longestLine,
);

How it renders

Before

image

After

image

@amantoux
amantoux marked this pull request as draft August 1, 2025 10:11
@codecov

codecov Bot commented Aug 1, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.93%. Comparing base (5b3a1d7) to head (46db52b).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
packages/fleather/lib/src/rendering/editor.dart 87.50% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #530      +/-   ##
==========================================
+ Coverage   88.71%   88.93%   +0.22%     
==========================================
  Files          63       63              
  Lines       10857    10876      +19     
==========================================
+ Hits         9632     9673      +41     
+ Misses       1225     1203      -22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@amantoux
amantoux requested a review from Amir-P August 1, 2025 14:01
@amantoux
amantoux marked this pull request as ready for review August 1, 2025 14:01

@Amir-P Amir-P left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We really needed it! Thanks! I just have two small comments. PTAL.

Comment thread packages/fleather/lib/src/widgets/editor.dart Outdated
Comment thread packages/fleather/lib/src/widgets/text_line.dart Outdated
Comment thread packages/fleather/lib/src/widgets/field.dart Outdated
@amantoux

amantoux commented Aug 1, 2025

Copy link
Copy Markdown
Member Author

@Amir-P Fixed accordingly, can you please take a look?

@amantoux
amantoux requested a review from Amir-P August 1, 2025 19:33

@Amir-P Amir-P left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks!

@amantoux
amantoux merged commit 13ae617 into master Aug 2, 2025
4 checks passed
@amantoux
amantoux deleted the text_width_basis branch August 2, 2025 15:09
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