mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-19 15:02:15 +01:00
wider migration from old starter
This commit is contained in:
40
StarterNG/Infrastructure/StatsBar.cs
Normal file
40
StarterNG/Infrastructure/StatsBar.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.Collections.Generic;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace StarterNG.Infrastructure;
|
||||
|
||||
public static class StatsBar
|
||||
{
|
||||
public static void Fill(Panel host, IReadOnlyList<(string Label, string Value)> fields)
|
||||
{
|
||||
host.Children.Clear();
|
||||
foreach (var (label, value) in fields)
|
||||
{
|
||||
var pair = new StackPanel
|
||||
{
|
||||
Orientation = Orientation.Horizontal,
|
||||
Spacing = 5,
|
||||
Margin = new Avalonia.Thickness(0, 0, 22, 0),
|
||||
VerticalAlignment = VerticalAlignment.Center
|
||||
};
|
||||
pair.Children.Add(new TextBlock
|
||||
{
|
||||
Text = label,
|
||||
FontSize = 12,
|
||||
Opacity = 0.65,
|
||||
VerticalAlignment = VerticalAlignment.Center
|
||||
});
|
||||
pair.Children.Add(new TextBlock
|
||||
{
|
||||
Text = value,
|
||||
FontSize = 12,
|
||||
FontWeight = FontWeight.SemiBold,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
TextTrimming = TextTrimming.CharacterEllipsis
|
||||
});
|
||||
host.Children.Add(pair);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user