add splash login and register to navigation

pull/39/head
Leo TUAILLON 2 years ago
parent f981b89308
commit a4065a377a

@ -3,20 +3,21 @@ using ShoopNCook.Pages;
using ShoopNCook.Models;
using ShoopNCook.Models.API;
public partial class App : Application
{
public App()
{
InitializeComponent();
Account account = getUserAccount();
MainPage = new AppShell();
}
public partial class App : Application
{
public App()
{
InitializeComponent();
Account account = getUserAccount();
var appShell = new AppShell();
MainPage = appShell;
appShell.GoToAsync("//Splash");
}
private Account getUserAccount()
{
return new Account(new User(new Uri("https://www.pngkey.com/png/full/115-1150152_default-profile-picture-avatar-png-green.png"), "Stub Account"), "test@example.com");
}
}
}
}

@ -11,13 +11,25 @@
Shell.TabBarTitleColor="{StaticResource Selected}"
Shell.TabBarUnselectedColor="{StaticResource TextColorSecondary}">
<ShellContent
x:Name="Splash"
Title="More"
ContentTemplate="{DataTemplate pages:Splash}"
Route="Splash"/>
<ShellContent
x:Name="LoginPage"
Title="Login"
ContentTemplate="{DataTemplate pages:LoginPage}"
Route="LoginPage"/>
<ShellContent
x:Name="RegisterPage"
Title="Register"
ContentTemplate="{DataTemplate pages:RegisterPage}"
Route="RegisterPage"/>
<TabBar>
<ShellContent
x:Name="Splash"
Title="More"
ContentTemplate="{DataTemplate pages:Splash}"
Route="Splash"
IsVisible="False"/>
<ShellContent
x:Name="HomeTab"
@ -72,11 +84,11 @@
ContentTemplate="{DataTemplate pages:ProfilePage}"
Route="EditProfile"/>
</FlyoutItem>
<FlyoutItem Title="LoginPage">
<FlyoutItem>
<ShellContent
Title="LoginPage"
ContentTemplate="{DataTemplate pages:LoginPage}"
Route="LoginPage"/>
x:Name="ForgotPassword"
Title="Login"
ContentTemplate="{DataTemplate pages:ForgotPassword}"
Route="ForgotPassword"/>
</FlyoutItem>
</Shell>

@ -21,7 +21,8 @@
HeightRequest="50"
WidthRequest="50"
Source="arrow_back.svg"/>
Source="arrow_back.svg"
Clicked="OnBackButtonClicked"/>
</HorizontalStackLayout>
<Label
Margin="-40,10,0,0"

@ -6,4 +6,8 @@ public partial class ForgotPassword : ContentPage
{
InitializeComponent();
}
private async void OnBackButtonClicked(object sender, EventArgs e)
{
await Navigation.PopAsync();
}
}

@ -70,7 +70,11 @@
TextColor="{StaticResource TextColorSecondary}"
HorizontalOptions="End"
Text="Forgot Password ?"
BackgroundColor="Transparent"/>
BackgroundColor="Transparent">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="ForgotPasswordTapped" />
</Label.GestureRecognizers>
</Label>
<Border
Margin="0, 30, 0, 0"
@ -137,8 +141,12 @@
New User?</Label>
<Label
FontAttributes="Bold"
TextColor="{StaticResource TextColorPrimary}">
Create Account</Label>
TextColor="{StaticResource TextColorPrimary}"
Text="Create Account">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="RegisterLabbelTapped" />
</Label.GestureRecognizers>
</Label>
</HorizontalStackLayout>
</VerticalStackLayout>

@ -8,17 +8,20 @@ public partial class LoginPage : ContentPage
}
private async void OnLoginButtonClicked(object sender, EventArgs e)
{
await Navigation.PushAsync(new HomePage());
// Vérification des informations de connexion ici
/* bool loginSuccessful = true; // Remplacez cette ligne par votre propre logique de vérification
// Vérifiez les informations d'identification de l'utilisateur ici
bool isValidUser = true;
if (loginSuccessful)
{
await Navigation.PushAsync(new HomePage());
// Supprimez les pages Splash et Login de la pile de navigation pour éviter qu'elles ne soient accessibles en revenant en arrière
Navigation.RemovePage(Navigation.NavigationStack[0]); // Supprime la page Splash
Navigation.RemovePage(Navigation.NavigationStack[0]); // Supprime la page Login
}*/
if (isValidUser)
{
await Shell.Current.GoToAsync("//HomePage");
}
}
private async void ForgotPasswordTapped(object sender, EventArgs e)
{
await Shell.Current.Navigation.PushAsync(new ForgotPassword());
}
private async void RegisterLabbelTapped(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("//RegisterPage");
}
}

@ -84,11 +84,6 @@
</Grid>
</Border>
<Label
TextColor="{StaticResource TextColorSecondary}"
HorizontalOptions="End">
Forgot Password ?
</Label>
<Border
@ -99,7 +94,8 @@
BackgroundColor="{StaticResource ActionButton}"
FontFamily="PoppinsMedium"
TextColor="White"
Text="SIGN UP"/>
Text="SIGN UP"
Clicked="RegisterTapped"/>
</Border>
<HorizontalStackLayout
@ -155,8 +151,12 @@
Already have an account ?</Label>
<Label
FontAttributes="Bold"
TextColor="{StaticResource TextColorPrimary}">
Log In</Label>
TextColor="{StaticResource TextColorPrimary}"
Text="Log In">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="LoginTapped" />
</Label.GestureRecognizers>
</Label>
</HorizontalStackLayout>
</VerticalStackLayout>

@ -6,4 +6,12 @@ public partial class RegisterPage : ContentPage
{
InitializeComponent();
}
private async void LoginTapped(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("//LoginPage");
}
private async void RegisterTapped(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("//LoginPage");
}
}

@ -33,6 +33,6 @@
TextColor="{StaticResource ButtonText}"
Text="Let's Get Started ➝"
Margin="25"
Clicked="OnSyncButtonClicked"/>
Clicked="OnGetStartedButtonClicked"/>
</Grid>
</ContentPage>

@ -8,8 +8,9 @@ public partial class Splash : ContentPage
NavigationPage.SetHasNavigationBar(this, false);
}
private async void OnSyncButtonClicked(object sender, EventArgs e)
private async void OnGetStartedButtonClicked(object sender, EventArgs e)
{
await Navigation.PushAsync(new LoginPage());
await Shell.Current.GoToAsync("//LoginPage");
}
}

@ -1,12 +0,0 @@
<?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.Pages.SplashScreen"
Title="SplashScreen">
<VerticalStackLayout>
<Label
Text="Welcome to .NET MAUI!"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentPage>

@ -1,9 +0,0 @@
namespace ShoopNCook.Pages;
public partial class SplashScreen : ContentPage
{
public SplashScreen()
{
InitializeComponent();
}
}
Loading…
Cancel
Save