Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[webview_flutter] Add android webSettings.setTextZoom api #3298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Mar 8, 2023

Conversation

apremalal
Copy link
Contributor

@apremalal apremalal commented Feb 25, 2023

This PR exposes setTextZoom(int textZoom) api as a platform method that provides control over webview font scaling.

Default android webview behavior is to comply with system settings (Settings > Accessibility > Font Size) and it could lead to unintended formatting problems such as overlapping text and components depending on the font size configuration. setTextZoom() helps to mitigate such issue by enforcing a fixed scaling factor.

Fixes flutter/flutter#121455

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@google-cla
Copy link

google-cla bot commented Feb 25, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@apremalal apremalal changed the title Adding setTextZoom api [webview_flutter] Add android WebViewSettings.setTextZoom api Feb 25, 2023
@apremalal apremalal changed the title [webview_flutter] Add android WebViewSettings.setTextZoom api WIP [webview_flutter] Add android WebViewSettings.setTextZoom api Feb 25, 2023
@apremalal apremalal changed the title WIP [webview_flutter] Add android WebViewSettings.setTextZoom api [webview_flutter] Add android webSettings.setTextZoom api Feb 25, 2023
@apremalal apremalal marked this pull request as ready for review February 25, 2023 16:01
Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

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

This looks mostly good. I added a few comments. Thanks for the contribution!

Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

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

@apremalal
Copy link
Contributor Author

This is also missing native unit tests. You should be able to put it in: https://github.com/flutter/packages/blob/main/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebSettingsTest.java

Thanks for the catch. Fixed with ebbc58a, 02c21fa

Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

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

Just one last comment. Everything else looks good.

LGTM

@bparrishMines
Copy link
Contributor

Looks like you will also need to bump the version another time.

cc @stuartmorgan For a quick secondary review.

@apremalal
Copy link
Contributor Author

Looks like you will also need to bump the version another time.

cc @stuartmorgan For a quick secondary review.

Bumped the version with : 5b3b2e8

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 4, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 4, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Mar 4, 2023

auto label is removed for flutter/packages, pr: 3298, Failed to merge pr#: 3298 with Pull request could not be merged: Pull Request is not mergeable.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 4, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 4, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Mar 4, 2023

auto label is removed for flutter/packages, pr: 3298, due to - The status or check suite android-platform_tests CHANNEL:master PACKAGE_SHARDING:--shardIndex 0 --shardCount 7 has failed. Please fix the issues identified (or deflake) before re-applying this label.

@stuartmorgan-g
Copy link
Contributor

Looks like this interacts badly with the PR to enable warnings as errors. Sorry about, you'll need to re-run Pigeon generation for this PR now that we're using a new version of Pigeon.

@apremalal
Copy link
Contributor Author

Details

I see. Re-ran pigeon with ca8e5ae

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: webview_flutter platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[webview_flutter] Expose setTextZoom(int textZoom) api in webview_flutter_android
3 participants