Update (Front-End): début style

pull/2/head
lodufour1 2 years ago committed by Louis DUFOUR
parent 81b73e3c6d
commit 57798713bf

@ -5,10 +5,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:BookApp" xmlns:local="clr-namespace:BookApp"
Shell.FlyoutBehavior="Disabled"> Shell.FlyoutBehavior="Disabled">
<TabBar> <TabBar>
<Tab Title="My Library" <Tab Title="My Library"
Icon="books_vertical_fill.svg"> Icon="books_vertical_fill.svg">
@ -29,5 +25,4 @@
<ShellContent ContentTemplate="{DataTemplate local:Pages.Filtrage}" /> <ShellContent ContentTemplate="{DataTemplate local:Pages.Filtrage}" />
</Tab> </Tab>
</TabBar> </TabBar>
</Shell> </Shell>

@ -67,8 +67,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CommunityToolkit.Maui" Version="5.3.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="SimpleRatingControl.MAUI" Version="0.0.3" /> <PackageReference Include="SimpleRatingControl.MAUI" Version="0.1.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -20,8 +20,8 @@
</ContentPage.ToolbarItems> </ContentPage.ToolbarItems>
<StackLayout> <StackLayout>
<Label FontSize="35" Padding="10" FontAttributes="Bold" >Mes livres</Label> <Label FontSize="35" Padding="10" FontAttributes="Bold" >Mes livres</Label>
<BoxView HeightRequest="1" BackgroundColor="LightGray" VerticalOptions="End" /> <BoxView HeightRequest="1" BackgroundColor="#F9F9F9" VerticalOptions="End" />
<CollectionView ItemsSource="{Binding MyCollections1}" BackgroundColor="Gray"> <CollectionView ItemsSource="{Binding MyCollections1}" BackgroundColor="#F9F9F9">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid RowDefinitions="Auto" Margin="25,0,0,0"> <Grid RowDefinitions="Auto" Margin="25,0,0,0">
@ -45,20 +45,26 @@
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Grid.Column="2" <Label Grid.Column="2"
Text="{Binding Name}" Text="{Binding Number}"
FontAttributes="Bold" FontAttributes="Bold"
Padding="5" Padding="5"
VerticalOptions="Center" VerticalOptions="Center"
Margin="0,0,30,0"/> Margin="0,0,20,0"/>
<Button Grid.Column="2" <Button Grid.Column="2"
ImageSource="chevron_right.svg" ImageSource="chevron_right.svg"
HeightRequest="35" HeightRequest="35"
WidthRequest="35" WidthRequest="35"
BackgroundColor="#F9F9F9"
Clicked="OnButtonClicked" Clicked="OnButtonClicked"
HorizontalOptions="End"/> HorizontalOptions="End"/>
</Grid> </Grid>
<!-- Si veiw cela vaudra peut-être le coup de faire une content view (équiavalent de user control) --> <BoxView Grid.ColumnSpan="4" HeightRequest="1" BackgroundColor="LightGray" VerticalOptions="End">
<BoxView Grid.ColumnSpan="4" HeightRequest="1" BackgroundColor="LightGray" VerticalOptions="End" /> <BoxView.Triggers>
<DataTrigger TargetType="BoxView" Binding="{Binding IsLastItem}" Value="true">
<Setter Property="IsVisible" Value="False"/>
</DataTrigger>
</BoxView.Triggers>
</BoxView>
</Grid> </Grid>
</DataTemplate> </DataTemplate>
</CollectionView.ItemTemplate> </CollectionView.ItemTemplate>
@ -101,12 +107,10 @@
BackgroundColor="White" BackgroundColor="White"
HorizontalOptions="End"/> HorizontalOptions="End"/>
</Grid> </Grid>
<!-- Si veiw cela vaudra peut-être le coup de faire une content view (équiavalent de user control) -->
</Grid> </Grid>
</DataTemplate> </DataTemplate>
</CollectionView.ItemTemplate> </CollectionView.ItemTemplate>
</CollectionView> </CollectionView>
<BoxView HeightRequest="1" BackgroundColor="LightGray" VerticalOptions="EndAndExpand" /> <BoxView HeightRequest="1" BackgroundColor="LightGray" VerticalOptions="EndAndExpand" />
</StackLayout> </StackLayout>
<!--Pour l'opti on peut préciser le type du bind en aller tout en haut du fichier et faisent x:class ...-->
</ContentPage> </ContentPage>

