Skip to content

FloatingButtonBuilder

appleneko2001 edited this page Dec 21, 2021 · 1 revision

Summary

This class used for create FloatingButton instance with some setters.

Methods:
public FloatingButtonBuilder SetSpacing(double spacing = 12.0)
// Set spacing between icon and text views.

// Examples:
// Create builder instance and set spacing to 8.
var builder = new FloatingButtonBuilder().SetSpacing(8);
public FloatingButtonBuilder SetIcon(Control view)
// Attach a view to builder and set it as icon for further use.

// Examples:
// Create builder instance and attach a "Add" icon with Material.Icon to it.
var builder = new FloatingButtonBuilder().SetIcon(new MaterialIcon
{
    Kind = MaterialIconKind.Plus
});
public FloatingButtonBuilder SetText(string text)  
// Create text view and attach it to floating action button later.

// This method have some overloads to allows you attach your own text control / styles or custom view. Please look below to know which overloads included:
public FloatingButtonBuilder SetText(TextBlock textBlock)  // attach a textblock view with custom properties and styles.
public FloatingButtonBuilder SetText(Control view)  // attach a custom view to floating button.

// Examples:
// Create builder instance, attach a "Add" icon and create a TextBlock "CREATE SOMETHING" to it. 
var builder = new FloatingButtonBuilder().SetIcon(new MaterialIcon
{
    Kind = MaterialIconKind.Plus
}).SetText("CREATE SOMETHING");
public FloatingButton Build()
// Build and return FloatingButton instance with current settings.
// This method should use after all setter methods to apply changes.

// Examples:
// Create FloatingButton instance with "Add" icon and text "CREATE SOMETHING"
var button = new FloatingButtonBuilder().SetIcon(new MaterialIcon
{
    Kind = MaterialIconKind.Plus
}).SetText("CREATE SOMETHING").Build();
Styling

For more information about styling, please take look this entry

Material.Avalonia Wiki pages is still WIP (work in progress), Pages could not ready for show if they unclickable.

Main section

Widgets / Controls

Theming

Builders

Assist for widgets

Clone this wiki locally