-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Enhance maui-mobile developer sample with recent updates #31646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -35,6 +35,9 @@ public partial class MainPageModel : ObservableObject, IProjectTaskPageModel | |||||||||
| [ObservableProperty] | ||||||||||
| private string _today = DateTime.Now.ToString("dddd, MMM d"); | ||||||||||
|
|
||||||||||
| [ObservableProperty] | ||||||||||
| private Project? selectedProject; | ||||||||||
|
|
||||||||||
| public bool HasCompletedTasks | ||||||||||
| => Tasks?.Any(t => t.IsCompleted) ?? false; | ||||||||||
|
|
||||||||||
|
|
@@ -149,8 +152,8 @@ private Task AddTask() | |||||||||
| => Shell.Current.GoToAsync($"task"); | ||||||||||
|
|
||||||||||
| [RelayCommand] | ||||||||||
| private Task NavigateToProject(Project project) | ||||||||||
| => Shell.Current.GoToAsync($"project?id={project.ID}"); | ||||||||||
| private Task? NavigateToProject(Project project) | ||||||||||
| => project is null ? null : Shell.Current.GoToAsync($"project?id={project.ID}"); | ||||||||||
|
Comment on lines
+155
to
+156
|
||||||||||
| private Task? NavigateToProject(Project project) | |
| => project is null ? null : Shell.Current.GoToAsync($"project?id={project.ID}"); | |
| private Task NavigateToProject(Project project) | |
| => project is null ? Task.CompletedTask : Shell.Current.GoToAsync($"project?id={project.ID}"); |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -38,26 +38,37 @@ | |||||||
| RefreshCommand="{Binding RefreshCommand}"> | ||||||||
| <pullToRefresh:SfPullToRefresh.PullableContent> | ||||||||
| <ScrollView> | ||||||||
| <VerticalStackLayout Spacing="{StaticResource LayoutSpacing}" Padding="{StaticResource LayoutPadding}"> | ||||||||
| <Label Text="Task Categories" Style="{StaticResource Title2}" SemanticProperties.HeadingLevel="Level1"/> | ||||||||
| <controls:CategoryChart /> | ||||||||
| <Label Text="Projects" Style="{StaticResource Title2}" SemanticProperties.HeadingLevel="Level1"/> | ||||||||
| <ScrollView Orientation="Horizontal" Margin="-30,0"> | ||||||||
| <HorizontalStackLayout | ||||||||
| Spacing="15" Padding="30,0" | ||||||||
| BindableLayout.ItemsSource="{Binding Projects}"> | ||||||||
| <BindableLayout.ItemTemplate> | ||||||||
| <DataTemplate x:DataType="models:Project"> | ||||||||
| <controls:ProjectCardView WidthRequest="200"> | ||||||||
| <controls:ProjectCardView.GestureRecognizers> | ||||||||
| <TapGestureRecognizer Command="{Binding NavigateToProjectCommand, Source={RelativeSource AncestorType={x:Type pageModels:MainPageModel}}, x:DataType=pageModels:MainPageModel}" CommandParameter="{Binding .}"/> | ||||||||
| </controls:ProjectCardView.GestureRecognizers> | ||||||||
| </controls:ProjectCardView> | ||||||||
| </DataTemplate> | ||||||||
| </BindableLayout.ItemTemplate> | ||||||||
| </HorizontalStackLayout> | ||||||||
| </ScrollView> | ||||||||
| <Grid MinimumHeightRequest="44"> | ||||||||
| <Grid RowSpacing="{StaticResource LayoutSpacing}" Padding="{StaticResource LayoutPadding}"> | ||||||||
| <Grid.RowDefinitions> | ||||||||
| <RowDefinition Height="Auto" /> | ||||||||
| <RowDefinition Height="Auto" /> | ||||||||
| <RowDefinition Height="Auto" /> | ||||||||
| <RowDefinition Height="Auto" /> | ||||||||
| <RowDefinition Height="Auto" /> | ||||||||
| <RowDefinition Height="Auto" /> | ||||||||
| </Grid.RowDefinitions> | ||||||||
|
|
||||||||
| <Label Grid.Row="0" Text="Task Categories" Style="{StaticResource Title2}" SemanticProperties.HeadingLevel="Level1"/> | ||||||||
| <controls:CategoryChart Grid.Row="1" /> | ||||||||
| <Label Grid.Row="2" Text="Projects" Style="{StaticResource Title2}" SemanticProperties.HeadingLevel="Level1"/> | ||||||||
| <CollectionView Grid.Row="3" ItemsSource="{Binding Projects}" | ||||||||
| Margin="-7.5,0" | ||||||||
| MinimumHeightRequest="250" | ||||||||
| x:Name="ProjectsCollectionView" | ||||||||
| SelectionMode="Single" | ||||||||
| SelectedItem="{Binding SelectedProject}" | ||||||||
| SelectionChangedCommand="{Binding NavigateToProjectCommand, Source={RelativeSource AncestorType={x:Type pageModels:MainPageModel}}, x:DataType=pageModels:MainPageModel}" | ||||||||
| SelectionChangedCommandParameter="{Binding SelectedProject}"> | ||||||||
|
Comment on lines
+60
to
+61
|
||||||||
| SelectionChangedCommand="{Binding NavigateToProjectCommand, Source={RelativeSource AncestorType={x:Type pageModels:MainPageModel}}, x:DataType=pageModels:MainPageModel}" | |
| SelectionChangedCommandParameter="{Binding SelectedProject}"> | |
| SelectionChangedCommand="{Binding NavigateToProjectCommand, Source={RelativeSource AncestorType={x:Type pageModels:MainPageModel}}, x:DataType=pageModels:MainPageModel}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, can simplify it because the command can access the selected project directly through the SelectedProject property. I'm ok with both options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method returns Task? which creates an inconsistent API design. Consider throwing ArgumentNullException for null projects or restructuring to always return a completed Task to maintain a consistent return type.