Skip to content

Commit

Permalink
In the middle of a style engine, sorry, lol
Browse files Browse the repository at this point in the history
  • Loading branch information
Programming-With-Chris committed Aug 18, 2022
1 parent 154e0ba commit 49aaf6c
Show file tree
Hide file tree
Showing 11 changed files with 216 additions and 77 deletions.
26 changes: 13 additions & 13 deletions ShoppingList/Controls/CircularButton.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Runtime.CompilerServices;
using IImage = Microsoft.Maui.Graphics.IImage;

namespace ShoppingList.Controls;
Expand Down Expand Up @@ -38,7 +39,8 @@ public string Image
nameof(Image), typeof(string), typeof(CircularButton), propertyChanged: OnImageChanged);

public new BindableProperty IsVisibleProperty = BindableProperty.Create(
nameof(IsVisible), typeof(bool), typeof(CircularButton), propertyChanged: OnIsVisibleChanged);
nameof(IsVisible), typeof(bool), typeof(CircularButton),
propertyChanging: OnIsVisibleChanged);

public CircularButton()
{
Expand Down Expand Up @@ -69,19 +71,17 @@ static void OnIsVisibleChanged(BindableObject bindable, object oldValue, object
{
var control = (CircularButton)bindable;

//var newValueAsBool = (bool)newValue;
//thisDrawable.SetInvisible = !(bool)newValue;
//control.Invalidate();
var newValueAsBool = (bool)newValue;

// if ( == true)
// {
// control.FadeTo(1, 2000);
// } else
// {
// control.FadeTo(0, 4000);
// }
if (newValueAsBool == true)
{
control.FadeTo(1, 2000);
} else
{
control.FadeTo(0, 4000);
}

var thisDrawable = control.Drawable as ShoppingList.Drawable.CircularButtonDrawable;
//thisDrawable.SetInvisible = (bool)newValue;
control.Invalidate();
}

}
20 changes: 12 additions & 8 deletions ShoppingList/Resources/Styles/Colors.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">

<Color x:Key="Primary">#E2EDEA</Color>
<Color x:Key="Secondary">#B357DD</Color>
<Color x:Key="Tertiary">#31B18C</Color>
<Color x:Key="White">#B357DD</Color>
<Color x:Key="Black"></Color>
<Color x:Key="Primary">#0081A7</Color>
<Color x:Key="Secondary">#00AFB9</Color>
<Color x:Key="Tertiary">#FDFCDC</Color>
<Color x:Key="Accent">#FED9B7</Color>
<Color x:Key="DarkAccent">#F07167</Color>
<Color x:Key="White">#FFFFFF</Color>
<Color x:Key="Black">#000000</Color>
<Color x:Key="BackgroundLight">#FFFFFF</Color>
<Color x:Key="BackgroundDark">#000000</Color>
<Color x:Key="Gray100">#E1E1E1</Color>
<Color x:Key="Gray200">#C8C8C8</Color>
<Color x:Key="Gray300">#ACACAC</Color>
Expand All @@ -17,10 +21,10 @@
<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="PrimaryBrush" Color="{DynamicResource Primary}"/>
<SolidColorBrush x:Key="SecondaryBrush" Color="{DynamicResource Secondary}"/>
<SolidColorBrush x:Key="TertiaryBrush" Color="{StaticResource Tertiary}"/>
<SolidColorBrush x:Key="WhiteBrush" Color="{StaticResource White}"/>
<SolidColorBrush x:Key="WhiteBrush" Color="{DynamicResource White}"/>
<SolidColorBrush x:Key="BlackBrush" Color="{StaticResource Black}"/>
<SolidColorBrush x:Key="Gray100Brush" Color="{StaticResource Gray100}"/>
<SolidColorBrush x:Key="Gray200Brush" Color="{StaticResource Gray200}"/>
Expand Down
18 changes: 9 additions & 9 deletions ShoppingList/Resources/Styles/Styles.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">

<Style TargetType="ActivityIndicator">
<Setter Property="Color" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="Color" Value="{AppThemeBinding Light={DynamicResource Primary}, Dark={StaticResource White}}" />
</Style>

<Style TargetType="IndicatorView">
Expand All @@ -24,8 +24,8 @@
</Style>

<Style TargetType="Button">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Primary}}" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={DynamicResource Primary}}" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={DynamicResource Primary}, Dark={StaticResource White}}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="CornerRadius" Value="8"/>
Expand All @@ -46,7 +46,7 @@
</Style>

<Style TargetType="CheckBox">
<Setter Property="Color" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="Color" Value="{AppThemeBinding Light={DynamicResource Primary}, Dark={StaticResource White}}" />
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
Expand Down Expand Up @@ -147,7 +147,7 @@
</Style>

