Skip to content

Commit

Permalink
Merge pull request #6 from IeuanWalker/NET7
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
IeuanWalker authored Dec 29, 2022
2 parents c8139eb + bcf6ba3 commit 21b296f
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
schedule:
- cron: '0 0 1 */3 *' # Every 3 months
env:
NET_VERSION: 6.0.400
NET_VERSION: 7.0.101
PROJECT_PATH: 'Scr/Breadcrumb.csproj'
NUGET_PATH: './**/IeuanWalker.Maui.Breadcrumb.1.0.0.nupkg'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [published]

env:
NET_VERSION: 6.0.400
NET_VERSION: 7.0.101
PROJECT_PATH: 'Scr/Breadcrumb.csproj'
NUGET_PATH: './**/IeuanWalker.Maui.Breadcrumb.${{ github.event.release.tag_name }}.nupkg'

Expand Down
2 changes: 1 addition & 1 deletion Demo/App.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0-android;net6.0-ios;</TargetFrameworks>
<TargetFrameworks>net7.0-android;net7.0-ios;</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>App</RootNamespace>
<UseMaui>true</UseMaui>
Expand Down
62 changes: 34 additions & 28 deletions Demo/Pages/BasePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,32 @@

<!-- Production -->
<Label Text="Production version" TextColor="{DynamicResource Text}" />
<Grid x:Name="Breadcrumb"
Grid.Row="1"
<Grid Grid.Row="1"
BackgroundColor="{DynamicResource BreadcrumBackground}"
ColumnDefinitions="auto,*"
RowDefinitions="auto,1"
RowSpacing="0">
<Border x:Name="HomeButton"
Grid.Row="0"
Grid.Column="0"
Margin="10,10,0,0"
AutomationProperties.IsInAccessibleTree="True">
Margin="10,0,0,0"
AutomationProperties.IsInAccessibleTree="True"
BackgroundColor="Transparent"
VerticalOptions="Center">
<Label FontFamily="FASolid900"
FontSize="18"
Text="&#xf015;"
TextColor="{DynamicResource TextAccentColour}" />
</Border>
<breadcrumb:Breadcrumb Grid.Row="0"
Grid.Column="1"
Margin="0"
Padding="0"
BackgroundColor="Transparent"
BreadcrumbBackgroundColor="{DynamicResource BreadcrumBackground}"
CornerRadius="6"
FontSize="Small"
LastBreadcrumbBackgroundColor="{DynamicResource BreadcrumBackground}"
LastBreadcrumbCornerRadius="6"
LastBreadcrumbTextColor="{DynamicResource TextSilverColour}"
TextColor="{DynamicResource TextAccentColour}"
VerticalOptions="Start">
TextColor="{DynamicResource TextAccentColour}">
<breadcrumb:Breadcrumb.Separator>
<FontImageSource FontFamily="FASolid900"
Glyph="&#xf054;"
Expand All @@ -55,13 +52,31 @@
BackgroundColor="{DynamicResource DividerGradientEndColour}"
HeightRequest="1" />
</Grid>
<breadcrumb:Breadcrumb BreadcrumbBackgroundColor="{DynamicResource BreadcrumBackground}"
CornerRadius="6"
FontSize="Small"
LastBreadcrumbBackgroundColor="{DynamicResource BreadcrumBackground}"
LastBreadcrumbCornerRadius="6"
LastBreadcrumbTextColor="{DynamicResource TextSilverColour}"
TextColor="{DynamicResource TextAccentColour}">
<breadcrumb:Breadcrumb.FirstBreadcrumb>
<FontImageSource FontFamily="FASolid900"
Glyph="&#xf015;"
Size="18"
Color="{DynamicResource TextAccentColour}" />
</breadcrumb:Breadcrumb.FirstBreadcrumb>
<breadcrumb:Breadcrumb.Separator>
<FontImageSource FontFamily="FASolid900"
Glyph="&#xf054;"
Size="12"
Color="{DynamicResource TextAccentColour}" />
</breadcrumb:Breadcrumb.Separator>
</breadcrumb:Breadcrumb>
<BoxView BackgroundColor="{DynamicResource DividerGradientEndColour}" HeightRequest="1" />

