elbeicktalat / flutter_auth_buttons

Auth Buttons is a flutter widget library, include buttons for authenticating with the most popular social networks.
https://pub.dev/packages/auth_buttons
BSD 3-Clause "New" or "Revised" License
32 stars 32 forks source link

Unnecessary isEmpty method #52

Closed meroo36 closed 1 year ago

meroo36 commented 1 year ago
extension AuthStringExtension on String {
  bool get isNotBlank => isNotEmpty && !contains(' ');

the second condition, "contains", make it impossible to create a custom button with empty characters. It will fall into assert.

I would suggest that we can remove it and "isNotEmpty" is enough for it.

elbeicktalat commented 1 year ago

Hi there,

In fact I want allow adding button without a text, if you're thinking to have only Icon style then just reduce the size or set the button type to be icon.

buttonType: AuthButtonType.icon

fryette commented 1 year ago

With that check impossible to set a text with spaces for CustomAuthButton, this check is incorrect anyway.

For example: 'Sign In with Login and Password', so this is not empty and contains spaces, the check will fail


          (style.buttonType != AuthButtonType.icon)
              ? text != null && text.isNotBlank
              : text == null,
          (style.buttonType != AuthButtonType.icon)
              ? 'Text must be not blank.'
              : 'Icon button type does not need a text.',
        );