<Style TargetType="Label">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
<Setter Property="TextColor" Value="{AppThemeBinding Light={DynamicResource Tertiary}, Dark={DynamicResource Tertiary}}" />
<Setter Property="FontFamily" Value="OpenSansRegular" />
<Setter Property="FontSize" Value="14" />
<Setter Property="VisualStateManager.VisualStateGroups">
Expand Down Expand Up @@ -192,7 +192,7 @@
</Style>

<Style TargetType="ProgressBar">
<Setter Property="ProgressColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="ProgressColor" Value="{AppThemeBinding Light={DynamicResource Primary}, Dark={StaticResource White}}" />
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
Expand Down Expand Up @@ -281,7 +281,7 @@
</Style>

<Style TargetType="Slider">
<Setter Property="MinimumTrackColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="MinimumTrackColor" Value="{AppThemeBinding Light={DynamicResource Primary}, Dark={StaticResource White}}" />
<Setter Property="MaximumTrackColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray600}}" />
<Setter Property="ThumbColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="VisualStateManager.VisualStateGroups">
Expand Down Expand Up @@ -354,11 +354,11 @@

<Style TargetType="Page" ApplyToDerivedTypes="True">
<Setter Property="Padding" Value="0"/>
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={DynamicResource Secondary}, Dark={DynamicResource Secondary}}" />
</Style>

<Style TargetType="Shell" ApplyToDerivedTypes="True">
<Setter Property="Shell.BackgroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource Gray950}}" />
<Setter Property="Shell.BackgroundColor" Value="{AppThemeBinding Light={StaticResource Secondary}, Dark={StaticResource Secondary}}" />
<Setter Property="Shell.ForegroundColor" Value="{OnPlatform WinUI={StaticResource Primary}, Default={StaticResource White}}" />
<Setter Property="Shell.TitleColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource White}}" />
<Setter Property="Shell.DisabledColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
Expand Down
12 changes: 7 additions & 5 deletions ShoppingList/View/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
</Frame.GestureRecognizers>
<VerticalStackLayout>
<Label Text="{Binding Name}"
FontSize="Medium"/>
FontSize="Medium"
TextColor="{DynamicResource Secondary}"/>
<Label Text="{Binding Type}"
FontSize="Micro"
TextColor="{DynamicResource Secondary}"
Margin="25,0,0,0"/>
</VerticalStackLayout>
</Frame>
Expand All @@ -43,17 +45,17 @@
<Button Text="Get UserLists"
Command="{Binding GetUserListsCommand}"
IsEnabled="{Binding IsNotBusy}"
TextColor="{StaticResource Primary}"
BackgroundColor="{StaticResource Secondary}"
TextColor="{DynamicResource Primary}"
BackgroundColor="{DynamicResource Secondary}"
Grid.Row="1"
Margin="8"/>


<Button Text="Create New List"
Command="{Binding CreateUserListCommand}"
IsEnabled="{Binding IsNotBusy}"
TextColor="{StaticResource Primary}"
BackgroundColor="{StaticResource Secondary}"
TextColor="{DynamicResource Primary}"
BackgroundColor="{DynamicResource Secondary}"
Grid.Row="1"
Grid.Column="3"
Margin="8"/>
Expand Down
81 changes: 71 additions & 10 deletions ShoppingList/View/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:model="clr-namespace:ShoppingList.Model"
xmlns:viewmodel="clr-namespace:ShoppingList.ViewModels"
xmlns:control="clr-namespace:ShoppingList.Controls"
x:DataType="viewmodel:SettingsViewModel"
x:Class="ShoppingList.SettingsView"
Shell.PresentationMode="Animated"
Expand All @@ -18,8 +19,8 @@
Spacing="10"
Grid.ColumnSpan="3">

<Border BackgroundColor="{StaticResource Secondary}">
<Label Text="List Sorting Settings" TextColor="{StaticResource Primary}"
<Border BackgroundColor="{DynamicResource Secondary}">
<Label Text="List Sorting Settings"

Margin="5,15,15,15"
Padding="10"/>
Expand All @@ -28,31 +29,27 @@
<HorizontalStackLayout
Margin="25,0,0,0"
Grid.ColumnSpan="3">
<Label Text="Start at back of store?"
TextColor="{StaticResource Primary}"/>
<Label Text="Start at back of store?"/>
<CheckBox IsChecked="{Binding StartAtBackOfStore}"
Color="{StaticResource Primary}"
Color="{DynamicResource Primary}"
HorizontalOptions="Center"
Grid.Column="2"/>
</HorizontalStackLayout>

<HorizontalStackLayout
Margin="25,0,0,0"
Grid.ColumnSpan="3">
<Label Text="Get Frozen Aisle Food Last?"
TextColor="{StaticResource Primary}"/>
<Label Text="Get Frozen Aisle Food Last?" />
<CheckBox IsChecked="{Binding FrozenFoodLast}"
Color="{StaticResource Primary}"
Color="{DynamicResource Primary}"
Grid.Column="2"/>
</HorizontalStackLayout>

