Skip to content
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

[Feature] Ability to open asset picker from the same position it was previously closed after confirming assets #171

Closed
wants to merge 3 commits into from

Conversation

yanivshaked
Copy link
Contributor

Notes:

  • Supported only with pickAssetsWithDelegate
  • In order to use this, you must reuse the same provider and delegate
  • The picker will be opened in the same scroll position it was previously closed on when confirming assets
  • See example called Save position

@@ -247,6 +247,45 @@ class PickMethod {
},
);
}
static AssetPickerBuilderDelegate<AssetEntity, AssetPathEntity>? _delegate;
Copy link
Member

Choose a reason for hiding this comment

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

Keep them in the page, don't implement them as static.

@@ -559,6 +567,12 @@ abstract class AssetPickerBuilderDelegate<Asset, Path> {
/// Yes, the build method.
/// 没错,是它是它就是它,我们亲爱的 build 方法~
Widget build(BuildContext context) {
if (_savedScrollPosition != null) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should use ScrollController(initialScrollOffset: yourSavedScrollPosition) instead.

@@ -92,6 +92,14 @@ abstract class AssetPickerBuilderDelegate<Asset, Path> {
/// The [ScrollController] for the preview grid.
final ScrollController gridScrollController = ScrollController();

/// [ScrollPosition] for resuming ScrollController position.
/// <zhongwen here>
ScrollPosition? _savedScrollPosition;
Copy link
Member

Choose a reason for hiding this comment

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

Is there any difference if you pass a saved ScrollController?

@AlexV525
Copy link
Member

Closing in favor of #172 .

@AlexV525 AlexV525 closed this Jul 12, 2021
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.

None yet

2 participants