plugins icon indicating copy to clipboard operation
plugins copied to clipboard

[webview_flutter] Add listener for scrolling and set the scrolled position programmatically in Android

Open TheVinhLuong opened this issue 4 years ago • 12 comments

Description

Adding scroll listener and ability to scroll programmatically in Android.

Related Issues

https://github.com/flutter/flutter/issues/42442 https://github.com/flutter/flutter/issues/31027

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • [x] My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • [x] All existing and new tests are passing.
  • [x] I updated/added relevant documentation (doc comments with ///).
  • [x] The analyzer (flutter analyze) does not report any problems on my PR.
  • [x] I read and followed the Flutter Style Guide.
  • [x] The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • [x] I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • [x] I updated CHANGELOG.md to add a description of the change.
  • [x] I signed the CLA.
  • [x] I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • [ ] Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • [x] No, this is not a breaking change.

TheVinhLuong avatar Sep 25 '19 10:09 TheVinhLuong

Thanks for the contribution!

I'm following the initial PR review policy, this PR isn't trivial to review so I'm labeling it with "backlog" and we will prioritize according to the issue's priority.

Relevant issue: https://github.com/flutter/flutter/issues/42442

amirh avatar Oct 10 '19 16:10 amirh

@amirh any progress on this?

andzejsw avatar Mar 24 '20 11:03 andzejsw

@andzejsw In the meantime, you can try out this plugin, it has an implemented scroll listener

TheVinhLuong avatar Apr 05 '20 16:04 TheVinhLuong

I took an initial look at this; at a high level it looks good, but per this is a case where we should land it in parallel with an iOS implementation per the policy described at https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#platform-support

If anyone is interested in moving this forward, I encourage you to open a PR based on this one that adds an iOS implementation; once we have both we can review this one and the iOS portion of that one.

This will also need to be updated for the federation changes (which is likely currently blocked on https://github.com/flutter/flutter/issues/94051 for the moment; we hope to resolve that at the beginning of 2022).

stuartmorgan avatar Dec 09 '21 16:12 stuartmorgan

@TheVinhLuong Are you planning on updating this for the structural changes in the plugin (federation, Android conversion to a more Dart-based implementation), so that it would be ready as the foundation for a cross-platform PR?

stuartmorgan avatar Feb 08 '22 16:02 stuartmorgan

@stuartmorgan Sorry for my late reply. I will update the PR for the Android side, also for iOS if I can make it.

TheVinhLuong avatar Feb 12 '22 16:02 TheVinhLuong

@TheVinhLuong Just a friendly check-in to see if this is still something you have on your radar?

Hixie avatar Apr 19 '22 23:04 Hixie

@TheVinhLuong Just a friendly check-in to see if this is still something you have on your radar?

Yes, I have implemented it both for android and ios. I am writing test now.

TheVinhLuong avatar Apr 20 '22 07:04 TheVinhLuong

@Hixie Could you please review my PR?

TheVinhLuong avatar Apr 20 '22 19:04 TheVinhLuong

@TheVinhLuong @Hixie We are currently working on a new interface for webview_flutter and aren't accepting new features until it is released.

See https://github.com/flutter/flutter/issues/94051 https://github.com/flutter/flutter/issues/93732

bparrishMines avatar Apr 21 '22 20:04 bparrishMines

https://github.com/flutter/flutter/issues/93732 is resolved, but this is still blocked on us finishing https://github.com/flutter/flutter/issues/94051

stuartmorgan avatar Jul 28 '22 20:07 stuartmorgan

Status update from triage: this is still blocked, but we hope to have it unblocked soon.

stuartmorgan avatar Aug 30 '22 15:08 stuartmorgan

webview_flutter v4 has finally been completed, which included fixing the platform interface to that we can make additions to it without breaking changes. That means that this is finally unblocked! Thanks for your patience while we worked through the restructuring.

webview_flutter v4 uses a Dart-first implementation, where the platform channel boundary is as close as possible to the underlying host APIs, and plugin logic is written primarily in Dart rather than the host language. That means that this PR will need to be updated to follow that model. Please let us know if you have questions about updating to v4 (and https://github.com/flutter/plugins/pull/6881 may be useful as an example of adding a feature in the v4 structure).

stuartmorgan avatar Jan 11 '23 19:01 stuartmorgan

Thanks for the update. I will keep you updated on the progress of this PR.

TheVinhLuong avatar Jan 13 '23 17:01 TheVinhLuong

Hi @stuartmorgan, can you review my PR? I have updated the PR according to the new plugin federation format.

Since this PR is just an implementation for the Android side the automated test for changelogs is failing for other platforms. Please add an 'override: no versioning needed' label for this PR if there is nothing wrong. Thank you!

TheVinhLuong avatar Jan 27 '23 18:01 TheVinhLuong

Since this PR is just an implementation for the Android side the automated test for changelogs is failing for other platforms. Please add an 'override: no versioning needed' label for this PR if there is nothing wrong.

You just need to revert the tool-generated pubspec changes in those other packages.

I'll review when I get a chance, but in the meantime you have Dart unit test and analysis failures in CI that will need to be addressed.

stuartmorgan avatar Jan 30 '23 16:01 stuartmorgan

Sadly, I don't think this feature is currently implementable in the web, since there's no communication mechanism between the iframe that is being injected and the flutter web app.

ditman avatar Feb 01 '23 20:02 ditman

Left some early feedback. Are you able to do the iOS portion as well or would you like help with that?

I think I can do it. Can I open a new PR for the iOS implementation?

TheVinhLuong avatar Feb 03 '23 08:02 TheVinhLuong

This PR should follow https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins and include the iOS implementation in this PR. Then once this has been approval, you can split the code from each package into their own PRs.

bparrishMines avatar Feb 09 '23 14:02 bparrishMines

@bparrishMines Thanks for your feedback. Could you please take a look again at Android implementations for this? If no problems arise I will apply the same logic for the iOS side.

TheVinhLuong avatar Feb 18 '23 10:02 TheVinhLuong

We've just completed the migration of the plugin code to the flutter/packages repository, as described in https://flutter.dev/go/flutter-plugins-repo-migration, and this repository is now being archived. Unfortunately that means that all in-progress PRs here must be moved to flutter/packages.

Please see our instructions for an explanation of how to move your PR, and if you have any issues moving your PR please don't hesitate to reach out in the #hackers-ecosystem channel in Discord.

Our apologies that your PR was caught in this one-time transition. We're aware that it's disruptive in the short term, and appreciate your help in getting us to a better long-term state!

stuartmorgan avatar Feb 22 '23 15:02 stuartmorgan