@ -9,14 +9,18 @@ namespace BookApp
{ {
public string Name { get; set; } public string Name { get; set; }
public string Icone { get; set; } public string Icone { get; set; }
public int Number { get; set; }
public ObjetTemp(string name, string icone) public ObjetTemp(string name, string icone, int number)
{ {
Name = name; Name = name;
Icone = icone; Icone = icone;
Number = number;
} }
} }
public bool IsLastItem { get; set; } //TO DO
public ObservableCollection<ObjetTemp> MyCollections1 { get; set; } public ObservableCollection<ObjetTemp> MyCollections1 { get; set; }
public ObservableCollection<ObjetTemp> MyCollections2 { get; set; } public ObservableCollection<ObjetTemp> MyCollections2 { get; set; }
@ -25,22 +29,23 @@ namespace BookApp
InitializeComponent(); InitializeComponent();
MyCollections1 = new ObservableCollection<ObjetTemp>() MyCollections1 = new ObservableCollection<ObjetTemp>()
{ {
new ObjetTemp("Item1", "./Reources/Images/tray_2_fill.svg"), new ObjetTemp("Item1", "./Reources/Images/tray_2_fill.svg", 250),
new ObjetTemp("Item1", "./Reources/Images/person_badge_clock_fill.svg"), new ObjetTemp("Item1", "./Reources/Images/person_badge_clock_fill.svg", 250),
new ObjetTemp("Item1", "./Reources/Images/arrow_forward.svg"), new ObjetTemp("Item1", "./Reources/Images/arrow_forward.svg", 250),
new ObjetTemp("Item1", "./Reources/Images/eyeglasses.svg"), new ObjetTemp("Item1", "./Reources/Images/eyeglasses.svg", 250),
new ObjetTemp("Item1", "./Reources/Images/heart_fill.svg"), new ObjetTemp("Item1", "./Reources/Images/heart_fill.svg", 250),
new ObjetTemp("Item1", "./Reources/Images/tag_fill.svg"), new ObjetTemp("Item1", "./Reources/Images/tag_fill.svg", 250),
}; };
MyCollections2 = new ObservableCollection<ObjetTemp>() MyCollections2 = new ObservableCollection<ObjetTemp>()
{ {
new ObjetTemp("Item1", "./Reources/Images/person_fill.svg"), new ObjetTemp("Item1", "./Reources/Images/person_fill.svg", 250),
new ObjetTemp("Item1", "./Reources/Images/calendar.svg"), new ObjetTemp("Item1", "./Reources/Images/calendar.svg", 250),
new ObjetTemp("Item1", "./Reources/Images/sparkles.svg"), new ObjetTemp("Item1", "./Reources/Images/sparkles.svg", 250),
}; };
BindingContext = this; BindingContext = this;
} }
// Commande with view model pour le futur
async void OnButtonClicked(object sender, EventArgs args) async void OnButtonClicked(object sender, EventArgs args)
{ {
await Shell.Current.GoToAsync(nameof(Tous)); await Shell.Current.GoToAsync(nameof(Tous));

@ -1,4 +1,5 @@
using Microsoft.Extensions.Logging; using CommunityToolkit.Maui;
using Microsoft.Extensions.Logging;
using SimpleRatingControlMaui; using SimpleRatingControlMaui;
namespace BookApp namespace BookApp
@ -10,6 +11,7 @@ namespace BookApp
var builder = MauiApp.CreateBuilder(); var builder = MauiApp.CreateBuilder();
builder builder
.UseMauiApp<App>() .UseMauiApp<App>()
.UseMauiCommunityToolkit()
.UseSimpleRatingControl() .UseSimpleRatingControl()
.ConfigureFonts(fonts => .ConfigureFonts(fonts =>
{ {

@ -39,6 +39,7 @@
ImageSource="chevron_right.svg" ImageSource="chevron_right.svg"
HeightRequest="35" HeightRequest="35"
WidthRequest="35" WidthRequest="35"
BackgroundColor="White"
HorizontalOptions="End"/> HorizontalOptions="End"/>
</Grid> </Grid>
<BoxView Margin="25,0,0,10" HeightRequest="1" BackgroundColor="LightGray" VerticalOptions="End" /> <BoxView Margin="25,0,0,10" HeightRequest="1" BackgroundColor="LightGray" VerticalOptions="End" />

@ -2,8 +2,9 @@
<ContentPage <ContentPage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BookApp.Pages.Filtrage" xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
Title="Filtrage"> x:Class="BookApp.Pages.Filtrage"
Title="Filtrage">
<Shell.BackButtonBehavior> <Shell.BackButtonBehavior>
<BackButtonBehavior <BackButtonBehavior
IconOverride="chevron_left.svg" IconOverride="chevron_left.svg"
@ -40,7 +41,11 @@
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Image Grid.Column="0" HeightRequest="30" <Image Grid.Column="0" HeightRequest="30"
WidthRequest="30" Source="Book.svg"/> WidthRequest="30" Source="Book.svg">
<Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="Red" />
</Image.Behaviors>
</Image>
<Label Grid.Column="1" Margin="10,0,0,0" VerticalTextAlignment="Center" Text="LALALA"/> <Label Grid.Column="1" Margin="10,0,0,0" VerticalTextAlignment="Center" Text="LALALA"/>
<Label Grid.Column="2" VerticalTextAlignment="Center" Margin="0,0,40,0" HorizontalTextAlignment="End" Text="100"/> <Label Grid.Column="2" VerticalTextAlignment="Center" Margin="0,0,40,0" HorizontalTextAlignment="End" Text="100"/>
<Button Grid.Column="2" <Button Grid.Column="2"

@ -4,13 +4,12 @@ namespace BookApp.Pages;
public partial class Filtrage : ContentPage public partial class Filtrage : ContentPage
{ {
SearchBar searchBar = new SearchBar { Placeholder = "Search items..." }; SearchBar searchBar = new SearchBar { Placeholder = "Search items..." };
public TousViewModel Data = new TousViewModel(); public TousViewModel Data = new TousViewModel();
public Filtrage() public Filtrage()
{ {
InitializeComponent(); InitializeComponent();
BindingContext = Data; BindingContext = Data;
} }
} }

@ -5,11 +5,6 @@
xmlns:usecase="clr-namespace:BookApp.UseCase" xmlns:usecase="clr-namespace:BookApp.UseCase"
xmlns:composants="clr-namespace:BookApp.Composants" xmlns:composants="clr-namespace:BookApp.Composants"
x:Class="BookApp.Tous"> x:Class="BookApp.Tous">
<Shell.BackButtonBehavior>
<BackButtonBehavior
IconOverride="chevron_left.svg"
TextOverride="Tous"/>
</Shell.BackButtonBehavior>
<Shell.TitleView> <Shell.TitleView>
<Label <Label
Text="Tous" Text="Tous"
@ -21,15 +16,6 @@
FontSize="Medium" FontSize="Medium"
HorizontalTextAlignment="Center"/> HorizontalTextAlignment="Center"/>
</Shell.TitleView> </Shell.TitleView>
<ContentPage.ToolbarItems>
<ToolbarItem IconImageSource="plus_icone.svg" Priority="1" Order="Primary" StyleClass="PlusButton"/>
<ToolbarItem IconImageSource="arrow_up_arrow_down.svg" Priority="1" Order="Primary" />
</ContentPage.ToolbarItems>
<ContentPage.Resources>
<ResourceDictionary>
<usecase:RatingToStarImageConverter x:Key="RatingToStarConverter"/>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content> <ContentPage.Content>
<CollectionView ItemsSource="{Binding BookCollection}"> <CollectionView ItemsSource="{Binding BookCollection}">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>

@ -10,6 +10,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CommunityToolkit.Maui" Version="5.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" /> <PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" /> <PackageReference Include="MSTest.TestFramework" Version="3.1.1" />

Loading…
Cancel
Save