parent
96c33ccb30
commit
58773d678e
@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="ShoopNCook.Pages.MyList"
|
||||
Title="MyList">
|
||||
<VerticalStackLayout>
|
||||
<Label
|
||||
Text="Welcome to .NET MAUI!"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center" />
|
||||
</VerticalStackLayout>
|
||||
</ContentPage>
|
@ -1,9 +0,0 @@
|
||||
namespace ShoopNCook.Pages;
|
||||
|
||||
public partial class MyList : ContentPage
|
||||
{
|
||||
public MyList()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="ShoopNCook.Pages.MyListPage"
|
||||
Title="MyList"
|
||||
BackgroundColor="{StaticResource BackgroundPrimary}"
|
||||
xmlns:views="clr-namespace:ShoopNCook.Views">
|
||||
<Grid
|
||||
RowDefinitions="Auto, *, Auto">
|
||||
<!-- Header label and return button -->
|
||||
<Grid
|
||||
Grid.Row="0"
|
||||
Padding="20, 40, 0, 30"
|
||||
ColumnDefinitions="*"
|
||||
MaximumHeightRequest="60">
|
||||
|
||||
<ImageButton
|
||||
Grid.Column="0"
|
||||
HeightRequest="50"
|
||||
WidthRequest="50"
|
||||
Source="arrow_back.svg"
|
||||
HorizontalOptions="Start"/>
|
||||
|
||||
<Label
|
||||
Grid.Column="0"
|
||||
FontSize="24"
|
||||
TextColor="{StaticResource TextColorPrimary}"
|
||||
Text="My Weekly List"
|
||||
MaximumHeightRequest="60"
|
||||
FontFamily="PoppinsBold"
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="Center"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Favorite items -->
|
||||
<ScrollView
|
||||
Grid.Row="1">
|
||||
<FlexLayout
|
||||
JustifyContent="Center"
|
||||
AlignItems="Start"
|
||||
AlignContent="Start"
|
||||
Direction="Row"
|
||||
Wrap="Wrap">
|
||||
|
||||
<views:RecipeView Margin="5" Note="4.5" Title="Spaghetti Bolognese" Subtitle="30 min"/>
|
||||
<views:RecipeView Margin="5" Note="3" Title="Chickend Curry" Subtitle="45 min"/>
|
||||
<views:RecipeView Margin="5" Note="0.2" Title="Beef Stroganoff" Subtitle="10 min"/>
|
||||
<views:RecipeView Margin="5" Note="1.6" Title="Fish And Ships" Subtitle="15 min"/>
|
||||
<views:RecipeView Margin="5" Note="5" Title="Caesar Salad" Subtitle="20 min"/>
|
||||
<views:RecipeView Margin="5" Note="3.5" Title="Vegetables" Subtitle="60 min"/>
|
||||
<views:RecipeView Margin="5" Note="4.6" Title="Guacamole" Subtitle="90 min"/>
|
||||
<views:RecipeView Margin="5" Note="4" Title="Pad Thai" Subtitle="10 min"/>
|
||||
<views:RecipeView Margin="5" Note="3" Title="French Toast" Subtitle="5 min"/>
|
||||
<views:RecipeView Margin="5" Note="2" Title="Margherita Pizza" Subtitle="2 min"/>
|
||||
</FlexLayout>
|
||||
</ScrollView>
|
||||
</Grid>
|
||||
</ContentPage>
|
@ -0,0 +1,9 @@
|
||||
namespace ShoopNCook.Pages;
|
||||
|
||||
public partial class MyListPage : ContentPage
|
||||
{
|
||||
public MyListPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="ShoopNCook.Views.CounterView"
|
||||
x:Name="Counter">
|
||||
<Grid
|
||||
ColumnDefinitions="*, Auto, *">
|
||||
|
||||
<Border
|
||||
Grid.Column="0"
|
||||
Stroke="Transparent"
|
||||
StrokeShape="RoundRectangle 100"
|
||||
BackgroundColor="{StaticResource Selected}">
|
||||
<ImageButton
|
||||
Source="minus.svg"
|
||||
WidthRequest="40"
|
||||
HeightRequest="40"
|
||||
Clicked="OnMinus"/>
|
||||
</Border>
|
||||
|
||||
<HorizontalStackLayout
|
||||
Grid.Column="1"
|
||||
Spacing="3"
|
||||
Margin="10, 0, 10, 0">
|
||||
<Label
|
||||
x:Name="CountLabel"
|
||||
Text="{Binding Count, Source={x:Reference Counter}}"
|
||||
TextColor="{StaticResource TextColorPrimary}"
|
||||
VerticalTextAlignment="Center"
|
||||
FontFamily="PoppinsMedium"/>
|
||||
|
||||
<Label
|
||||
x:Name="CounterLabel"
|
||||
Text="{Binding CounterText, Source={x:Reference Counter}}"
|
||||
TextColor="{StaticResource TextColorPrimary}"
|
||||
VerticalTextAlignment="Center"
|
||||
FontFamily="PoppinsMedium"/>
|
||||
</HorizontalStackLayout>
|
||||
|
||||
<Border
|
||||
Grid.Column="2"
|
||||
Stroke="Transparent"
|
||||
StrokeShape="RoundRectangle 100"
|
||||
BackgroundColor="{StaticResource Selected}">
|
||||
<ImageButton
|
||||
Source="plus.svg"
|
||||
WidthRequest="40"
|
||||
HeightRequest="40"
|
||||
Clicked="OnPlus"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ContentView>
|
@ -0,0 +1,51 @@
|
||||
namespace ShoopNCook.Views;
|
||||
|
||||
public partial class CounterView : ContentView
|
||||
{
|
||||
|
||||
private readonly BindableProperty CountProperty =
|
||||
BindableProperty.Create(nameof(CountLabel), typeof(uint), typeof(CounterView), default(uint) + 1);
|
||||
|
||||
private readonly BindableProperty CounterLabelProperty =
|
||||
BindableProperty.Create(nameof(CounterLabel), typeof(string), typeof(CounterView), default(string));
|
||||
|
||||
public CounterView()
|
||||
{
|
||||
InitializeComponent();
|
||||
CountLabel.BindingContext = this;
|
||||
CountLabel.SetBinding(Label.TextProperty, nameof(Count));
|
||||
|
||||
CounterLabel.BindingContext = this;
|
||||
CounterLabel.SetBinding(Label.TextProperty, nameof(CounterText));
|
||||
}
|
||||
|
||||
public uint Count
|
||||
{
|
||||
get => (uint)GetValue(CountProperty);
|
||||
set
|
||||
{
|
||||
SetValue(CountProperty, value <= 1 ? 1 : uint.Parse(value.ToString()));
|
||||
OnPropertyChanged(nameof(Count));
|
||||
}
|
||||
}
|
||||
|
||||
public string CounterText
|
||||
{
|
||||
get => (string)GetValue(CounterLabelProperty);
|
||||
set
|
||||
{
|
||||
SetValue(CounterLabelProperty, value);
|
||||
OnPropertyChanged(nameof(CounterText));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPlus(object o, EventArgs e)
|
||||
{
|
||||
Count += 1;
|
||||
}
|
||||
|
||||
private void OnMinus(object o, EventArgs e)
|
||||
{
|
||||
Count -= 1;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="ShoopNCook.Views.StoredRecipeView">
|
||||
|
||||
<Border
|
||||
Style="{StaticResource SecondaryBorderShadow}"
|
||||
StrokeShape="RoundRectangle 30">
|
||||
|
||||
<Grid
|
||||
BackgroundColor="{StaticResource BackgroundSecondary}"
|
||||
Padding="10"
|
||||
MinimumHeightRequest="175"
|
||||
MinimumWidthRequest="150"
|
||||
RowDefinitions="*, Auto">
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Stroke="Transparent"
|
||||
StrokeShape="RoundRectangle 20"
|
||||
BackgroundColor="AliceBlue">
|
||||
<Grid>
|
||||
<Image />
|
||||
<HorizontalStackLayout
|
||||
x:Name="Stars"
|
||||
VerticalOptions="End"
|
||||
HorizontalOptions="End"
|
||||
Margin="0, 0, 15, 2">
|
||||
<Image
|
||||
WidthRequest="10"
|
||||
Source="star_full.svg"/>
|
||||
<Image
|
||||
WidthRequest="10"
|
||||
Source="star_full.svg"/>
|
||||
<Image
|
||||
WidthRequest="10"
|
||||
Source="star_full.svg"/>
|
||||
<Image
|
||||
WidthRequest="10"
|
||||
Source="star_full.svg"/>
|
||||
<Image
|
||||
WidthRequest="10"
|
||||
Source="star_full.svg"/>
|
||||
</HorizontalStackLayout>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<VerticalStackLayout Grid.Row="1">
|
||||
<Label
|
||||
TextColor="{StaticResource TextColorPrimary}"
|
||||
x:Name="TitleLabel"/>
|
||||
<Label
|
||||
TextColor="{StaticResource TextColorSecondary}"
|
||||
x:Name="SubtitleLabel"/>
|
||||
</VerticalStackLayout>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ContentView>
|
@ -0,0 +1,46 @@
|
||||
namespace ShoopNCook.Views;
|
||||
|
||||
public partial class StoredRecipeView : ContentView
|
||||
{
|
||||
|
||||
public StoredRecipeView() : this(5, "Title", "Subtitle")
|
||||
{ }
|
||||
|
||||
public StoredRecipeView(float note, string title, string subtitle)
|
||||
{
|
||||
InitializeComponent();
|
||||
Note = note;
|
||||
Title = title;
|
||||
Subtitle = subtitle;
|
||||
}
|
||||
|
||||
public float Note
|
||||
{
|
||||
set => SetNote(value);
|
||||
}
|
||||
|
||||
public string Title
|
||||
{
|
||||
set => TitleLabel.Text = value;
|
||||
}
|
||||
|
||||
public string Subtitle
|
||||
{
|
||||
set => SubtitleLabel.Text = value;
|
||||
}
|
||||
|
||||
|
||||
private void SetNote(float note)
|
||||
{
|
||||
int i = 1;
|
||||
foreach (Image img in Stars.Children)
|
||||
{
|
||||
if (i <= note)
|
||||
{
|
||||
img.Opacity = 0;
|
||||
i++;
|
||||
}
|
||||
else img.Opacity = 1;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue