Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 4011932

Browse files
Merge branch 'develop'
2 parents a404e7a + 57dcf2a commit 4011932

10 files changed

Lines changed: 133 additions & 25 deletions

File tree

MaterialBottomSheet.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ Gets or sets the vertical options to the container's content. By default it has
5555
Gets or sets the container height. By default it has a **-1** and the height of the container adjusts to the container's content. This property should only be used if a fixed height is needed for the container.
5656
<br/>
5757

58+
### Property ContainerRelativeHeight:
59+
Gets or sets the relative (proportional) container height. By default it has a **-1** and this property is not taken into account. This property should only be used if a relative (proportional) fixed height is needed for the container. This property allows values between 0 and 1.
60+
<br/>
61+
5862
### Property MaximumContainerHeightRequest:
5963
Gets or sets the maximum height to which the container can expand. It only works when the ContainerHeight property is not set and the container height is dynamic.
6064
<br/>

MaterialButtonControl.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ This property is to set the font size of the button text.
9090
This property is to set the font family of the button text.
9191
<br/>
9292

93+
### Property IsTextUnderlined:
94+
This property is to set the underlined style to the button text. It only works with the ButtonType Text.
95+
<br/>
96+
9397
### Property ToUpper:
9498
This property is to make the text uppercase or lowercase, the default is false.
9599
<br/>

MaterialDesignControls.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata minClientVersion="2.8.1">
44
<id>Plugin.MaterialDesignControls</id>
5-
<version>3.1.1</version>
5+
<version>3.1.2</version>
66
<title>MaterialDesignControls Plugin for Xamarin Forms</title>
77
<authors>Horus</authors>
88
<owners>AgustinBonillaHorus</owners>

MaterialSnackBar.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ This property is to the font size of the action button.
6262
This property is to the font family of the action button.
6363
<br/>
6464

65+
### Property IsActionTextUnderlined:
66+
This property is to set the underlined style to the action button.
67+
<br/>
68+
6569
### Property ActionCommand:
6670
This property is to the command of the action button.
6771
<br/>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ https://github.com/HorusSoftwareUY/MaterialDesignControlsPlugin/tree/master/exam
413413

414414

415415
## Developed by
416-
<a href="http://horus.com.uy" ><img src="https://horus.com.uy/img/logo_horus.png" width="128"></a>
416+
<a href="http://horus.com.uy"><img src="https://assets-global.website-files.com/64a7016392b0b7da3a8604e3/64a7016392b0b7da3a8604ed_horus.svg" width="128"></a>
417417

418418

419419
## Contributions

example/ExampleMaterialDesignControls/Pages/MaterialBottomSheetPage.xaml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@
5555
ButtonType="Text"
5656
Command="{Binding OpenBottomSheetCommand}"
5757
CommandParameter="materialBottomSheet3"
58+
Text="Relative size" />
59+
60+
<material3:MaterialButton
61+
ButtonType="Text"
62+
Command="{Binding OpenBottomSheetCommand}"
63+
CommandParameter="materialBottomSheet4"
5864
Text="Dynamic size and MaximumContainerHeightRequest" />
5965

6066
<material3:MaterialDivider />
@@ -94,12 +100,12 @@
94100
</material3:MaterialBottomSheet.Content>
95101
</material3:MaterialBottomSheet>
96102

97-
<!--Fixed size-->
103+
<!--Fixed size with ContainerHeight-->
98104
<material3:MaterialBottomSheet
99105
x:Name="materialBottomSheet2"
100106
Grid.Row="1"
101-
ContainerHeight="400"
102-
ContentVerticalOptions="Center">
107+
ContainerHeight="600"
108+
ContentVerticalOptions="Start">
103109
<material3:MaterialBottomSheet.Content>
104110
<StackLayout
105111
Spacing="10"
@@ -123,9 +129,37 @@
123129
</material3:MaterialBottomSheet.Content>
124130
</material3:MaterialBottomSheet>
125131

126-
<!--Dynamic size with MaximumContainerHeightRequest-->
132+
<!--Fixed relative size with ContainerRelativeHeight-->
127133
<material3:MaterialBottomSheet
128134
x:Name="materialBottomSheet3"
135+
ContainerRelativeHeight="0.8"
136+
Grid.Row="1">
137+
<material3:MaterialBottomSheet.Content>
138+
<StackLayout
139+
Spacing="10"
140+
Padding="22,44,22,12">
141+
<material3:MaterialLabel
142+
FontFamily="{StaticResource BoldFont}"
143+
FontSize="{StaticResource H4FontSize}"
144+
Text="Material Design"
145+
TextColor="{StaticResource GradientColor1}" />
146+
<material3:MaterialLabel
147+
FontAttributes="Bold"
148+
FontFamily="{StaticResource SemiBoldFont}"
149+
FontSize="{StaticResource H5FontSize}"
150+
Text="Plugin for Xamarin Forms"
151+
TextColor="{StaticResource BlackColor}" />
152+
<material3:MaterialLabel
153+
FontSize="{StaticResource Body2FontSize}"
154+
Text="Material Design is an adaptable system of guidelines, components, and tools that support the best practices of user interface design. Backed by open-source code, Material Design streamlines collaboration between designers and developers, and helps teams quickly build beautiful products."
155+
TextColor="{StaticResource DarkGrayColor}" />
156+
</StackLayout>
157+
</material3:MaterialBottomSheet.Content>
158+
</material3:MaterialBottomSheet>
159+
160+
<!--Dynamic size with MaximumContainerHeightRequest-->
161+
<material3:MaterialBottomSheet
162+
x:Name="materialBottomSheet4"
129163
Grid.Row="1"
130164
MaximumContainerHeightRequest="300">
131165
<material3:MaterialBottomSheet.Content>