<!-- Dynamic test -->
<Label Text="Dynamic Tests" TextColor="{DynamicResource Text}" />
<breadcrumb:Breadcrumb Margin="0"
Padding="0"
AnimationSpeed="100"
BackgroundColor="Transparent"
<breadcrumb:Breadcrumb AnimationSpeed="100"
BreadcrumbBackgroundColor="{DynamicResource DynamicBreadcrumbBackgroundColor}"
BreadcrumbMargin="10"
CornerRadius="6"
Expand All @@ -70,8 +85,7 @@
LastBreadcrumbCornerRadius="20"
LastBreadcrumbTextColor="{DynamicResource DynamicLastBreadcrumbTextColor}"
ScrollBarVisibility="Always"
TextColor="{DynamicResource DynamicTextColor}"
VerticalOptions="Start">
TextColor="{DynamicResource DynamicTextColor}">
<breadcrumb:Breadcrumb.Separator>
<FontImageSource FontFamily="FASolid900"
Glyph="&#xf054;"
Expand All @@ -81,12 +95,8 @@
</breadcrumb:Breadcrumb>

<!-- FontImageSource -->

<Label Text="Icon - FontAwesome" TextColor="{DynamicResource Text}" />
<breadcrumb:Breadcrumb Padding="15"
LastBreadcrumbTextColor="{DynamicResource Text}"
TextColor="{DynamicResource Text}"
VerticalOptions="Start">
<breadcrumb:Breadcrumb LastBreadcrumbTextColor="{DynamicResource Text}" TextColor="{DynamicResource Text}">
<breadcrumb:Breadcrumb.Separator>
<FontImageSource FontFamily="FASolid900"
Glyph="&#xf054;"
Expand All @@ -97,23 +107,19 @@

<!-- UriImageSource -->
<Label Text="Image - URL" TextColor="{DynamicResource Text}" />
<breadcrumb:Breadcrumb Padding="15"
LastBreadcrumbTextColor="{DynamicResource Text}"
<breadcrumb:Breadcrumb LastBreadcrumbTextColor="{DynamicResource Text}"
SeparatorHeight="30"
TextColor="{DynamicResource Text}"
VerticalOptions="Start">
TextColor="{DynamicResource Text}">
<breadcrumb:Breadcrumb.Separator>
<UriImageSource Uri="https://cdn.iconscout.com/icon/free/png-256/xamarin-4-599473.png" />
</breadcrumb:Breadcrumb.Separator>
</breadcrumb:Breadcrumb>

<!-- FileImageSource -->
<Label Text="Image - Embedded" TextColor="{DynamicResource Text}" />
<breadcrumb:Breadcrumb Padding="15"
LastBreadcrumbTextColor="{DynamicResource Text}"
<breadcrumb:Breadcrumb LastBreadcrumbTextColor="{DynamicResource Text}"
SeparatorHeight="30"
TextColor="{DynamicResource Text}"
VerticalOptions="Start">
TextColor="{DynamicResource Text}">
<breadcrumb:Breadcrumb.Separator>
<FileImageSource File="example_image.png" />
</breadcrumb:Breadcrumb.Separator>
Expand Down
7 changes: 3 additions & 4 deletions Demo/Resources/Styles/DefaultTheme.xaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App.Resources.Styles.DefaultTheme">
</ResourceDictionary>
<ResourceDictionary x:Class="App.Resources.Styles.DefaultTheme"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" />
2 changes: 1 addition & 1 deletion Scr/Breadcrumb.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios;</TargetFrameworks>
<TargetFrameworks>net7.0;net7.0-android;net7.0-ios;</TargetFrameworks>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
2 changes: 1 addition & 1 deletion Scr/Breadcrumb.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ContentView x:Class="Breadcrumb.Breadcrumb"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Padding="15"
Padding="4"
AutomationProperties.IsInAccessibleTree="False"
IsVisible="False">
<ContentView.Content>
Expand Down
54 changes: 24 additions & 30 deletions Scr/Breadcrumb.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ async void BreadCrumbContainer_Loaded(object sender, EventArgs e)

