Flyout fixes
This commit is contained in:
@@ -29,38 +29,34 @@
|
||||
|
||||
<!-- Info Cards -->
|
||||
<Border Style="{StaticResource ThemedCard}">
|
||||
<HorizontalStackLayout>
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Label Text="Platform:" FontAttributes="Bold" WidthRequest="100"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
<Label Text="Linux (X11/Wayland)"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextSecondaryLight}, Dark={StaticResource TextSecondaryDark}}" />
|
||||
<Label Text="Linux (X11/Wayland)" TextColor="{AppThemeBinding Light={StaticResource TextSecondaryLight}, Dark={StaticResource TextSecondaryDark}}" />
|
||||
</HorizontalStackLayout>
|
||||
</Border>
|
||||
|
||||
<Border Style="{StaticResource ThemedCard}">
|
||||
<HorizontalStackLayout>
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Label Text="Rendering:" FontAttributes="Bold" WidthRequest="100"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
<Label Text="SkiaSharp"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextSecondaryLight}, Dark={StaticResource TextSecondaryDark}}" />
|
||||
<Label Text="SkiaSharp" TextColor="{AppThemeBinding Light={StaticResource TextSecondaryLight}, Dark={StaticResource TextSecondaryDark}}" />
|
||||
</HorizontalStackLayout>
|
||||
</Border>
|
||||
|
||||
<Border Style="{StaticResource ThemedCard}">
|
||||
<HorizontalStackLayout>
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Label Text="Framework:" FontAttributes="Bold" WidthRequest="100"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
<Label Text=".NET MAUI"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextSecondaryLight}, Dark={StaticResource TextSecondaryDark}}" />
|
||||
<Label Text=".NET MAUI" TextColor="{AppThemeBinding Light={StaticResource TextSecondaryLight}, Dark={StaticResource TextSecondaryDark}}" />
|
||||
</HorizontalStackLayout>
|
||||
</Border>
|
||||
|
||||
<Border Style="{StaticResource ThemedCard}">
|
||||
<HorizontalStackLayout>
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Label Text="License:" FontAttributes="Bold" WidthRequest="100"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
<Label Text="MIT License"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextSecondaryLight}, Dark={StaticResource TextSecondaryDark}}" />
|
||||
<Label Text="MIT License" TextColor="{AppThemeBinding Light={StaticResource TextSecondaryLight}, Dark={StaticResource TextSecondaryDark}}" />
|
||||
</HorizontalStackLayout>
|
||||
</Border>
|
||||
|
||||
@@ -73,47 +69,49 @@
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Label Text="✓" TextColor="{StaticResource SuccessColor}" FontSize="16" />
|
||||
<Label Text="Full XAML support with styles and resources" FontSize="14"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
<Label Text="•" TextColor="{StaticResource SuccessColor}" FontSize="16" />
|
||||
<Label Text="Full XAML support with styles and resources" FontSize="14" TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
</HorizontalStackLayout>
|
||||
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Label Text="✓" TextColor="{StaticResource SuccessColor}" FontSize="16" />
|
||||
<Label Text="Shell navigation with flyout menus" FontSize="14"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
<Label Text="•" TextColor="{StaticResource SuccessColor}" FontSize="16" />
|
||||
<Label Text="Shell navigation with flyout menus" FontSize="14" TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
</HorizontalStackLayout>
|
||||
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Label Text="✓" TextColor="{StaticResource SuccessColor}" FontSize="16" />
|
||||
<Label Text="All standard MAUI controls" FontSize="14"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
<Label Text="•" TextColor="{StaticResource SuccessColor}" FontSize="16" />
|
||||
<Label Text="All standard MAUI controls" FontSize="14" TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
</HorizontalStackLayout>
|
||||
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Label Text="✓" TextColor="{StaticResource SuccessColor}" FontSize="16" />
|
||||
<Label Text="Data binding and MVVM" FontSize="14"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
<Label Text="•" TextColor="{StaticResource SuccessColor}" FontSize="16" />
|
||||
<Label Text="Data binding and MVVM" FontSize="14" TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
</HorizontalStackLayout>
|
||||
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Label Text="✓" TextColor="{StaticResource SuccessColor}" FontSize="16" />
|
||||
<Label Text="•" TextColor="{StaticResource SuccessColor}" FontSize="16" />
|
||||
<Label Text="Keyboard and mouse input" FontSize="14"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
</HorizontalStackLayout>
|
||||
|
||||
<HorizontalStackLayout Spacing="10">
|
||||
<Label Text="✓" TextColor="{StaticResource SuccessColor}" FontSize="16" />
|
||||
<Label Text="•" TextColor="{StaticResource SuccessColor}" FontSize="16" />
|
||||
<Label Text="High DPI support" FontSize="14"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
</HorizontalStackLayout>
|
||||
|
||||
<BoxView Style="{StaticResource ThemedDivider}" />
|
||||
|
||||
<Label Text="https://github.com/pablotoledo/OpenMaui-Linux"
|
||||
<Label x:Name="WebsiteLink"
|
||||
Text="https://www.openmaui.net"
|
||||
FontSize="12"
|
||||
TextColor="{StaticResource PrimaryColor}"
|
||||
HorizontalOptions="Center" />
|
||||
TextDecorations="Underline"
|
||||
HorizontalOptions="Center">
|
||||
<Label.GestureRecognizers>
|
||||
<TapGestureRecognizer Tapped="OnWebsiteLinkTapped" />
|
||||
</Label.GestureRecognizers>
|
||||
</Label>
|
||||
|
||||
</VerticalStackLayout>
|
||||
</ScrollView>
|
||||
|
||||
@@ -10,4 +10,16 @@ public partial class AboutPage : ContentPage
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private async void OnWebsiteLinkTapped(object? sender, TappedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
await Microsoft.Maui.Platform.Linux.Services.Browser.OpenAsync("https://www.openmaui.net", BrowserLaunchMode.SystemPreferred);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Failed to open URL: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Title="Home"
|
||||
BackgroundColor="{AppThemeBinding Light={StaticResource PageBackgroundLight}, Dark={StaticResource PageBackgroundDark}}">
|
||||
|
||||
<ScrollView Orientation="Both">
|
||||
<ScrollView Orientation="Vertical">
|
||||
<VerticalStackLayout Padding="30" Spacing="20">
|
||||
|
||||
<!-- Header -->
|
||||
@@ -20,6 +20,21 @@
|
||||
HorizontalOptions="Center"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextSecondaryLight}, Dark={StaticResource TextSecondaryDark}}" />
|
||||
|
||||
<!-- Theme Toggle -->
|
||||
<HorizontalStackLayout HorizontalOptions="Center" Spacing="10">
|
||||
<Label Text="Light"
|
||||
FontSize="14"
|
||||
VerticalOptions="Center"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextSecondaryDark}}" />
|
||||
<Switch x:Name="ThemeSwitch"
|
||||
Toggled="OnThemeSwitchToggled"
|
||||
OnColor="{StaticResource PrimaryColor}" />
|
||||
<Label Text="Dark"
|
||||
FontSize="14"
|
||||
VerticalOptions="Center"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextSecondaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
</HorizontalStackLayout>
|
||||
|
||||
<BoxView Style="{StaticResource ThemedDivider}" Margin="0,10" />
|
||||
|
||||
<Label Text="Welcome to the comprehensive controls demonstration for OpenMaui Linux. This app showcases all the major UI controls available in the framework."
|
||||
|
||||
@@ -9,35 +9,62 @@ namespace ShellDemo;
|
||||
|
||||
public partial class HomePage : ContentPage
|
||||
{
|
||||
private bool _isUpdatingThemeSwitch;
|
||||
|
||||
public HomePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
CreateFeatureCards();
|
||||
UpdateThemeSwitchState();
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
UpdateThemeSwitchState();
|
||||
}
|
||||
|
||||
private void UpdateThemeSwitchState()
|
||||
{
|
||||
_isUpdatingThemeSwitch = true;
|
||||
var isDark = Application.Current?.UserAppTheme == AppTheme.Dark ||
|
||||
(Application.Current?.UserAppTheme == AppTheme.Unspecified &&
|
||||
Application.Current?.RequestedTheme == AppTheme.Dark);
|
||||
ThemeSwitch.IsToggled = isDark;
|
||||
_isUpdatingThemeSwitch = false;
|
||||
}
|
||||
|
||||
private void OnThemeSwitchToggled(object? sender, ToggledEventArgs e)
|
||||
{
|
||||
if (_isUpdatingThemeSwitch || Application.Current == null) return;
|
||||
|
||||
Application.Current.UserAppTheme = e.Value ? AppTheme.Dark : AppTheme.Light;
|
||||
}
|
||||
|
||||
private void CreateFeatureCards()
|
||||
{
|
||||
// Title, Description, Route
|
||||
var features = new[]
|
||||
{
|
||||
("Buttons", "Various button styles and events"),
|
||||
("Text Input", "Entry, Editor, SearchBar"),
|
||||
("Selection", "CheckBox, Switch, Slider"),
|
||||
("Pickers", "Picker, DatePicker, TimePicker"),
|
||||
("Lists", "CollectionView with selection"),
|
||||
("Progress", "ProgressBar, ActivityIndicator")
|
||||
("Buttons", "Various button styles and events", "Buttons"),
|
||||
("Text Input", "Entry, Editor, SearchBar", "TextInput"),
|
||||
("Selection", "CheckBox, Switch, Slider", "Selection"),
|
||||
("Pickers", "Picker, DatePicker, TimePicker", "Pickers"),
|
||||
("Lists", "CollectionView with selection", "Lists"),
|
||||
("Progress", "ProgressBar, ActivityIndicator", "Progress")
|
||||
};
|
||||
|
||||
for (int i = 0; i < features.Length; i++)
|
||||
{
|
||||
var (title, desc) = features[i];
|
||||
var card = CreateFeatureCard(title, desc);
|
||||
var (title, desc, route) = features[i];
|
||||
var card = CreateFeatureCard(title, desc, route);
|
||||
Grid.SetRow(card, i / 2);
|
||||
Grid.SetColumn(card, i % 2);
|
||||
FeatureGrid.Children.Add(card);
|
||||
}
|
||||
}
|
||||
|
||||
private Border CreateFeatureCard(string title, string description)
|
||||
private Border CreateFeatureCard(string title, string description, string route)
|
||||
{
|
||||
// Use AppThemeBinding for card colors
|
||||
var cardBackground = new AppThemeBindingExtension
|
||||
@@ -100,6 +127,11 @@ public partial class HomePage : ContentPage
|
||||
Application.Current?.Resources["CardBackgroundLight"] as Color ?? Colors.White,
|
||||
Application.Current?.Resources["CardBackgroundDark"] as Color ?? Color.FromArgb("#1E1E1E"));
|
||||
|
||||
// Add tap gesture for navigation
|
||||
var tapGesture = new TapGestureRecognizer();
|
||||
tapGesture.Tapped += (s, e) => LinuxViewRenderer.NavigateToRoute(route);
|
||||
border.GestureRecognizers.Add(tapGesture);
|
||||
|
||||
return border;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user