Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinBonilla committed Apr 3, 2024
2 parents eeea820 + f2c7116 commit 24931d4
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion MaterialDesignControls.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.8.1">
<id>Plugin.MaterialDesignControls</id>
<version>3.1.4</version>
<version>3.1.5</version>
<title>MaterialDesignControls Plugin for Xamarin Forms</title>
<authors>Horus</authors>
<owners>AgustinBonillaHorus</owners>
Expand Down
8 changes: 8 additions & 0 deletions MaterialNavigationDrawerControl.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ This property is to set the headline text font size.
This property is to set the headline text font family.
<br/>

### Property HeadlineMargin:
This property is to set the headline margin.
<br/>

### Property ActiveIndicatorBackgroundColor:
This property is to set the active indicator background color.
<br/>
Expand Down Expand Up @@ -68,6 +72,10 @@ This property is to set the section label text font size.
This property is to set the section label text font family.
<br/>

### Property SectionLabelMargin:
This property is to set the section label margin.
<br/>

### Property SectionDividerIsVisible:
This property is to set if the section's divider is visible or hidden.
<br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ public string HeadlineFontFamily
set { SetValue(HeadlineFontFamilyProperty, value); }
}

public static readonly BindableProperty HeadlineMarginProperty =
BindableProperty.Create(nameof(HeadlineMargin), typeof(Thickness), typeof(MaterialNavigationDrawer), defaultValue: new Thickness(-1));

public Thickness HeadlineMargin
{
get { return (Thickness)GetValue(HeadlineMarginProperty); }
set { SetValue(HeadlineMarginProperty, value); }
}

public static readonly BindableProperty ActiveIndicatorBackgroundColorProperty =
BindableProperty.Create(nameof(ActiveIndicatorBackgroundColor), typeof(Color), typeof(MaterialNavigationDrawer), defaultValue: MaterialColor.PrimaryContainer);

Expand Down Expand Up @@ -155,6 +164,15 @@ public string SectionLabelFontFamily
set { SetValue(SectionLabelFontFamilyProperty, value); }
}

public static readonly BindableProperty SectionLabelMarginProperty =
BindableProperty.Create(nameof(SectionLabelMargin), typeof(Thickness), typeof(MaterialNavigationDrawer), defaultValue: new Thickness(-1));

public Thickness SectionLabelMargin
{
get { return (Thickness)GetValue(SectionLabelMarginProperty); }
set { SetValue(SectionLabelMarginProperty, value); }
}

public static readonly BindableProperty SectionDividerIsVisibleProperty =
BindableProperty.Create(nameof(SectionDividerIsVisible), typeof(bool), typeof(MaterialNavigationDrawer), defaultValue: true);

Expand Down Expand Up @@ -316,7 +334,7 @@ private void Initialize()
this._lblHeadline = new Label()
{
LineBreakMode = LineBreakMode.NoWrap,
Margin = new Thickness(0, 16, 0, 16),
Margin = HeadlineMargin != new Thickness(-1) ? HeadlineMargin : new Thickness(0, 16),
VerticalOptions = LayoutOptions.Center,
TextColor = this.HeadlineColor,
IsVisible = !string.IsNullOrWhiteSpace(Headline),
Expand Down Expand Up @@ -359,6 +377,10 @@ protected override void OnPropertyChanged([CallerMemberName] string propertyName
this._lblHeadline.FontSize = this.HeadlineFontSize;
break;

case nameof(this.HeadlineMargin):
this._lblHeadline.Margin = HeadlineMargin != new Thickness(-1) ? HeadlineMargin : new Thickness(0, 16);
break;

case nameof(base.Opacity):
case nameof(base.Scale):
case nameof(base.IsVisible):
Expand Down Expand Up @@ -398,8 +420,13 @@ private void SetItemSource()
label.TextColor = SectionLabelColor;
label.Padding = new Thickness(12, 0);

var topLabelMargin = SectionDividerIsVisible ? 0 : 16;
label.Margin = new Thickness(0, topLabelMargin, 0, 16);
if (SectionLabelMargin != new Thickness(-1))
label.Margin = SectionLabelMargin;
else
{
var topLabelMargin = SectionDividerIsVisible ? 0 : 16;
label.Margin = new Thickness(0, topLabelMargin, 0, 16);
}

_itemsContainer.Children.Add(label);
}
Expand Down

0 comments on commit 24931d4

Please sign in to comment.