example/ExampleMaterialDesignControls/Pages/MaterialSnackBarPage.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
LeadingIconCommand="{Binding LeadingIconTapCommand}"
5151
TrailingIconCommand="{Binding TrailingIconTapCommand}"
5252
ActionCommand="{Binding ActionCommand}"
53-
ActionText="Action">
53+
ActionText="Action"
54+
IsActionTextUnderlined="True">
5455
</material3:MaterialSnackBar>
5556
<material3:MaterialDivider Margin="0,10" />
5657

src/MaterialDesignControls/ControlsMaterial3/MaterialBottomSheet.cs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ public double ContainerHeight
4949
set { SetValue(ContainerHeightProperty, value); OnPropertyChanged(); }
5050
}
5151

52+
public static BindableProperty ContainerRelativeHeightProperty =
53+
BindableProperty.Create(nameof(ContainerRelativeHeight), typeof(double), typeof(MaterialBottomSheet), defaultValue: -1.0, propertyChanged: OnContainerRelativeHeightChanged);
54+
55+
public double ContainerRelativeHeight
56+
{
57+
get { return (double)GetValue(ContainerRelativeHeightProperty); }
58+
set { SetValue(ContainerRelativeHeightProperty, value); OnPropertyChanged(); }
59+
}
60+
5261
public static BindableProperty MaximumContainerHeightRequestProperty =
5362
BindableProperty.Create(nameof(MaximumContainerHeightRequest), typeof(double), typeof(MaterialBottomSheet), defaultValue: -1.0);
5463

@@ -276,6 +285,12 @@ private static void OnContainerHeightChanged(BindableObject bindable, object old
276285
control.SetInitialState();
277286
}
278287

