-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Mobile | Fix multi-line buttons on iOS (#897)
* Create MultiLineButton to fix issues with buttons with multiple lines on iOS * Allow setting colors for MultiLineButton * Set consistent placeholder color on search field * Dim button text on tap
- Loading branch information
1 parent
dde0810
commit aa333a4
Showing
6 changed files
with
138 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" | ||
x:Class="SSW.Rewards.Mobile.Controls.MultiLineButton" | ||
x:Name="this"> | ||
<Border BackgroundColor="{Binding BackgroundColor, Source={x:Reference this}}" | ||
StrokeThickness="0" | ||
StrokeShape="RoundRectangle 10" | ||
MinimumWidthRequest="44" | ||
MinimumHeightRequest="44" | ||
Padding="14,10"> | ||
<Border.GestureRecognizers> | ||
<TapGestureRecognizer Command="{Binding Command, Source={x:Reference this}}" /> | ||
</Border.GestureRecognizers> | ||
<Label Text="{Binding Text, Source={x:Reference this}}" | ||
TextColor="{Binding TextColor, Source={x:Reference this}}" | ||
FontSize="{Binding FontSize, Source={x:Reference this}}" | ||
HorizontalOptions="Center" | ||
VerticalOptions="Center" | ||
HorizontalTextAlignment="Center" | ||
VerticalTextAlignment="Center" | ||
LineBreakMode="WordWrap"> | ||
<Label.Behaviors> | ||
<toolkit:TouchBehavior PressedOpacity="0.5" /> | ||
</Label.Behaviors> | ||
</Label> | ||
</Border> | ||
</ContentView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
using System.Windows.Input; | ||
|
||
namespace SSW.Rewards.Mobile.Controls; | ||
|
||
public partial class MultiLineButton | ||
{ | ||
public string Text | ||
{ | ||
get => (string)GetValue(TextProperty); | ||
set => SetValue(TextProperty, value); | ||
} | ||
|
||
public static readonly BindableProperty TextProperty = | ||
BindableProperty.Create( | ||
nameof(Text), | ||
typeof(string), | ||
typeof(MultiLineButton), | ||
string.Empty | ||
); | ||
|
||
public Color TextColor | ||
{ | ||
get => (Color)GetValue(TextColorProperty); | ||
set => SetValue(TextColorProperty, value); | ||
} | ||
|
||
public static readonly BindableProperty TextColorProperty = | ||
BindableProperty.Create( | ||
nameof(TextColor), | ||
typeof(Color), | ||
typeof(MultiLineButton), | ||
Colors.White | ||
); | ||
|
||
public int FontSize | ||
{ | ||
get => (int)GetValue(FontSizeProperty); | ||
set => SetValue(FontSizeProperty, value); | ||
} | ||
|
||
public static readonly BindableProperty FontSizeProperty = | ||
BindableProperty.Create( | ||
nameof(FontSize), | ||
typeof(int), | ||
typeof(MultiLineButton), | ||
14 | ||
); | ||
|
||
public new Color BackgroundColor | ||
{ | ||
get => (Color)GetValue(BackgroundColorProperty); | ||
set => SetValue(BackgroundColorProperty, value); | ||
} | ||
|
||
public new static readonly BindableProperty BackgroundColorProperty = | ||
BindableProperty.Create( | ||
nameof(BackgroundColor), | ||
typeof(Color), | ||
typeof(MultiLineButton), | ||
App.Current.Resources["SSWRed"] as Color | ||
); | ||
|
||
public ICommand Command | ||
{ | ||
get => (ICommand)GetValue(CommandProperty); | ||
set => SetValue(CommandProperty, value); | ||
} | ||
|
||
public static readonly BindableProperty CommandProperty = | ||
BindableProperty.Create( | ||
nameof(Command), | ||
typeof(ICommand), | ||
typeof(MultiLineButton) | ||
); | ||
|
||
public MultiLineButton() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters