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

Why Bubble isn't a Widget? #36

Open
eximius313 opened this issue Oct 8, 2023 · 2 comments
Open

Why Bubble isn't a Widget? #36

eximius313 opened this issue Oct 8, 2023 · 2 comments

Comments

@eximius313
Copy link

FloatingActionBubble accepts only Bubble as items, but Bubble is not a widget (BubbleMenu is) so one can not assign key to it.
Why not make Bubble a StatelessWidget and get rid of BubbleMenu?
I mean:

/// Creates a bubble item for floating action menu button.
class Bubble extends StatelessWidget {
  const Bubble({
    required IconData icon,
    required Color iconColor,
    required String title,
    required TextStyle titleStyle,
    required Color bubbleColor,
    required this.onPress,
    super.key,
  })  : _icon = icon,
        _iconColor = iconColor,
        _title = title,
        _titleStyle = titleStyle,
        _bubbleColor = bubbleColor;

  final IconData _icon;
  final Color _iconColor;
  final String _title;
  final TextStyle _titleStyle;
  final Color _bubbleColor;
  final void Function() onPress;

  @override
  Widget build(BuildContext context) => MaterialButton(
        shape: const StadiumBorder(),
        padding: const EdgeInsets.only(top: 11, bottom: 13, left: 32, right: 32),
        color: _bubbleColor,
        splashColor: Colors.grey.withOpacity(0.1),
        highlightColor: Colors.grey.withOpacity(0.1),
        elevation: 2,
        highlightElevation: 2,
        disabledColor: _bubbleColor,
        onPressed: onPress,
        child: Row(
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            Icon(
              _icon,
              color: _iconColor,
            ),
            const SizedBox(
              width: 10.0,
            ),
            Text(
              _title,
              style: _titleStyle,
            ),
          ],
        ),
      );
}

You just use:

child: items[index],

instead of:

child: BubbleMenu(items[index]),

and it works.
It's simple as that and doesn't break compatibility.

@ingmferrer
Copy link

I'm working on a similar project and I need a key too. Do you think we should submit a pull request to the original repository or look for another package that has more active development?

@eximius313
Copy link
Author

@ingmferrer I was thinking about pull request, but since there was 0 reaction on my Issue, I gave up

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

No branches or pull requests

2 participants