MainPage et DetailledPage : refactor + utilisation des ressources et styles

Popup_qui_marche_pas
Anthony RICHARD 2 years ago
parent cb605f46ed
commit 751fc9a079

@ -4,86 +4,84 @@
xmlns:HeaderView="clr-namespace:Stim"
x:Class="Stim.DetailledPage"
Title="Accueil"
Background="black">
Background="{StaticResource Secondary}">
<ScrollView>
<Grid BackgroundColor="#495057">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<VerticalStackLayout BackgroundColor="Black" Grid.Column="0"/>
<VerticalStackLayout BackgroundColor="Black" Grid.Column="2"/>
<VerticalStackLayout BackgroundColor="Black" Grid.Column="0" Grid.Row="1"/>
<VerticalStackLayout BackgroundColor="Black" Grid.Column="2" Grid.Row="1"/>
<VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="0"/>
<VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="2"/>
<VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="0"/>
<VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="2"/>
<Grid HeightRequest="1000" Grid.Column="1" Grid.Row="1" Margin="0">
<Grid Background="{StaticResource Tertiary}" Grid.Column="1" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Image Margin="0, 10, 0, 0" Source="{Binding Cover}"/>
<Grid Grid.Column="2" Padding="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Image Grid.RowSpan="4" Margin="5, 0, 0, 0" Source="{Binding Cover}" Aspect="AspectFit"/>
<Label Grid.Column="1" Text="{Binding Name}" FontSize="30"/>
<Label Grid.Column="2" Text="{Binding Year}" HorizontalOptions="Center"/>
<Button Grid.Column="3" Margin="10" Text="Suivre" HorizontalOptions="Center"
VerticalOptions="Center" Background="transparent" CornerRadius="0" BorderWidth="3" BorderColor="{StaticResource Secondary}"/>
<ScrollView Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="1">
<Label Text="{Binding Description}"/>
</ScrollView>
<Grid Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Label Text="{Binding Name}" TextColor="White" VerticalTextAlignment="Center" FontSize="30"/>
<Label Grid.Column="1" TextColor="White" VerticalTextAlignment="Center" Text="{Binding Year}"/>
<Button Grid.Column="3" TextColor="White" Text="suivre" HorizontalOptions="End"
VerticalOptions="Center" Background="transparent" CornerRadius="0" BorderWidth="3" BorderColor="Black"/>
<Label Grid.Row="1" Grid.ColumnSpan="4" TextColor="White" Text="{Binding Description}"/>
<VerticalStackLayout Grid.Row="2" VerticalOptions="End">
<Label Text="Tags :" TextColor="White"/>
<Label Text=" - Tag 1" TextColor="White"/>
<Label Text=" - Tag 2" TextColor="White"/>
<Label Text=" - Tag 3" TextColor="White"/>
</VerticalStackLayout>
<Label Grid.Row="3" Grid.ColumnSpan="4" VerticalOptions="End" TextDecorations="Underline" TextColor="White" Text="https://idhaklzhdkhazkdhaz.fr&#10;https://ioghzilghieriugo.fr"/>
<HorizontalStackLayout Grid.Row="3" Grid.Column="2" VerticalOptions="End" HorizontalOptions="End" x:Name="starsContainer">
<Label Padding="5" HorizontalTextAlignment="End" FontAttributes="Bold" FontSize="20" TextColor="White" x:Name="avgLabel"/>
</HorizontalStackLayout>
<Label Text="Tags :"/>
<CollectionView Grid.Row="1" ItemsSource="{Binding Tags}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Label Padding="10,0,0,0" Text="{Binding}"/>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
<VerticalStackLayout Padding="10" Grid.Row="1" Grid.ColumnSpan="2">
<Label Grid.Row="1" Grid.RowSpan="2" Text="Avis de la communauté :" TextColor="White" FontSize="25"/>
<Label Grid.Column="1" Grid.Row="3" Text="Link:kijazhdkailzhdkhdkazd.fr"/>
<HorizontalStackLayout Grid.Column="2" Grid.ColumnSpan="2" Grid.Row="3" x:Name="starsContainer" HorizontalOptions="End">
<Label Padding="0,5,0,0" FontSize="25" x:Name="avgLabel"/>
</HorizontalStackLayout>
<VerticalStackLayout Grid.ColumnSpan="4" Grid.Row="4">
<Label Text="Avis de la communauté :" FontSize="30"/>
<CollectionView ItemsSource="{Binding Reviews}">
<CollectionView.ItemTemplate>
<DataTemplate>
<VerticalStackLayout Margin="20,20,0,0">
<HorizontalStackLayout Grid.Column="1" Padding="0,0,0,5" VerticalOptions="Start" HorizontalOptions="Start" BindingContextChanged="AddStars">
<Label Margin="0, 0, 5, 0" FontSize="20" TextColor="White" Text="Avis 1"/>
<VerticalStackLayout>
<HorizontalStackLayout BindingContextChanged="AddStars">
<Label Text="Avis" FontSize="20"/>
</HorizontalStackLayout>
<Label TextColor="White" Text="{Binding Text}"/>
<Label Text="{Binding Text}"/>
</VerticalStackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</Grid>
</Grid>
</ScrollView>
</ContentPage>

