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

glowRepeatCount variable added to repeat animation a specific number of times #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rohitbhoite
Copy link

@rohitbhoite rohitbhoite commented Apr 10, 2024

The animation will be repeated 5 times as glowRepeatCount is set to 5. If this value is not passed then it will have existing behaviour.

Code:

AvatarGlow(
        animate: _animate,
        glowRepeatCount: 5,
        glowColor: Colors.cyan,
        child: Material(
          elevation: 8.0,
          shape: const CircleBorder(),
          child: CircleAvatar(
            backgroundColor: Colors.grey[100],
            radius: 30.0,
            child: Image.asset(
              'assets/images/dart.png',
              height: 50,
            ),
          ),
        ),
      )
Screen.Recording.2024-04-10.at.4.27.15.PM.mov

Description

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@rohitbhoite
Copy link
Author

@apgapg Please review

Comment on lines 82 to +83
if (mounted) {
if (widget.repeat) {
_controller.repeat();
if (widget.glowRepeatCount > 0) {
Copy link

Choose a reason for hiding this comment

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

For reasons of readability, I would write this in a single If branch

if (mounted && widget.glowRepeatCount > 0)

@@ -64,6 +64,7 @@ AvatarGlow(
glowShape: BoxShape.circle,
animate: _animate,
curve: Curves.fastOutSlowIn,
glowRepeatCount: 5 // Animation will be repeated 5 times
Copy link

Choose a reason for hiding this comment

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

Here I would keep it the same as the other parameters. Either comment on all of them or leave out the comment

@floodoo
Copy link

floodoo commented May 18, 2024

It would be very nice if you could merge the PR as I, like many others, need this feature. @apgapg

@apgapg
Copy link
Owner

apgapg commented May 18, 2024

Sure would do In few hrs

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

4 participants