Skip to content

Commit

Permalink
Fixed sample (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow authored Dec 4, 2024
1 parent d69383f commit e134b75
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 46 deletions.
2 changes: 0 additions & 2 deletions samples/SkiaSharpDemo/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
<views:BottomTabBarResources />
<views:OptionButtonsResources />
</ResourceDictionary.MergedDictionaries>

<converters:RoundToIntConverter x:Key="RoundToInt" />
Expand Down
10 changes: 8 additions & 2 deletions samples/SkiaSharpDemo/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
namespace SkiaSharpDemo;
using SkiaSharpDemo.Views;

namespace SkiaSharpDemo;

public partial class App : Application
{
public App()
{
InitializeComponent();

MainPage = new AppShell();
Resources.MergedDictionaries.Add(new OptionButtonsResources());
Resources.MergedDictionaries.Add(new BottomTabBarResources());
}

protected override Window CreateWindow(IActivationState? activationState) =>
new Window(new AppShell());
}
5 changes: 3 additions & 2 deletions samples/SkiaSharpDemo/Demos/BlurHash/BlurHashPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
</Grid>

<CarouselView Grid.Row="1"
HeightRequest="1" MinimumHeightRequest="100"
ItemsSource="{Binding Sources}" CurrentItem="{Binding Source}"
MinimumHeightRequest="100"
ItemsSource="{Binding Sources}"
CurrentItem="{Binding Source}"
PeekAreaInsets="24,0"
Margin="-12,0">
<CarouselView.ItemTemplate>
Expand Down
6 changes: 3 additions & 3 deletions samples/SkiaSharpDemo/Demos/Confetti/ConfettiPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
HorizontalOptions="End" VerticalOptions="Start"
IsVisible="{Binding IsComplete, Source={Reference confettiView}}" />

<views:BottomTabBar SelectedIndex="{Binding SelectedTab}" PagePadding="12,6">
<views:BottomTabBar SelectedIndex="{Binding SelectedTab}" PagePadding="12" Background="{StaticResource BackgroundBrush}">
<views:BottomTabCollection>

<!-- "add type" -->
Expand Down Expand Up @@ -101,7 +101,7 @@
</views:BottomTab>

<views:BottomTab Title="&#xf3fd;" HorizontalOptions="Fill" VerticalOptions="Center">
<Grid ColumnDefinitions="Auto,*,30"
<Grid ColumnDefinitions="Auto,*,Auto"
RowDefinitions="Auto,Auto"
ColumnSpacing="12" RowSpacing="12" Padding="12">
<Label Text="Min"
Expand All @@ -127,7 +127,7 @@
</views:BottomTab>

<views:BottomTab Title="&#xf017;" HorizontalOptions="Fill" VerticalOptions="Center">
<Grid ColumnDefinitions="Auto,*,30"
<Grid ColumnDefinitions="Auto,*,Auto"
RowDefinitions="Auto,Auto"
ColumnSpacing="12" RowSpacing="12" Padding="12">
<Label Text="Lifetime"
Expand Down
4 changes: 1 addition & 3 deletions samples/SkiaSharpDemo/Demos/Extended/InterpolationPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
<StackLayout Spacing="12">

<Label Text="{Binding Interpolation, StringFormat='{}{0:0}%'}" HorizontalOptions="Center" />
<Slider Minimum="0" Maximum="100" Value="{Binding Interpolation}"
MinimumTrackColor="Black" MaximumTrackColor="Black"
ThumbColor="Black" />
<Slider Minimum="0" Maximum="100" Value="{Binding Interpolation}" />

<Button Text="Toggle Animation" Command="{Binding AnimateCommand}" />

Expand Down
1 change: 1 addition & 0 deletions samples/SkiaSharpDemo/Demos/Extended/ShapesPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ private void OnPaintSurface(object sender, SKPaintSurfaceEventArgs e)
{
IsAntialias = true,
TextSize = 12,
Color = ((SolidColorBrush)App.Current!.Resources["ForegroundBrush"]).Color.ToSKColor(),
};

// create the paint for the shapes
Expand Down
23 changes: 14 additions & 9 deletions samples/SkiaSharpDemo/Resources/Styles/Colors.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">

<!-- Note: For Android please see also Platforms\Android\Resources\values\colors.xml -->

<Color x:Key="Primary">#512BD4</Color>
<Color x:Key="PrimaryDark">#ac99ea</Color>
<Color x:Key="PrimaryDarkText">#242424</Color>
<Color x:Key="Secondary">#DFD8F7</Color>
<Color x:Key="SecondaryDarkText">#9880e5</Color>
<Color x:Key="Tertiary">#2B0B98</Color>

<Color x:Key="White">White</Color>
<Color x:Key="Black">Black</Color>
<Color x:Key="Magenta">#D600AA</Color>
<Color x:Key="MidnightBlue">#190649</Color>
<Color x:Key="OffBlack">#1f1f1f</Color>

<Color x:Key="Gray100">#E1E1E1</Color>
<Color x:Key="Gray200">#C8C8C8</Color>
<Color x:Key="Gray300">#ACACAC</Color>
Expand All @@ -17,11 +27,13 @@
<Color x:Key="Gray600">#404040</Color>
<Color x:Key="Gray900">#212121</Color>
<Color x:Key="Gray950">#141414</Color>

<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource Primary}"/>
<SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource Secondary}"/>
<SolidColorBrush x:Key="TertiaryBrush" Color="{StaticResource Tertiary}"/>
<SolidColorBrush x:Key="WhiteBrush" Color="{StaticResource White}"/>
<SolidColorBrush x:Key="BlackBrush" Color="{StaticResource Black}"/>

<SolidColorBrush x:Key="Gray100Brush" Color="{StaticResource Gray100}"/>
<SolidColorBrush x:Key="Gray200Brush" Color="{StaticResource Gray200}"/>
<SolidColorBrush x:Key="Gray300Brush" Color="{StaticResource Gray300}"/>
Expand All @@ -31,14 +43,7 @@
<SolidColorBrush x:Key="Gray900Brush" Color="{StaticResource Gray900}"/>
<SolidColorBrush x:Key="Gray950Brush" Color="{StaticResource Gray950}"/>

<Color x:Key="Yellow100Accent">#F7B548</Color>
<Color x:Key="Yellow200Accent">#FFD590</Color>
<Color x:Key="Yellow300Accent">#FFE5B9</Color>
<Color x:Key="Cyan100Accent">#28C2D1</Color>
<Color x:Key="Cyan200Accent">#7BDDEF</Color>
<Color x:Key="Cyan300Accent">#C3F2F4</Color>
<Color x:Key="Blue100Accent">#3E8EED</Color>
<Color x:Key="Blue200Accent">#72ACF1</Color>
<Color x:Key="Blue300Accent">#A7CBF6</Color>
<SolidColorBrush x:Key="ForegroundBrush" Color="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
<SolidColorBrush x:Key="BackgroundBrush" Color="{AppThemeBinding Light='#ccffffff', Dark='#cc1f1f1f'}" />

</ResourceDictionary>
Loading

0 comments on commit e134b75

Please sign in to comment.