|
|
|
@ -7,10 +7,6 @@ public partial class DetailBook : ContentPage
|
|
|
|
|
private int maxStars = 5;
|
|
|
|
|
private int currentRating = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DetailBook()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
@ -19,17 +15,16 @@ public partial class DetailBook : ContentPage
|
|
|
|
|
{
|
|
|
|
|
var star = new Image
|
|
|
|
|
{
|
|
|
|
|
Source = "empty_star.svg", // image d'une étoile vide
|
|
|
|
|
Source = "empty_star.svg", // image d'une étoile vide
|
|
|
|
|
WidthRequest = 30,
|
|
|
|
|
HeightRequest = 30
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int currentStar = i;
|
|
|
|
|
|
|
|
|
|
star.GestureRecognizers.Add(new TapGestureRecognizer
|
|
|
|
|
{
|
|
|
|
|
Command = new Command(() => StarTapped(currentStar)),
|
|
|
|
|
});
|
|
|
|
|
star.GestureRecognizers.Add(
|
|
|
|
|
new TapGestureRecognizer { Command = new Command(() => StarTapped(currentStar)), }
|
|
|
|
|
);
|
|
|
|
|
StarLayout.Children.Add(star);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -38,7 +33,6 @@ public partial class DetailBook : ContentPage
|
|
|
|
|
BindingContext = this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void StarTapped(int rating)
|
|
|
|
|
{
|
|
|
|
|
if (rating > maxStars)
|
|
|
|
@ -58,10 +52,9 @@ public partial class DetailBook : ContentPage
|
|
|
|
|
{
|
|
|
|
|
var star = (Image)StarLayout.Children[i];
|
|
|
|
|
if (i < currentRating)
|
|
|
|
|
star.Source = "filled_star.svg"; // image d'une étoile remplie
|
|
|
|
|
star.Source = "filled_star.svg"; // image d'une étoile remplie
|
|
|
|
|
else
|
|
|
|
|
star.Source = "empty_star.svg";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|