adospace / reactorui-maui

MauiReactor is a MVU UI framework built on top of .NET MAUI
MIT License
555 stars 46 forks source link

Button Shadow and TextColor does not appear on Android and iOS #144

Closed cris-m closed 10 months ago

cris-m commented 10 months ago

I was learning more about reactorui-maui and try to implement material design button and typography. Shadow doesnot appear on the button:

 public Button ElevatedButton(string content)
      => new Button(content)
          .Padding(24)
          .FontSize(14)
          .HeightRequest(40)
          .CornerRadius(20)
          .TextColor(Current.OnBackground)
          .BackgroundColor(Colors.Transparent)
          .Shadow(new Shadow()
              .Brush(Colors.Black)
              .Offset(0,0)
              .Radius(5)
              .Opacity(0.2f));

In android all the TextColor properties doesn't get apply.

The Shadow doesnot get apply on the elevated button.

adospace commented 10 months ago

Hi, seems like a general issue rather than a MauiReactor problem, can you confirm that the problem doesn't exist in .NET MAUI itself?

cris-m commented 10 months ago

I have checked in MAUI and everything seems fine. I have fixed the Shadow issue. Offset was 0,0. The text and icon on the button does not even appear on android.

public Button ElevatedButton(string content)
    => new Button(content)
        .Padding(24)
        .FontSize(14)
        .HeightRequest(40)
        .CornerRadius(20)
        .TextColor(Current.OnBackground)
        .BackgroundColor(Current.Background)
        .Shadow(new Shadow()
            .Brush(Colors.Black)
            .Offset(1,1)
            .Radius(5)
            .Opacity(0.2f))
        .FontAttributes(MauiControls.FontAttributes.Bold);

public Button FAB(string icon)
    => new Button()
        .ImageSource(icon)
        .CornerRadius(16)
        .WidthRequest(56)
        .HeightRequest(56)
        .BackgroundColor(Current.TertiaryContainer)
        .FontAttributes(MauiControls.FontAttributes.Bold);
adospace commented 10 months ago

Hi, sorry for the late reply, just looking at the code now. Seems you're setting the Padding to 24 not leaving enough room for the text. Not sure why iOS is working, much probably in that case such a large value is not honored by the system.

cris-m commented 10 months ago

Thanks. That was the issue in android. Actually it was a mistake, Button has Padding(24, 0) padding in material design