<HorizontalStackLayout
Margin="25,0,0,0">
<Label Text="Default Kroger Location:"
TextColor="{StaticResource Primary}"
Margin="0,0,25,0"/>
<Label Text="{Binding KrogerStoreName}"
TextColor="{StaticResource Primary}"
>
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OpenLocationFinderDialogCommand}"/>
Expand All @@ -62,6 +59,70 @@

</HorizontalStackLayout>

<Border BackgroundColor="{DynamicResource Secondary}" Margin="0,25,0,0">
<Label Text="List Sorting Settings"
Margin="5,15,15,15"
Padding="10"/>
</Border>

<Label Margin="25,0,0,0"
Text="Primary Theme Color:"
>
</Label>

<HorizontalStackLayout Padding="25"
Margin="25,0,0,0">
<control:CircularButton ButtonColor="CadetBlue"
WidthRequest="30"
HeightRequest="30"
Margin="25,0,0,25"
x:Name="CadetBlueButton">

<control:CircularButton.GestureRecognizers>
<TapGestureRecognizer Command="{Binding UpdatePrimaryColorPressedCommand}"
CommandParameter="CadetBlue"/>
</control:CircularButton.GestureRecognizers>

</control:CircularButton>
<control:CircularButton ButtonColor="Pink"
WidthRequest="30"
HeightRequest="30"
Margin="25,0,0,25"
x:Name="PinkButton">

<control:CircularButton.GestureRecognizers>
<TapGestureRecognizer Command="{Binding UpdatePrimaryColorPressedCommand}"
CommandParameter="Pink"/>
</control:CircularButton.GestureRecognizers>

</control:CircularButton>
<control:CircularButton ButtonColor="MediumPurple"
WidthRequest="30"
HeightRequest="30"
Margin="25,0,0,25"
x:Name="MediumPurpleButton">

<control:CircularButton.GestureRecognizers>
<TapGestureRecognizer Command="{Binding UpdatePrimaryColorPressedCommand}"
CommandParameter="MediumPurple"/>
</control:CircularButton.GestureRecognizers>

</control:CircularButton>
<control:CircularButton ButtonColor="WhiteSmoke"
WidthRequest="30"
HeightRequest="30"
Margin="25,0,0,25"
x:Name="WhiteSmokeButton">

<control:CircularButton.GestureRecognizers>
<TapGestureRecognizer Command="{Binding UpdatePrimaryColorPressedCommand}"
CommandParameter="WhiteSmoke"/>
</control:CircularButton.GestureRecognizers>

</control:CircularButton>

</HorizontalStackLayout>

</VerticalStackLayout>


Expand Down
2 changes: 2 additions & 0 deletions ShoppingList/View/SettingsView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ public SettingsView(SettingsViewModel settingsViewModel)
BindingContext = settingsViewModel;

}


}

2 changes: 1 addition & 1 deletion ShoppingList/View/StoreFinder.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
CommandParameter="{Binding .}"/>

<Label Text="{Binding .}"
TextColor="{StaticResource Primary}"/>
TextColor="{DynamicResource Primary}"/>
</HorizontalStackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
Expand Down
12 changes: 6 additions & 6 deletions ShoppingList/View/UserListDataInput.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

<Entry Text="{Binding UlName}"
MaxLength="20"
Style="{StaticResource CommonEntryStyle}"
Style="{DynamicResource CommonEntryStyle}"
ReturnCommand="{Binding UserListCompletedCommand}"
Placeholder="List Name"/>

<Entry Text="{Binding UlTargetStore}"
MaxLength="20"
Style="{StaticResource CommonEntryStyle}"
Style="{DynamicResource CommonEntryStyle}"
Placeholder="The Store you want to use this list for?"
ReturnCommand="{Binding UserListCompletedCommand}"/>

Expand All @@ -33,12 +33,12 @@
Grid.ColumnSpan="2">

<Label Text="Type of List: "
TextColor="{StaticResource Primary}"
TextColor="{DynamicResource Primary}"
Margin="0,5,5,0"/>

<Picker ItemsSource="{Binding TypeList}"
SelectedIndexChanged="Picker_SelectedIndexChanged"
TextColor="{StaticResource Primary}"
TextColor="{DynamicResource Primary}"
FontSize="15"
SelectedIndex="1"
x:Name="TypeOfListPicker"
Expand All @@ -49,11 +49,11 @@

<HorizontalStackLayout>
<Label Text="Pre-populate list with Items from last time?"
TextColor="{StaticResource Primary}"
TextColor="{DynamicResource Primary}"
Padding="10"/>

<CheckBox IsChecked="{Binding PrepopulateList, Mode=TwoWay}"
Color="{StaticResource Primary}"
Color="{DynamicResource Primary}"
CheckedChanged="CheckBox_CheckedChanged"/>

</HorizontalStackLayout>
Expand Down
Loading

0 comments on commit 49aaf6c

Please sign in to comment.