flutter avatarGlow is not working at all with fluoatingbutton

0 votes

it's working on SingleChildScrollView , it works very well

but with floatingbutton is won't glow at all... I changed animated:true but also not working at all

SingleChildScrollView(
    reverse: true,
    child: Container(
      padding: const EdgeInsets.fromLTRB(30.0, 30.0, 30.0, 150.0),
      child: AvatarGlow(
        glowColor: Colors.blue,
        endRadius: 90.0,
        duration: Duration(milliseconds: 2000),
        repeat: true,
        showTwoGlows: true,
        repeatPauseDuration: Duration(milliseconds: 100),
        child: Material(
          // Replace this child with your own
          elevation: 8.0,
          shape: CircleBorder(),
          child: CircleAvatar(
            backgroundColor: Colors.grey[100],
            child: Text("abc"),
            radius: 40.0,
          ),
        ),
      ),
    ),
  )

but with floating button it won't work

floatingActionButton: AvatarGlow(
      animate: true,
      glowColor: Colors.red,
      endRadius: 90.0,
      duration: Duration(milliseconds: 2000),
      repeat: true,
      showTwoGlows: true,
      repeatPauseDuration: Duration(milliseconds: 100),
      child: FloatingActionButton(
        onPressed: () {},
        tooltip: 'Floating',
        child: const Icon(Icons.mic),
      )),

Apr 14, 2023 in Flutter by Ashwini
• 5,430 points
357 views

1 answer to this question.

0 votes

Based on the code you provided, it seems like the issue might be related to the size and position of the AvatarGlow widget inside the FloatingActionButton.

The AvatarGlow widget needs to be able to expand beyond the bounds of the FloatingActionButton in order to create the glowing effect. However, since the FloatingActionButton is a fixed size, it might be limiting the size of the AvatarGlow widget.

One possible solution to this issue is to wrap the AvatarGlow widget inside a SizedBox with a larger size than the FloatingActionButton. Here's an example:

floatingActionButton: SizedBox(
  width: 100,
  height: 100,
  child: AvatarGlow(
    glowColor: Colors.red,
    endRadius: 90.0,
    duration: Duration(milliseconds: 2000),
    repeat: true,
    showTwoGlows: true,
    repeatPauseDuration: Duration(milliseconds: 100),
    child: FloatingActionButton(
      onPressed: () {},
      tooltip: 'Floating',
      child: const Icon(Icons.mic),
    ),
  ),
),

In this example, we've wrapped the AvatarGlow widget inside a SizedBox with a width and height of 100, which is larger than the default size of the FloatingActionButton. This should allow the AvatarGlow widget to expand beyond the bounds of the FloatingActionButton and create the glowing effect.

I hope this helps! Let me know if you have any other questions.

To know more, join our Flutter Certification today.

answered Apr 14, 2023 by Anitha

Related Questions In Flutter

0 votes
1 answer

Flutter Like Button Animation Not Working After Adding Method

It seems like the issue might be ...READ MORE

answered Apr 12, 2023 in Flutter by Tanishqa
• 1,170 points
640 views
0 votes
1 answer
0 votes
1 answer

Is Flutter/Dart valuable in the professional setting?

Yes, Flutter and Dart are valuable skills ...READ MORE

answered Mar 21, 2023 in Flutter by vani
254 views
0 votes
1 answer

What is the future of flutter?

Hi@MD, Flutter is a rather new cross-platform framework ...READ MORE

answered Jul 17, 2020 in Others by akhtar
• 38,230 points
930 views
0 votes
1 answer

What is Flutter?

Hi@akhtar, Flutter is an app SDK for building ...READ MORE

answered Jul 17, 2020 in Others by MD
• 95,440 points
1,091 views
0 votes
1 answer

How to install Flutter in Windows system?

Hi@akhtar, You can follow the below-given steps to ...READ MORE

answered Jul 17, 2020 in Others by MD
• 95,440 points
1,528 views
0 votes
1 answer

SFDataGrid pagination with SFDataPager not working

Looking at the code snippets you provided, ...READ MORE

answered Apr 12, 2023 in Flutter by vishalini
964 views
0 votes
1 answer

How can I change the app display name build with Flutter?

Yes, you can change the app display ...READ MORE

answered Mar 21, 2023 in Flutter by venky
1,978 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP