add favorite pages

pull/27/head
maxime.BATISTA@etu.uca.fr 2 years ago
parent 9e08a5ee04
commit 9c0cbc874a

@ -28,9 +28,15 @@
Title="Register Page"
ContentTemplate="{DataTemplate views:RegisterPage}"
Route="Register" />
<ShellContent
Title="Recipe Page"
ContentTemplate="{DataTemplate views:RecipePage}"
Route="Recipe" />
<ShellContent
Title="Favorites Page"
ContentTemplate="{DataTemplate views:FavoritesPage}"
Route="Favorites" />
</TabBar>
</Shell>

@ -0,0 +1,104 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<RootNamespace>ShoopNCook</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<!-- Display name -->
<ApplicationTitle>ShoopNCook</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>com.companyname.shoopncook</ApplicationId>
<ApplicationIdGuid>bf17e1fe-a722-42f6-a24d-3327d351c924</ApplicationIdGuid>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<None Remove="Resources\Fonts\Poppins-Bold.ttf" />
<None Remove="Resources\Fonts\Poppins-Medium.ttf" />
<None Remove="Resources\Images\email_icon.svg" />
<None Remove="Resources\Images\facebook_logo.svg" />
<None Remove="Resources\Images\hearth_off.svg" />
<None Remove="Resources\Images\hearth_on.svg" />
<None Remove="Resources\Images\minus.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\star_empty.svg" />
<None Remove="Resources\Images\star_full.svg" />
<None Remove="Resources\Images\user.svg" />
<None Remove="Resources\Images\visibility_off.svg" />
<None Remove="Resources\Images\visibility_on.svg" />
</ItemGroup>
<ItemGroup>
<None Remove="Resources\Fonts\arrow_back_ios_FILL0_wght400_GRAD200_opsz48.svg" />
<None Remove="Resources\Images\default_profile_picture.png" />
</ItemGroup>
<ItemGroup>
<MauiFont Include="Resources\Images\arrow_back.svg" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<MauiXaml Update="Views\IngredientView.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\ProfilePage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\RecipePage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\RecipeView.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\RegisterPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\SearchPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties XamarinHotReloadDebuggerTimeoutExceptionShoopNCookHideInfoBar="True" XamarinHotReloadUnhandledDeviceExceptionShoopNCookHideInfoBar="True" /></VisualStudio></ProjectExtensions>
</Project>

@ -49,18 +49,10 @@
<ItemGroup>
<None Remove="Resources\Fonts\Poppins-Bold.ttf" />
<None Remove="Resources\Fonts\Poppins-Medium.ttf" />
<None Remove="Resources\Images\email_icon.svg" />
<None Remove="Resources\Images\facebook_logo.svg" />
<None Remove="Resources\Images\hearth_off.svg" />
<None Remove="Resources\Images\hearth_on.svg" />
<None Remove="Resources\Images\minus.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\star_empty.svg" />
<None Remove="Resources\Images\star_full.svg" />
<None Remove="Resources\Images\user.svg" />
<None Remove="Resources\Images\visibility_off.svg" />
<None Remove="Resources\Images\visibility_on.svg" />
</ItemGroup>
@ -79,21 +71,15 @@
</ItemGroup>
<ItemGroup>
<MauiXaml Update="Views\IngredientView.xaml">
<MauiXaml Update="Views\FavoritesPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\ProfilePage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\RecipePage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\RecipeView.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\RegisterPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\SearchPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>

@ -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.Views.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"/>
<views:RecipeView Margin="5" Note="3"/>
<views:RecipeView Margin="5" Note="0.2"/>
<views:RecipeView Margin="5" Note="1.6"/>
<views:RecipeView Margin="5" Note="5"/>
<views:RecipeView Margin="5" Note="3.5"/>
<views:RecipeView Margin="5" Note="4.6"/>
<views:RecipeView Margin="5" Note="4"/>
<views:RecipeView Margin="5" Note="3"/>
<views:RecipeView Margin="5" Note="2"/>
</FlexLayout>
</ScrollView>
</Grid>
</ContentPage>

@ -0,0 +1,9 @@
namespace ShoopNCook.Views;
public partial class FavoritesPage : ContentPage
{
public FavoritesPage()
{
InitializeComponent();
}
}

@ -3,13 +3,13 @@ namespace ShoopNCook.Views;
public partial class IngredientView : ContentView
{
public static readonly BindableProperty NameProperty =
private readonly BindableProperty NameProperty =
BindableProperty.Create(nameof(Name), typeof(string), typeof(IngredientView), default(string));
public static readonly BindableProperty QuantityProperty =
private readonly BindableProperty QuantityProperty =
BindableProperty.Create(nameof(Quantity), typeof(float), typeof(IngredientView), default(float));
public static readonly BindableProperty UnitProperty =
private readonly BindableProperty UnitProperty =
BindableProperty.Create(nameof(Unit), typeof(string), typeof(IngredientView), default(string));
public string Name

@ -108,26 +108,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"

@ -19,7 +19,30 @@
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">

@ -2,8 +2,43 @@ namespace ShoopNCook.Views;
public partial class RecipeView : ContentView
{
public RecipeView()
private readonly BindableProperty NoteProperty;
public float Note {
get => (float) GetValue(NoteProperty);
set => SetValue(NoteProperty, value);
}
public RecipeView(): this(5)
{}
public RecipeView(float note)
{
InitializeComponent();
NoteProperty = BindableProperty.Create(
nameof(Note),
typeof(float),
typeof(RecipeView),
0F,
propertyChanged: (_, _, v) => UpdateNotes((float) v)
);
Note = note;
}
private void UpdateNotes(float note)
{
int i = 1;
foreach (Image img in Stars.Children)
{
if (i <= note)
{
img.Opacity = 0;
i++;
}
else img.Opacity = 1;
}
}
}

@ -12,17 +12,15 @@
<!-- Search label and return button -->
<Grid
RowDefinitions="Auto, *"
ColumnDefinitions="*, 1.5*"
Margin="0, 0, 0, 30">
RowDefinitions="Auto, *"
ColumnDefinitions="*, 1.5*"
Margin="0, 0, 0, 30">
<HorizontalStackLayout>
<ImageButton
Grid.Column="0"
HeightRequest="50"
WidthRequest="50"
Source="arrow_back.svg"/>
</HorizontalStackLayout>
<ImageButton
Grid.Column="0"
HeightRequest="50"
WidthRequest="50"
Source="arrow_back.svg"/>
<Label
Grid.Column="1"
FontSize="24"

Loading…
Cancel
Save