amugofjava / anytime_podcast_player

Simple, easy to use Podcast player app written in Flutter and Dart.
BSD 3-Clause "New" or "Revised" License
376 stars 99 forks source link

add animation in podcast description button #84

Closed GouravShDev closed 1 year ago

GouravShDev commented 1 year ago

Hopefully close #47 I have used StreamController to trigger animation instead of SetState() because the parent widget was rebuilding the whole description Text widget instead of animating. I am open to suggestions if there is a better way to achieve this. Though I think this one isn't bad either.

Chralu commented 1 year ago

Hi @GouravShDev, your solution seems to work fine.

Therefore, I see a few possible improvements.

Ergonomics

text 'jumps' on animation start

This can be fixed with the property alignment: Alignment.topCenter, on the AnimatedSize widget.

Bottom ShaderMask

should be disabled when description is expanded

Technical solution

As you mentioned, using setState triggers a widget rebuild, which is perfectly normal. You can get a working animation with that solution (see solution proposal ⬇️).

Here is a working implementation with the few improvements mentioned. (I didn't know how to share that improvement proposal, so I created a temporary PR)

https://github.com/amugofjava/anytime_podcast_player/pull/85/files

https://user-images.githubusercontent.com/375723/219939418-6a5a9ec1-78d8-4aab-b537-a290a4aaecd4.mp4

GouravShDev commented 1 year ago

I'll push another commit with proposed changes.

amugofjava commented 1 year ago

This is great, but I wonder if it is possible for the text to be part of the closing animation rather than jumping. If you look at the animation below, which is slowed down, you can see when the description is collapsed the text disappears and then the animation starts. Compare that with the list tile and you can see the text is part of the animation.

device-2023-02-25-110256.webm

This is a definite improvement so I am happy to accept this and the animation could always be improved at a later date.

GouravShDev commented 1 year ago

@amugofjava, Ok I understand what you trying to say. For now, if you want you can accept this merge. I'll work on the improvement in text animation after some time and add another PR.

amugofjava commented 1 year ago

Thank you for your input on this issue.