Skip to content

Commit

Permalink
Merge pull request #108 from MykhailoDav/adding_appShell
Browse files Browse the repository at this point in the history
Adding AppShell
  • Loading branch information
yurkinh authored Jan 6, 2025
2 parents 2b6d601 + 845e48c commit 1bfa13c
Show file tree
Hide file tree
Showing 19 changed files with 322 additions and 144 deletions.
Binary file modified res/DarkTheme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/LightTheme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions samples/SampleApp/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ public partial class App : Application

public static new App Current => (App)Application.Current;
public App(IThemeService themeService)
{
{
this.themeService = themeService;
InitializeComponent();

MainPage = new NavigationPage(new MainPage());
MainPage = new AppShell();
}


protected override void OnStart()
{
themeService.SetTheme(AppTheme.Unspecified);
}
}

protected override void OnResume()
{

}

}

35 changes: 35 additions & 0 deletions samples/SampleApp/AppShell.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8" ?>
<Shell
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="SampleApp.AppShell"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
Title="Calendar"
BackgroundColor="{toolkit:AppThemeResource ShellColor}"
FlyoutBackgroundColor="{toolkit:AppThemeResource BackgroundColorfullPageColor}"
xmlns:local="clr-namespace:SampleApp.Views;assembly=SampleApp"
Shell.TitleColor="{toolkit:AppThemeResource TextColor}"
Shell.FlyoutBehavior="Disabled">
<Shell.Resources>
<ResourceDictionary>
<toolkit:AppThemeColor
x:Key="ShellColor"
Dark="#FF243138"
Light="#FFE2E3D4"/>
</ResourceDictionary>
</Shell.Resources>
<TabBar>
<Tab Icon="calendar"
Title="MainPage">
<ShellContent
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage"/>
</Tab>
<Tab Icon="settings"
Title="Settings">
<ShellContent
ContentTemplate="{DataTemplate local:UserSettingPage}"
Route="UserSettingPage"/>
</Tab>
</TabBar>
</Shell>
21 changes: 21 additions & 0 deletions samples/SampleApp/AppShell.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using SampleApp.Views;

namespace SampleApp;

public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();

Routing.RegisterRoute(nameof(UserSettingPage), typeof(UserSettingPage));
Routing.RegisterRoute(nameof(SimplePage), typeof(SimplePage));
Routing.RegisterRoute(nameof(WeekendCalendarPage), typeof(WeekendCalendarPage));
Routing.RegisterRoute(nameof(MultiSelectionPage), typeof(MultiSelectionPage));
Routing.RegisterRoute(nameof(AdvancedPage), typeof(AdvancedPage));
Routing.RegisterRoute(nameof(RangeSelectionPage), typeof(RangeSelectionPage));
Routing.RegisterRoute(nameof(WeekViewPage), typeof(WeekViewPage));
Routing.RegisterRoute(nameof(TwoWeekViewPage), typeof(TwoWeekViewPage));
Routing.RegisterRoute(nameof(Windows11CalendarPage), typeof(Windows11CalendarPage));
}
}
4 changes: 2 additions & 2 deletions samples/SampleApp/Controls/ThemeButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
<toolkit:AppThemeColor
x:Key="CheeckedColor"
Dark="#B3FCF8"
Light="#B3FCF8" />
Light="#2F3E46" />
<toolkit:AppThemeColor
x:Key="UncheckedColor"
Dark="#2F3E46"
Light="#2F3E46" />
Light="#c2c5aa" />
</ContentView.Resources>

<RadioButton GroupName="{Binding GroupName, Source={x:Reference This}}" IsChecked="{Binding IsChecked, Source={x:Reference This}, Mode=TwoWay}">
Expand Down
39 changes: 39 additions & 0 deletions samples/SampleApp/Resources/Images/calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions samples/SampleApp/Resources/Images/settings.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion samples/SampleApp/Resources/Styles/Colors.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@
Light="#c2c5aa" />
<toolkit:AppThemeColor
x:Key="TextColor"
Dark="#B3FCF8"
Dark="#a3b18a"
Light="#2F3E46" />
</ResourceDictionary>
41 changes: 26 additions & 15 deletions samples/SampleApp/Views/AdvancedPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,39 @@
xmlns:plugin="clr-namespace:Plugin.Maui.Calendar.Controls;assembly=Plugin.Maui.Calendar"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Name="advancedCalendarPage"
Shell.TabBarIsVisible="False"
x:DataType="local:AdvancedPageViewModel"
BackgroundColor="{toolkit:AppThemeResource BackgroundColor}"
Unloaded="UnloadedHandler">
<ContentPage.Resources>
<ResourceDictionary>
<Style x:Key="daysLabelStyle" TargetType="Label">
<Setter Property="HorizontalTextAlignment" Value="Center" />
<Setter Property="TextColor" Value="Black" />
<Setter Property="FontSize" Value="Medium" />
<Setter Property="LineBreakMode" Value="WordWrap" />
<Setter Property="VerticalTextAlignment" Value="Center" />
<Setter Property="Margin" Value="5,2" />
<Style x:Key="daysLabelStyle"
TargetType="Label">
<Setter Property="HorizontalTextAlignment"
Value="Center"/>
<Setter Property="TextColor"
Value="Black"/>
<Setter Property="FontSize"
Value="Medium"/>
<Setter Property="LineBreakMode"
Value="WordWrap"/>
<Setter Property="VerticalTextAlignment"
Value="Center"/>
<Setter Property="Margin"
Value="5,2"/>
</Style>
<Style x:Key="daysTitleLabelStyle" TargetType="Label">
<Setter Property="FontSize" Value="18" />
<Setter Property="FontFamily" Value="OpenSansSemibold" />
<Style x:Key="daysTitleLabelStyle"
TargetType="Label">
<Setter Property="FontSize"
Value="18"/>
<Setter Property="FontFamily"
Value="OpenSansSemibold"/>
</Style>
</ResourceDictionary>
</ContentPage.Resources>

