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

🎨 UI improvements #119

Closed
wants to merge 4 commits into from
Closed

🎨 UI improvements #119

wants to merge 4 commits into from

Conversation

yanivshaked
Copy link
Contributor

Sorry for the multiple pull-requests (I'm trying to push the wechat assets picker to be integrated into MegaTok's next official version...)

This PR has the following improvements:

  • Display localized folder label "Folder" (according to language) in the app bar path entity selector.
  • Support for LTR/RTL language text direction (added to the AssetsPickerTextDelegate)
  • Auto resize of box constraints for pathEntitySelector according to selected assets.

Some "after" screenshots:

Chinese app bar before selection:
image

Chinese app bar after selection:
image

Hebrew app bar before selection:
image

Hebrew app bar after selection:
image

@yanivshaked yanivshaked changed the title UI improvements 🎨 UI improvements May 3, 2021
@@ -775,7 +775,7 @@ class DefaultAssetPickerBuilderDelegate
child: Text(
provider.isSelectedNotEmpty && !isSingleAssetMode
? '${Constants.textDelegate.confirm}'
'(${provider.selectedAssets.length}/${provider.maxAssets})'
' (${provider.selectedAssets.length}/${provider.maxAssets})'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This space is required to make sure the parenthesis are not too close to the text

@AlexV525
Copy link
Member

AlexV525 commented May 4, 2021

I personally don't agree with the default "Folder" implementation, since we followed the UI with the WeChat. Meanwhile you can implement the "Folder" part by extend your own delegate. So I think that part can be moved to a custom implementation. Then we can push other parts forward later.

@yanivshaked
Copy link
Contributor Author

How about adding a parameter for UI falvor, or even using the SpecialPickerType for that, so we can have one flavor for WeChat and another flavor for MegaTok?

@AlexV525
Copy link
Member

AlexV525 commented May 4, 2021

Sorry but it doesn't sounds good to me. At least you should implement a custom delegate and give it a shot.

@AlexV525
Copy link
Member

AlexV525 commented May 4, 2021

Beside of this, other enhancements seems kind of valid on some point.

@yanivshaked
Copy link
Contributor Author

Ok, I will try with the custom delegate and update.

@AlexV525
Copy link
Member

AlexV525 commented May 4, 2021

(Tips: Extends DefaultAssetPickerBuilderDelegate instead of AssetPickerBuilderDelegate)

@yanivshaked
Copy link
Contributor Author

(Tips: Extends DefaultAssetPickerBuilderDelegate instead of AssetPickerBuilderDelegate)

@AlexV525 I'm trying to go in that direction. To achieve that I need to add a new parameters to the pickAssets method, that will allow me to overload the DefaultAssetPickerProvider. Is that what you meant?

@AlexV525
Copy link
Member

AlexV525 commented May 7, 2021

No. Make your own delegate based on DefaultAssetPickerProvider, build your own pick method with the delegate you implemented.

@AlexV525
Copy link
Member

AlexV525 commented May 7, 2021

I'm closing this since the main idea of this PR has been rejected. File new PRs if you have any other thoughts.

@AlexV525 AlexV525 closed this May 7, 2021
@yanivshaked
Copy link
Contributor Author

Ok, I will create a new PR with the support for RTL languages, and one with support for Megatok pattern.

@yanivshaked
Copy link
Contributor Author

yanivshaked commented May 7, 2021

No. Make your own delegate based on DefaultAssetPickerProvider, build your own pick method with the delegate you implemented.

I'm having trouble with that, can you please take a look at the changes?
https://github.com/12Tech12/flutter_wechat_assets_picker/tree/20210503_UI_Improvement

(When running the code and clicking on Megatok example, nothing is presented)

@AlexV525
Copy link
Member

AlexV525 commented May 9, 2021

Is the problem still exist?

@yanivshaked
Copy link
Contributor Author

I managed to solve it, but I need quite a lot of code duplication in order to add new text to the AssetsPickerTextDelegate, since it's impossible to extend a class with factory constructor in dart.

  1. If it's ok, I will create a PR with Megatok's pattern as a new example.
  2. You can review the changes there, maybe you have a better idea.
    What do you think?

@AlexV525
Copy link
Member

AlexV525 commented May 9, 2021

What's the intention that you need a new text in the text delegate?

@yanivshaked
Copy link
Contributor Author

yanivshaked commented May 9, 2021

Adding the folder name in the upper bar (according to the language), for example:
image

@AlexV525
Copy link
Member

AlexV525 commented May 9, 2021

Why it needs to follow languages? It's a custom implementation for the MegaTok app as you mentioned before.

@yanivshaked
Copy link
Contributor Author

I will try to explain. The way I see it there are two alternatives:

  • I will fork from flutter_wechat_asset_picker and adjust it to create the MegaTok pattern as required.
  • I will keep working with the official flutter_wechat_asset_picker and make the required changes externally in an example (correct use of parameters, custom picker, etc)

I prefer the 2nd option, since this way I can benifit from any work done on the official plugin without maintenance (merge upstream changes etc.), and the official plugin can also benefit from my updates (pushing more ideas into PRs).

@AlexV525
Copy link
Member

AlexV525 commented May 9, 2021

I'll take a look with your branch if I got more time, before that I'm curious about your question:

  1. The second alternative with a custom picker, by extending the default picker delegate, won't need much fields override as I thought. It'll only required you to super the arguments in the constructor.
  2. Following languages is not the thing that the picker done currently. Instead we only provide some base fields for languages implementation to display. If you extends a custom picker delegate to build a "Folder" name slot, then the point is to make your slot follow languages, rather than the text delegate.

@yanivshaked
Copy link
Contributor Author

  1. Sorry but I don't understand what you mean.
  2. That is a possibility, but still then, if I overload pickAssets I need to use SlidePageTransitionBuilder to make a similar implementation (and for example, that is not public).

@yanivshaked
Copy link
Contributor Author

In order to make your review easier, I have created a new branch with relevant changes on the lastest version:
https://github.com/12Tech12/flutter_wechat_assets_picker/tree/20210509_MegaTok_Pattern_Example

@AlexV525
Copy link
Member

That is a possibility

How can it be possible? Sorry I don't understand their relations here. I thought your app would be a fixed language, and change languages using inner setting with provided languages. Then you can use the i18n in your widget.

@AlexV525
Copy link
Member

So I've checked your branch, and make some changes with comments. The SlidePageTransitionBuilder needs to be exported, which you mentioned before. Some other codes looks redundant to me.

@yanivshaked
Copy link
Contributor Author

Thanks, I will review the changes.

@AlexV525
Copy link
Member

In 5.4.1 it's been exported as AssetPickerPageRoute.

@yanivshaked
Copy link
Contributor Author

fei chang gan xie!

@yanivshaked
Copy link
Contributor Author

If I'm using my own localization infrastructure in the pathEntitySelector, then HebrewMegatokAssetsPickerTextDelegate is redundant, removing.

@yanivshaked
Copy link
Contributor Author

After removing, it look much more reasonable.
Is it ok to push the MegaTok pattern example to the upstream?
It will be helpful since there are several enhancement I would like to suggest, and I can use the Megatok pattern example to work on them.

@AlexV525
Copy link
Member

Sure. But I have to reorder the structure of the example, which will allow more custom delegates contributed if more people want to.

@yanivshaked
Copy link
Contributor Author

Great 👍

@AlexV525
Copy link
Member

@yanivshaked
Copy link
Contributor Author

Thanks!

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