merge with master

pull/28/head
maxime.BATISTA@etu.uca.fr 2 years ago
commit 514b9395e2

@ -38,5 +38,10 @@
Title="Recipe Page"
ContentTemplate="{DataTemplate pages:RecipePage}"
Route="Recipe" />
<ShellContent
Title="Favorites Page"
ContentTemplate="{DataTemplate pages:FavoritesPage}"
Route="Favorites" />
</TabBar>
</Shell>

@ -0,0 +1,54 @@
<?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.FavoritesPage"
Title="FavoritesPage"
xmlns:views="clr-namespace:ShoopNCook.Views"
BackgroundColor="{StaticResource BackgroundPrimary}">
<Grid
RowDefinitions="Auto, *">
<!-- Header label and return button -->
<Grid
Grid.Row="0"
ColumnDefinitions="Auto, *"
Padding="10, 20, 0, 30">
<ImageButton
Grid.Column="0"
HeightRequest="50"
WidthRequest="50"
Source="arrow_back.svg"/>
<Label
Grid.Column="1"
FontSize="24"
TextColor="{StaticResource TextColorPrimary}"
Text="Favorites recipes"
FontFamily="PoppinsBold"
HorizontalOptions="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 FavoritesPage : ContentPage
{
public FavoritesPage()
{
InitializeComponent();
}
}

@ -107,26 +107,26 @@
x:Name="Stars"
Spacing="2"
Margin="10, 0, 0, 0">
<ImageButton
WidthRequest="30"
Command="{Binding StarCommand, Source={x:Reference RecipeViewPage}}"
CommandParameter="1"/>
<ImageButton
WidthRequest="30"
Command="{Binding StarCommand, Source={x:Reference RecipeViewPage}}"
CommandParameter="2"/>
<ImageButton
WidthRequest="30"
Command="{Binding StarCommand, Source={x:Reference RecipeViewPage}}"
CommandParameter="3"/>
<ImageButton
WidthRequest="30"
Command="{Binding StarCommand, Source={x:Reference RecipeViewPage}}"
CommandParameter="4"/>
<ImageButton
WidthRequest="30"
Command="{Binding StarCommand, Source={x:Reference RecipeViewPage}}"
CommandParameter="5"/>
<ImageButton
WidthRequest="30"
Command="{Binding StarCommand, Source={x:Reference RecipeViewPage}}"
CommandParameter="1"/>
<ImageButton
WidthRequest="30"
Command="{Binding StarCommand, Source={x:Reference RecipeViewPage}}"
CommandParameter="2"/>
<ImageButton
WidthRequest="30"
Command="{Binding StarCommand, Source={x:Reference RecipeViewPage}}"
CommandParameter="3"/>
<ImageButton
WidthRequest="30"
Command="{Binding StarCommand, Source={x:Reference RecipeViewPage}}"
CommandParameter="4"/>
<ImageButton
WidthRequest="30"
Command="{Binding StarCommand, Source={x:Reference RecipeViewPage}}"
CommandParameter="5"/>
</HorizontalStackLayout>
<Border
Margin="12, 0, 0, 0"

@ -59,8 +59,9 @@
<None Remove="Resources\Images\logout_arrow.svg" />
<None Remove="Resources\Images\minus.svg" />
<None Remove="Resources\Images\moon_white.svg" />
<None Remove="Resources\Images\email_icon.svg" />
<None Remove="Resources\Images\facebook_logo.svg" />
<None Remove="Resources\Images\password_icon.svg" />
<None Remove="Resources\Images\plus.svg" />
<None Remove="Resources\Images\search_options.svg" />
<None Remove="Resources\Images\share.svg" />
<None Remove="Resources\Images\star_empty.svg" />
@ -89,6 +90,9 @@
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\IngredientView.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Pages\FavoritesPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Pages\MorePage.xaml">
@ -107,6 +111,12 @@
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Pages\SearchPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\RecipeView.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\SearchPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>

@ -19,16 +19,39 @@
Stroke="Transparent"
StrokeShape="RoundRectangle 20"
BackgroundColor="AliceBlue">
<Image/>
<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}"
Text="Recipe Name"/>
x:Name="TitleLabel"/>
<Label
TextColor="{StaticResource TextColorSecondary}"
Text="Preparation time"/>
x:Name="SubtitleLabel"/>
</VerticalStackLayout>
</Grid>
</Border>

@ -2,8 +2,46 @@ namespace ShoopNCook.Views;
public partial class RecipeView : ContentView
{
public RecipeView()
public RecipeView(): this(5, "Title", "Subtitle")
{}
public RecipeView(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…
Cancel
Save