<ContentPage.BindingContext>
<local:AdvancedPageViewModel />
<local:AdvancedPageViewModel/>
</ContentPage.BindingContext>


Expand Down Expand Up @@ -77,18 +88,18 @@
YearLabelColor="Blue">

<plugin:Calendar.HeaderSectionTemplate>
<controls:CalendarHeader />
<controls:CalendarHeader/>
</plugin:Calendar.HeaderSectionTemplate>

<plugin:Calendar.FooterSectionTemplate>
<DataTemplate>
<controls:CalendarFooter />
<controls:CalendarFooter/>
</DataTemplate>
</plugin:Calendar.FooterSectionTemplate>

<plugin:Calendar.EventTemplate>
<DataTemplate>
<controls:CalenderEvent CalenderEventCommand="{Binding BindingContext.EventSelectedCommand, Source={x:Reference advancedCalendarPage}}" />
<controls:CalenderEvent CalenderEventCommand="{Binding BindingContext.EventSelectedCommand, Source={x:Reference advancedCalendarPage}}"/>
</DataTemplate>
</plugin:Calendar.EventTemplate>
<plugin:Calendar.EmptyTemplate>
Expand All @@ -97,7 +108,7 @@
<Label
Margin="0,5,0,5"
HorizontalTextAlignment="Center"
Text="NO EVENTS FOR THE SELECTED DATE" />
Text="NO EVENTS FOR THE SELECTED DATE"/>
</VerticalStackLayout>
</DataTemplate>
</plugin:Calendar.EmptyTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
xmlns:plugin="clr-namespace:Plugin.Maui.Calendar.Controls;assembly=Plugin.Maui.Calendar"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Name="windowsCalendarPage"
Shell.TabBarIsVisible="False"
Title="Windows 11 Calendar"
x:DataType="local:Windows11CalendarViewModel">

Expand All @@ -16,28 +17,31 @@
<toolkit:AppThemeColor
x:Key="WindowsThemeColor"
Dark="#04e762"
Light="#2b9348" />
Light="#2b9348"/>
<toolkit:AppThemeColor
x:Key="TodayDayLabelTextColor"
Dark="Black"
Light="White" />
Light="White"/>
<toolkit:AppThemeObject
x:Key="Walpaper"
Dark="windows_walpaper_dark.png"
Light="windows_walpaper_light.png" />
<Style x:Key="DaysLabelStyle" TargetType="Label">
<Setter Property="TextColor" Value="Red" />
Light="windows_walpaper_light.png"/>
<Style x:Key="DaysLabelStyle"
TargetType="Label">
<Setter Property="TextColor"
Value="Red"/>
</Style>
</ResourceDictionary>
</ContentPage.Resources>


<ContentPage.BindingContext>
<local:Windows11CalendarViewModel />
<local:Windows11CalendarViewModel/>
</ContentPage.BindingContext>

<Grid>
<Image Aspect="AspectFill" Source="{toolkit:AppThemeResource Walpaper}" />
<Image Aspect="AspectFill"
Source="{toolkit:AppThemeResource Walpaper}"/>
<Border
Margin="30"
BackgroundColor="{toolkit:AppThemeResource BackgroundColor}"
Expand All @@ -54,7 +58,7 @@
Brush="Black"
Opacity="0.1"
Radius="2"
Offset="0,4" />
Offset="0,4"/>
</Border.Shadow>
<plugin:Calendar
x:Name="calendar"
Expand All @@ -76,7 +80,7 @@

<plugin:Calendar.HeaderSectionTemplate>
<DataTemplate>
<controls:Windows11CalendarHeader />
<controls:Windows11CalendarHeader/>
</DataTemplate>
</plugin:Calendar.HeaderSectionTemplate>
</plugin:Calendar>
Expand Down
Loading

0 comments on commit 1bfa13c

Please sign in to comment.