/MauiBottomSheet

A library to display native bottom sheets

Primary LanguageC#

Clipboard logo


CI/CD-MauiBottomSheet forthebadge forthebadge forthebadge

Presentation

ios.mp4

Installation 💿

You can install the latest version of the package with this command

dotnet add package Simple.BottomSheet

You can also install it manualy in your IDE with the nuget package manager by searching Simple.BottomSheet.

Configuration ⚙️

Add UseBottomSheet() in your MAUI builder :

public static MauiApp CreateMauiApp()
{
    var builder = MauiApp.CreateBuilder();
    builder
      .UseMauiApp<App>()
      .UseBottomSheet(); // Add UseBottomSheet
    return builder.Build();
}

Utilisation 🚀

To use a bottom sheet you must proceed as follows:

  1. Create your page (Your page must inherit IBottomSheetRef) :
public partial class PurshaseBottomSheet : ContentView, IBottomSheetRef
{
  public BottomSheet BottomSheetRef { get; set; }

  public PurshaseBottomSheet()
  {
      InitializeComponent();
  }

  public void OnAppearing(object parameters){ }
}
  1. Register your page (and viewmodel if you use one) in your IOC container :
mauiAppBuilder.Services.AddTransient<PurshaseBottomSheet>(); // Pages must be registered as transient
  1. Inject IBottomSheetService into your page or viewmodel :
public MainPage(IBottomSheetService bottomSheetService)
{
    InitializeComponent();
    _bottomSheetService = bottomSheetService;
}
  1. Use it !
void Button_Clicked(System.Object sender, System.EventArgs e)
{
    var bottomSheet = _bottomSheetService.ShowBottomSheet<PurshaseBottomSheet>();
}

Other 🎈

Feel free to contribute to this project by proposing features and pull requests !