Kis kerek gombok + Egyéb nyalánkságok

This commit is contained in:
2025-04-21 19:16:58 +02:00
parent dbc2f30a27
commit cba9181a2d
18 changed files with 118 additions and 24 deletions
+33 -1
View File
@@ -1,4 +1,6 @@
using Android.Util;
using CommunityToolkit.Maui.Alerts;
using CommunityToolkit.Maui.Core;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
@@ -28,7 +30,7 @@ namespace WorkFlowCheck.MAUI.Helper
{
using (var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri(ApiBaseUrl);
httpClient.DefaultRequestHeaders.Add("X-Api-Key", ApiKey);
@@ -51,5 +53,35 @@ namespace WorkFlowCheck.MAUI.Helper
}
}
}
public async static Task ShowSnackBar(string message,
string actionButtonTextColor = "#FF0000",
string backgroundColor = "#FF0000",
string textColor = "#FF0000",
int duration = 10,
string actionButtonText = "Ok",
Func<Task> action = null)
{
var visualOptions = new SnackbarOptions
{
ActionButtonTextColor = Colors.Yellow,
CornerRadius = new CornerRadius(10),
Font = Microsoft.Maui.Font.SystemFontOfSize(16),
BackgroundColor = Colors.Red,
TextColor = Colors.Yellow
};
var snackbar = Snackbar.Make(
message,
duration: TimeSpan.FromSeconds(duration),
action: async () =>
{
if (action != null)
await action();
},
actionButtonText: actionButtonText,
visualOptions: visualOptions
);
await snackbar.Show();
}
}
}