// Scroll to end of control
await Task.Delay(10);

// HACK: Remove once fixed - https://github.com/dotnet/maui/issues/9446
if (BreadCrumbContainer.Width < BreadCrumbsScrollView.Width)
{
BreadCrumbContainer.WidthRequest = BreadCrumbsScrollView.Width;
}

await BreadCrumbsScrollView.ScrollToAsync(BreadCrumbContainer, ScrollToPosition.End, false);

// Add breadcrumb to container
Expand All @@ -219,20 +226,31 @@ async void BreadCrumbContainer_Loaded(object sender, EventArgs e)
Border BreadCrumbLabelCreator(Page page, bool isLast, bool isFirst)
{
// Create StackLayout to contain the label within a PancakeView
VerticalStackLayout stackLayout = new()
Border container = new()
{
VerticalOptions = LayoutOptions.Center,
BackgroundColor = Colors.Transparent,
StrokeShape = new RoundRectangle
{
CornerRadius = isLast ? LastBreadcrumbCornerRadius : CornerRadius
},
Padding = 10,
Stroke = Colors.Transparent,
Margin = BreadcrumbMargin,
VerticalOptions = LayoutOptions.Center
};
AutomationProperties.SetIsInAccessibleTree(stackLayout, false);
container.SetBinding(BackgroundColorProperty, new Binding(isLast ? nameof(LastBreadcrumbBackgroundColor) : nameof(BreadcrumbBackgroundColor), source: new RelativeBindingSource(RelativeBindingSourceMode.FindAncestor, typeof(Breadcrumb))));

AutomationProperties.SetIsInAccessibleTree(container, true);
SemanticProperties.SetDescription(container, page.Title);

// Create and Add label to StackLayout
if (isFirst && FirstBreadcrumb != null)
{
stackLayout.Children.Add(new Image
container.Content = new Image
{
Source = FirstBreadcrumb,
VerticalOptions = LayoutOptions.Center
});
};
}
else
{
Expand All @@ -246,33 +264,9 @@ Border BreadCrumbLabelCreator(Page page, bool isLast, bool isFirst)
breadcrumbText.SetBinding(Label.TextColorProperty, new Binding(isLast ? nameof(LastBreadcrumbTextColor) : nameof(TextColor), source: new RelativeBindingSource(RelativeBindingSourceMode.FindAncestor, typeof(Breadcrumb))));
AutomationProperties.SetIsInAccessibleTree(breadcrumbText, false);

stackLayout.Children.Add(breadcrumbText);
container.Content = breadcrumbText;
}

Border accessibilityContainer = new()
{
Padding = 10,
Stroke = Colors.Transparent,
VerticalOptions = LayoutOptions.Center,
Content = stackLayout
};

Border container = new()
{
StrokeShape = new RoundRectangle
{
CornerRadius = isLast ? LastBreadcrumbCornerRadius : CornerRadius
},
Padding = 0,
Stroke = Colors.Transparent,
Content = accessibilityContainer,
Margin = BreadcrumbMargin
};
container.SetBinding(BackgroundColorProperty, new Binding(isLast ? nameof(LastBreadcrumbBackgroundColor) : nameof(BreadcrumbBackgroundColor), source: new RelativeBindingSource(RelativeBindingSourceMode.FindAncestor, typeof(Breadcrumb))));

AutomationProperties.SetIsInAccessibleTree(accessibilityContainer, true);
AutomationProperties.SetName(accessibilityContainer, page.Title);

return container;
}

Expand Down

0 comments on commit 21b296f

Please sign in to comment.