Food Delivery App - Basic Setup

App.xaml

 <Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:FoodDeliveryApp"
             x:Class="FoodDeliveryApp.App">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/Styles/Colors.xaml" />
                <ResourceDictionary Source="Resources/Styles/Styles.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <Color x:Key="BackgroundColor">#F1EFEF</Color>
            <Color x:Key="Primary">#004AAD</Color>
            <Color x:Key="Secondary">#FF914D</Color>
            <Color x:Key="OldLace">#FDF7E4</Color>
            <Color x:Key="Black">#000000</Color>
            <Color x:Key="Gray">#383838</Color>
            <Color x:Key="LightGray">#DEDEDE</Color>
        </ResourceDictionary>
    </Application.Resources>
</Application>  

Please, support my blog by clicking on our sponsors ad!

App.xaml.cs

 MainPage = new AppShell();

FontAwesome

For fontawesome refer this link
Copy Solid Class and rename class name as "FontAwesomeSolid" keep in "Utilities" Folder

AppShell.Xaml

 <Shell
    x:Class="FoodDeliveryApp.AppShell"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:FoodDeliveryApp.Pages.Authentication"
    Shell.FlyoutBehavior="Disabled">

    <ShellContent
        Title="Home"
        ContentTemplate="{DataTemplate local:Login}"
        Route="MainPage" />

</Shell>  

AppShell.xaml.cs

public partial class AppShell : Shell
{
	public AppShell()
	{
		InitializeComponent();
		Routing.RegisterRoute("Login", typeof(Login));
		Routing.RegisterRoute("Register", typeof(Register));
		Routing.RegisterRoute("Home", typeof(Home));
		Routing.RegisterRoute("FilterPage", typeof(FilterPage));
		Routing.RegisterRoute("ProductList", typeof(List));
	}
}
  

MAUIProgram.cs

public static class MauiProgram
{
	public static MauiApp CreateMauiApp()
	{
		var builder = MauiApp.CreateBuilder();
		builder
			.UseMauiApp<App>()
            .UseMauiCommunityToolkit()
            .ConfigureFonts(fonts =>
			{
				fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
				fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
				fonts.AddFont("FontAwesome5FreeSolid900.otf", "FontAwesome");
			});

#if DEBUG
		builder.Logging.AddDebug();
#endif

		return builder.Build();
	}
}

Comments

Post a Comment

Popular posts from this blog

Push Notifications in .NET MAUI: A Comprehensive Guide

Explore the UI libraries available for .NET MAUI at no cost.

Push Notification using Firebase in xamarin form (Android and IOS)