Home > Software engineering >  How to put some padding between icons inside the ReactionButton Box?
How to put some padding between icons inside the ReactionButton Box?

Time:11-19

I'm trying to replicate the facebooks emoji reactions and thus found and decided to use the "What I want to achieve

What I got as of now :(: What I got as of now :(

CodePudding user response:

you can wrap your FaIcon in Padding widget as below

final List<Reaction<String>> _emojisList = [
      Reaction(
          icon: Padding(
            padding: const EdgeInsets.symmetric(horizontal: 15.0),
            child: FaIcon(
              FontAwesomeIcons.solidThumbsUp,
              color: Colors.blue,
              size: 30,
            ),
          ),
          value: 'thumbsUp'),
      Reaction(
          icon: Padding(
            padding: const EdgeInsets.symmetric(horizontal: 15.0),
            child: FaIcon(
              FontAwesomeIcons.solidHeart,
              color: Colors.red,
              size: 30,
            ),
          ),
          value: 'solidHeart'),
      Reaction(
        icon: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 15.0),
          child: FaIcon(
            FontAwesomeIcons.handHoldingHeart,
            color: Colors.yellow,
            size: 30,
          ),
        ),
        value: 'handHoldingHeart',
      ),
    ];

CodePudding user response:

replace _emojisList to this

final List<Reaction<String>> _emojisList = [
  Reaction(
      icon: const Padding(
        padding: EdgeInsets.symmetric(
          horizontal: 16.0,
        ),
        child: FaIcon(
          FontAwesomeIcons.solidThumbsUp,
          color: Colors.blue,
          size: 30,
        ),
      ),
      value: 'thumbsUp'),
  Reaction(
      icon: const Padding(
        padding: EdgeInsets.symmetric(
          horizontal: 16.0,
        ),
        child: FaIcon(
          FontAwesomeIcons.solidHeart,
          color: Colors.red,
          size: 30,
        ),
      ),
      value: 'solidHeart'),
  Reaction(
    icon: const Padding(
      padding: EdgeInsets.symmetric(
        horizontal: 16.0,
      ),
      child: FaIcon(
        FontAwesomeIcons.handHoldingHeart,
        color: Colors.yellow,
        size: 30,
      ),
    ),
    value: 'handHoldingHeart',
  ),
];
  • Related