@ -23,9 +23,9 @@ public partial class DetailledPage : ContentPage
private void AddStars(HorizontalStackLayout container, float rate)
{
for (int i = 0; i < (int)rate; i++) container.Children.Add(new Image { Source = "etoile_pleine.png", WidthRequest = 25 });
if ((int)rate!=rate) container.Children.Add(new Image { Source = "etoile_mi_pleine.png", WidthRequest = 25 });
while (container.Children.Count != 6) container.Children.Add(new Image { Source = "etoile_vide.png", WidthRequest = 25 });
for (int i = 0; i < (int)rate; i++) container.Children.Add(new Image { Source = "etoile_pleine.png", WidthRequest = 30 });
if ((int)rate != rate) container.Children.Add(new Image { Source = "etoile_mi_pleine.png", WidthRequest = 30 });
while (container.Children.Count != 6) container.Children.Add(new Image { Source = "etoile_vide.png", WidthRequest = 30 });
}
private async void goToMainPage(object sender, EventArgs e)

@ -3,69 +3,64 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Stim.MainPage"
Title="Accueil"
Background="black">
Background="{StaticResource Secondary}">
<ScrollView>
<Grid BackgroundColor="{StaticResource Tertiary}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid BackgroundColor="#495057">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="0"/>
<VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="2"/>
<VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="0" Grid.Row="1"/>
<VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="2" Grid.Row="1"/>
<VerticalStackLayout BackgroundColor="Black" Grid.Column="0"/>
<VerticalStackLayout BackgroundColor="Black" Grid.Column="2"/>
<VerticalStackLayout BackgroundColor="Black" Grid.Column="0" Grid.Row="1"/>
<VerticalStackLayout BackgroundColor="Black" Grid.Column="2" Grid.Row="1"/>
<CollectionView ItemsSource="{Binding Games}" SelectionMode="Single" SelectionChanged="OnClickGameList" ItemsLayout="VerticalGrid, 3" Grid.Column="1">
<CollectionView.ItemTemplate>
<DataTemplate>
<Border MinimumWidthRequest="200" Margin="10, 10, 10, 10">
<Grid HeightRequest="950">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<CollectionView ItemsSource="{Binding Games}" SelectionMode="Single" SelectionChanged="OnClickGameList" ItemsLayout="VerticalGrid, 3" Grid.Column="1">
<CollectionView.ItemTemplate>
<DataTemplate>
<Border MinimumWidthRequest="200" Margin="10, 10, 10, 10">
<Grid HeightRequest="1000">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Image Source="{Binding Cover}" Aspect="AspectFit" Margin="0,0,0,0" WidthRequest="600" HeightRequest="750"/>
<Label FontAttributes="Bold" FontSize="30" Text="{Binding Name}" Grid.Row="1" HorizontalTextAlignment="Center"/>
<Image Source="{Binding Cover}" Aspect="AspectFit" Margin="0,0,0,0" WidthRequest="600" HeightRequest="750"/>
<Label TextColor="White" FontAttributes="Bold" FontSize="30" Margin="5" FontFamily="arial" Text="{Binding Name}" Grid.Row="1" HorizontalTextAlignment="Center"/>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text="Tag :" Grid.Row="0"/>
<CollectionView ItemsSource="{Binding Tags}" SelectionMode="Single" ItemsLayout="{Binding Tags.Count}" Grid.Row="1" Grid.Column="0">
<Label Text="Tags :"/>
<CollectionView ItemsSource="{Binding Tags}" Grid.Row="1" Grid.ColumnSpan="2">
<CollectionView.ItemTemplate>
<DataTemplate>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text="{Binding}"/>
<Label Padding="10,0,0,0" Text="{Binding}"/>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<Label Text="{Binding Year}" Grid.Row="1" Grid.Column="2" HorizontalTextAlignment="End" VerticalTextAlignment="End"/>
</Grid>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text="{Binding Year}" Grid.Column="2" HorizontalTextAlignment="End" VerticalTextAlignment="End"/>
</Grid>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text="{Binding Description}" Grid.Row="3"/>
</Grid>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
</ScrollView>
</ContentPage>

Loading…
Cancel
Save