using System; using System.Collections.ObjectModel; using Avalonia; using Avalonia.Animation; using Avalonia.Controls; using Avalonia.Controls.Presenters; using Avalonia.Controls.Primitives; using Avalonia.Data; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Layout; using Avalonia.Media; using Avalonia.Styling; using AvaCarouselPage = Avalonia.Controls.CarouselPage; namespace ControlCatalog.Pages; public partial class CareCompanionAppPage : UserControl { static readonly Color Primary = Color.Parse("#137fec"); static readonly Color PrimaryDark = Color.Parse("#0a5bb5"); static readonly Color PrimaryLight = Color.Parse("#e0f0ff"); static readonly Color BgLight = Color.Parse("#f6f7f8"); static readonly Color TextDark = Color.Parse("#111827"); static readonly Color TextMuted = Color.Parse("#64748b"); static readonly Color CardBg = Colors.White; static readonly Color SuccessGreen = Color.Parse("#10b981"); static readonly Color WarningAmber = Color.Parse("#f59e0b"); NavigationPage? _navPage; AvaCarouselPage? _onboarding; ScrollViewer? _infoPanel; public CareCompanionAppPage() { InitializeComponent(); } protected override void OnLoaded(RoutedEventArgs e) { base.OnLoaded(e); _infoPanel = this.FindControl("InfoPanel"); UpdateInfoVisibility(); _navPage = this.FindControl("NavPage"); if (_navPage == null) return; _onboarding = BuildOnboardingCarousel(); _ = _navPage.PushAsync(_onboarding); } protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) { base.OnPropertyChanged(change); if (change.Property == BoundsProperty) UpdateInfoVisibility(); } void UpdateInfoVisibility() { if (_infoPanel != null) _infoPanel.IsVisible = Bounds.Width >= 650; } static TextBlock Txt(string text, double size, FontWeight weight, Color color, double opacity = 1, TextAlignment align = TextAlignment.Left, TextWrapping wrap = TextWrapping.NoWrap) => new TextBlock { Text = text, FontSize = size, FontWeight = weight, Foreground = new SolidColorBrush(color), Opacity = opacity, TextAlignment = align, TextWrapping = wrap, }; static Button StyledButton(object content, IBrush bg, IBrush fg, double height, CornerRadius radius, Thickness margin = default, double fontSize = 14, FontWeight fontWeight = FontWeight.SemiBold, IBrush? border = null, Thickness borderThick = default) { var btn = new Button { Content = content, Background = bg, Foreground = fg, Height = height, CornerRadius = radius, Margin = margin, Padding = new Thickness(16, 0), HorizontalContentAlignment = HorizontalAlignment.Center, VerticalContentAlignment = VerticalAlignment.Center, BorderBrush = border, BorderThickness = borderThick, }; var over = new Style(x => x.OfType