fix basic bindings
continuous-integration/drone/push Build is passing Details

master
Maxime BATISTA 2 years ago
parent 00056c4aa2
commit 7777304ef3

@ -25,7 +25,9 @@
HeightRequest="65"/> HeightRequest="65"/>
</Border> </Border>
<Label Style="{StaticResource h1}" x:Name="ProfilePictureName"/> <Label
Style="{StaticResource h1}"
Text="{Binding User.Name}"/>
</FlexLayout> </FlexLayout>
<Grid <Grid
ColumnDefinitions="*,Auto" ColumnDefinitions="*,Auto"
@ -89,8 +91,7 @@
JustifyContent="SpaceBetween" JustifyContent="SpaceBetween"
AlignItems="Center" AlignItems="Center"
Margin="20,0,20,20" Margin="20,0,20,20"
HeightRequest="30" HeightRequest="30">
>
<Label <Label
Text="Recommended for you" Text="Recommended for you"
Style="{StaticResource h2}"/> Style="{StaticResource h2}"/>

@ -7,15 +7,16 @@ using LocalEndpoint;
public partial class HomePage : ContentPage public partial class HomePage : ContentPage
{ {
public HomePage(Account account, IUserNotifier notifier, IEndpoint endpoint) public HomePage(Account account, IUserNotifier notifier, IEndpoint endpoint)
{ {
InitializeComponent();
InitializeComponent();
BindingContext = account;
IRecipesService service = endpoint.RecipesService; IRecipesService service = endpoint.RecipesService;
IAccountRecipesPreferences preferences = service.GetPreferencesOf(account); IAccountRecipesPreferences preferences = service.GetPreferencesOf(account);
//TODO this code can be factorised
void PushRecipe(Layout layout, RecipeInfo info) void PushRecipe(Layout layout, RecipeInfo info)
{ {
layout.Children.Add(new RecipeView(info, () => layout.Children.Add(new RecipeView(info, () =>
@ -29,7 +30,6 @@ public partial class HomePage : ContentPage
preferences.GetRecommendedRecipes().ForEach(recipe => PushRecipe(RecommendedList, recipe)); preferences.GetRecommendedRecipes().ForEach(recipe => PushRecipe(RecommendedList, recipe));
ProfilePictureImage.Source = ImageSource.FromUri(account.User.ProfilePicture); ProfilePictureImage.Source = ImageSource.FromUri(account.User.ProfilePicture);
ProfilePictureName.Text = account.User.Name;
} }

@ -20,6 +20,7 @@
<Label <Label
x:Name="ProfileName" x:Name="ProfileName"
Text="{Binding Account.User.Name}"
Grid.Column="1" Grid.Column="1"
FontSize="24" FontSize="24"
VerticalTextAlignment="Center" VerticalTextAlignment="Center"

@ -7,12 +7,14 @@ public partial class MorePage : ContentPage
{ {
private readonly MorePageController controller; private readonly MorePageController controller;
private Account Account { get; init; }
public MorePage(Account account, MorePageController controller) public MorePage(Account account, MorePageController controller)
{ {
Account = account;
BindingContext = this;
InitializeComponent(); InitializeComponent();
ProfileImage.Source = ImageSource.FromUri(account.User.ProfilePicture); ProfileImage.Source = ImageSource.FromUri(account.User.ProfilePicture);
ProfileName.Text = account.User.Name;
this.controller = controller; this.controller = controller;
} }

@ -50,9 +50,7 @@
HorizontalOptions="Center" HorizontalOptions="Center"
Stroke="{StaticResource BackgroundPrimary}" Stroke="{StaticResource BackgroundPrimary}"
BackgroundColor="{StaticResource BackgroundSecondary}"> BackgroundColor="{StaticResource BackgroundSecondary}">
<ImageButton <ImageButton x:Name="ProfilePicture"/>
Grid.Row="0"
Source="default_profile_picture.png"/>
</Border> </Border>
<Label <Label
@ -60,7 +58,7 @@
FontSize="30" FontSize="30"
HorizontalOptions="Center" HorizontalOptions="Center"
TextColor="{StaticResource TextColorPrimary}" TextColor="{StaticResource TextColorPrimary}"
Text="%Profile_Name%" Text="{Binding Account.User.Name}"
FontFamily="PoppinsBold"/> FontFamily="PoppinsBold"/>
<Label <Label
Grid.Row="2" Grid.Row="2"
@ -88,7 +86,7 @@
Style="{StaticResource SecondaryBorderShadow}"> Style="{StaticResource SecondaryBorderShadow}">
<Entry <Entry
Style="{StaticResource UserInput}" Style="{StaticResource UserInput}"
Text="%Profile_Name%" Text="{Binding User.Name}"
Placeholder="Place your name here"/> Placeholder="Place your name here"/>
</Border> </Border>
@ -103,7 +101,7 @@
Style="{StaticResource SecondaryBorderShadow}"> Style="{StaticResource SecondaryBorderShadow}">
<Entry <Entry
Style="{StaticResource UserInput}" Style="{StaticResource UserInput}"
Text="%Profile_Mail%" Text="{Binding Email}"
Placeholder="Place your email address here"/> Placeholder="Place your email address here"/>
</Border> </Border>
<Border <Border
@ -118,9 +116,6 @@
Text="Change My Password" Text="Change My Password"
Clicked="ChangeMyPasswordClicked"/> Clicked="ChangeMyPasswordClicked"/>
</Border> </Border>
</Grid> </Grid>

@ -4,9 +4,14 @@ namespace ShoopNCook.Pages;
public partial class ProfilePage : ContentPage public partial class ProfilePage : ContentPage
{ {
public ProfilePage(Account account) public ProfilePage(Account account)
{ {
BindingContext = account;
InitializeComponent(); InitializeComponent();
ProfilePicture.Source = ImageSource.FromUri(account.User.ProfilePicture);
} }
private async void OnBackButtonClicked(object sender, EventArgs e) private async void OnBackButtonClicked(object sender, EventArgs e)
{ {

@ -63,8 +63,8 @@
<Label <Label
Style="{StaticResource Small}" Style="{StaticResource Small}"
Text="{Binding Recipe.Info.CookTimeMins, StringFormat='Cooking time: {0} mins'}"/> Text="{Binding Recipe.Info.CookTimeMins, StringFormat='Cooking time: {0} mins'}"/>
<!--Energy-->
<!--Energy-->
<Label <Label
Style="{StaticResource Small}" Style="{StaticResource Small}"
Text="{Binding Recipe.Info.CalPerPers, StringFormat='Energy: {0}/pers'}"/> Text="{Binding Recipe.Info.CalPerPers, StringFormat='Energy: {0}/pers'}"/>

Loading…
Cancel
Save