288+
private static void OnContainerRelativeHeightChanged(BindableObject bindable, object oldValue, object newValue)
289+
{
290+
var control = (MaterialBottomSheet)bindable;
291+
control.SetInitialState();
292+
}
293+
279294
private static void OnContentChanged(BindableObject bindable, object oldValue, object newValue)
280295
{
281296
var control = (MaterialBottomSheet)bindable;
@@ -298,7 +313,23 @@ private static void OnContentChanged(BindableObject bindable, object oldValue, o
298313

299314
private void ApplyContainerHeight(View containerContentView)
300315
{
301-
if (ContainerHeight <= 0)
316+
if (ContainerRelativeHeight != (double)ContainerRelativeHeightProperty.DefaultValue
317+
&& ContainerHeight == (double)ContainerHeightProperty.DefaultValue)
318+
{
319+
if (Height > 0)
320+
{
321+
ContainerHeight = Height * ContainerRelativeHeight;
322+
}
323+
else
324+
{
325+
SizeChanged += (s, e) =>
326+
{
327+
var totalHeight = ((View)s).Height;
328+
ContainerHeight = totalHeight * ContainerRelativeHeight;
329+
};
330+
}
331+
}
332+
else if (ContainerHeight == (double)ContainerHeightProperty.DefaultValue)
302333
{
303334
if (containerContentView.Height > 0)
304335
{

src/MaterialDesignControls/ControlsMaterial3/MaterialButton.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Plugin.MaterialDesignControls.Material3.Implementations;
66
using Plugin.MaterialDesignControls.Styles;
77
using Xamarin.Forms;
8+
using static System.Net.Mime.MediaTypeNames;
89

910
namespace Plugin.MaterialDesignControls.Material3
1011
{
@@ -111,6 +112,15 @@ public string Text
111112
set { SetValue(TextProperty, value); }
112113
}
113114

115+
public static readonly BindableProperty IsTextUnderlinedProperty =
116+
BindableProperty.Create(nameof(IsTextUnderlined), typeof(bool), typeof(MaterialButton), defaultValue: false);
117+
118+
public bool IsTextUnderlined
119+
{
120+
get { return (bool)GetValue(IsTextUnderlinedProperty); }
121+
set { SetValue(IsTextUnderlinedProperty, value); }
122+
}
123+
114124
public static readonly BindableProperty CornerRadiusProperty =
115125
BindableProperty.Create(nameof(CornerRadius), typeof(double), typeof(MaterialButton), defaultValue: 20.0);
116126

@@ -386,7 +396,8 @@ private void Initialize()
386396
HorizontalOptions = ContentIsExpanded ? LayoutOptions.CenterAndExpand : LayoutOptions.Center,
387397
Text = ToUpper ? Text?.ToUpper() : Text,
388398
FontSize = FontSize,
389-
FontFamily = FontFamily
399+
FontFamily = FontFamily,
400+
TextDecorations = IsTextUnderlined ? TextDecorations.Underline : TextDecorations.None
390401
};
391402
_stcLayout.Children.Add(_textLabel);
392403

@@ -428,6 +439,7 @@ protected override void OnPropertyChanged([CallerMemberName] string propertyName
428439
case nameof(TextColor):
429440
case nameof(BackgroundColor):
430441
case nameof(BorderColor):
442+
case nameof(IsTextUnderlined):
431443
SetButtonType();
432444
break;
433445
case nameof(base.Opacity):
@@ -570,31 +582,36 @@ public void SetButtonType()
570582
{
571583
case MaterialButtonType.Elevated:
572584
_textLabel.TextColor = IsEnabled ? (TextColor != Color.Default ? TextColor : MaterialColor.Primary) : (DisabledTextColor != Color.Default ? DisabledTextColor : MaterialColor.Disable);
585+
_textLabel.TextDecorations = TextDecorations.None;
573586
_frameLayout.BackgroundColor = BackgroundColor != Color.Default ? BackgroundColor : MaterialColor.OnPrimary;
574587
_frameLayout.BorderColor = BackgroundColor != Color.Default ? BackgroundColor : MaterialColor.OnPrimary;
575588
_frameLayout.HasShadow = true;
576589
break;
577590
case MaterialButtonType.Filled:
578591
_textLabel.TextColor = IsEnabled ? (TextColor != Color.Default ? TextColor : MaterialColor.OnPrimary) : (DisabledTextColor != Color.Default ? DisabledTextColor : MaterialColor.OnPrimary);
592+
_textLabel.TextDecorations = TextDecorations.None;
579593
_frameLayout.BackgroundColor = IsEnabled ? (BackgroundColor != Color.Default ? BackgroundColor : MaterialColor.Primary) : (DisabledBackgroundColor != Color.Default ? DisabledBackgroundColor : MaterialColor.Disable);
580594
_frameLayout.BorderColor = Color.Transparent;
581595
_frameLayout.HasShadow = false;
582596
break;
583597
case MaterialButtonType.Tonal:
584598
_textLabel.TextColor = IsEnabled ? (TextColor != Color.Default ? TextColor : MaterialColor.Primary) : (DisabledTextColor != Color.Default ? DisabledTextColor : MaterialColor.Disable);
599+
_textLabel.TextDecorations = TextDecorations.None;
585600
var defaultBackgroundColor = Color.FromRgba(MaterialColor.Primary.R, MaterialColor.Primary.G, MaterialColor.Primary.B, 0.4);
586601
_frameLayout.BackgroundColor = IsEnabled ? defaultBackgroundColor : (DisabledBackgroundColor != Color.Default ? DisabledBackgroundColor : MaterialColor.Disable);
587602
_frameLayout.BorderColor = Color.Transparent;
588603
_frameLayout.HasShadow = false;
589604
break;
590605
case MaterialButtonType.Outlined:
591606
_textLabel.TextColor = IsEnabled ? (TextColor != Color.Default ? TextColor : MaterialColor.Primary) : (DisabledTextColor != Color.Default ? DisabledTextColor : MaterialColor.Disable);
607+
_textLabel.TextDecorations = TextDecorations.None;
592608
_frameLayout.BackgroundColor = BackgroundColor != Color.Default ? BackgroundColor : MaterialColor.OnPrimary;
593609
_frameLayout.BorderColor = IsEnabled ? (BorderColor != Color.Default ? BorderColor : MaterialColor.Primary) : (DisabledBorderColor != Color.Default ? DisabledBorderColor : MaterialColor.Disable);
594610
_frameLayout.HasShadow = false;
595611
break;
596612
case MaterialButtonType.Text:
597613
_textLabel.TextColor = IsEnabled ? (TextColor != Color.Default ? TextColor : MaterialColor.Primary) : (DisabledTextColor != Color.Default ? DisabledTextColor : MaterialColor.Disable);
614+
_textLabel.TextDecorations = IsTextUnderlined ? TextDecorations.Underline : TextDecorations.None;
598615
_frameLayout.BackgroundColor = Color.Transparent;
599616
_frameLayout.BorderColor = Color.Transparent;
600617
_frameLayout.HasShadow = false;

0 commit comments

Comments
 (0)