Skip to content

Incorrect addition of padding #134

Description

@alparslana

Environment

Package version: 3.2.0
Platform: Web
Device information: Chrome on Windows 11
Flutter: Flutter version 3.44.1 on channel stable

Description

Condition: The following attributes of badge are set:
onTap is not null [but is set to an empty function as () {}]
ignorePointer is false (left as default)
position is set to -20 for bottom and a positive number for end
badgeContent is a Text widget
child is a Card widget

Expected behavior: Badge is correctly displayed slightly below card, clicks to badge trigger onTap method, and no additional padding from the bottom of the badge is added after the child of the badge

Current behavior: Badge is correctly displayed slightly below card, clicks to badge trigger onTap method, however an additional padding from the bottom of the badge is added is added

In Line 38 of utils/calculation_utils.dart:
getUpdatedPadding method adds an additional 20 points of padding below the badge

Steps to reproduce

My code is like this:

               badges.Badge(
                 onTap: isBadgeVisible ? () {} : null,
                 showBadge: isBadgeVisible,
                 badgeContent: isBadgeVisible ?
                   Tooltip(
                     triggerMode: TooltipTriggerMode.tap,
                     message: 'Some tooltip',
                     child: Text(
                       'abc',
                       softWrap: false,
                     )
                   ) :
                   Text(''),
                 position: badges.BadgePosition.bottomEnd(bottom: -20, end: 16),
                 badgeStyle: badges.BadgeStyle(
                   shape: badges.BadgeShape.square,
                   borderRadius: BorderRadius.circular(12),
                   badgeColor: Colors.white,
                   padding: EdgeInsets.all(4)
                 ),
                 child: Card(...

Images

Current behavior:
Image

Expected behavior:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions