Skip to content

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

Open
rohitbhoite wants to merge 1 commit intoapgapg:masterfrom
rohitbhoite:master
Open

glowRepeatCount variable added to repeat animation a specific number of times#39
rohitbhoite wants to merge 1 commit intoapgapg:masterfrom
rohitbhoite:master

Conversation

@rohitbhoite
Copy link
Copy Markdown

@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
Copy Markdown
Author

@apgapg Please review

Comment thread lib/src/avatar_glow.dart
Comment on lines 82 to +83
if (mounted) {
if (widget.repeat) {
_controller.repeat();
if (widget.glowRepeatCount > 0) {
Copy link
Copy Markdown

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)

Comment thread README.md
glowShape: BoxShape.circle,
animate: _animate,
curve: Curves.fastOutSlowIn,
glowRepeatCount: 5 // Animation will be repeated 5 times
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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.

4 participants