-
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
base: net10.0
Are you sure you want to change the base?
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The method should return a consistent Task type rather than nullable Task. Consider returning Task.CompletedTask for null projects instead of null to maintain a consistent async pattern.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||
|
||||||||||
[RelayCommand] | ||||||||||
private Task NavigateToTask(ProjectTask task) | ||||||||||
|
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The SelectionChangedCommandParameter binding to SelectedProject is redundant since the SelectedItem is already bound to SelectedProject. The command can access the selected project directly through the SelectedProject property, eliminating the need for the command parameter.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||||||||
<CollectionView.ItemsLayout> | ||||||||
<LinearItemsLayout Orientation="Horizontal" ItemSpacing="7.5"/> | ||||||||
</CollectionView.ItemsLayout> | ||||||||
<CollectionView.ItemTemplate> | ||||||||
<DataTemplate x:DataType="models:Project"> | ||||||||
<controls:ProjectCardView WidthRequest="200" /> | ||||||||
</DataTemplate> | ||||||||
</CollectionView.ItemTemplate> | ||||||||
</CollectionView> | ||||||||
<Grid Grid.Row="4" MinimumHeightRequest="44"> | ||||||||
<Label Text="Tasks" Style="{StaticResource Title2}" VerticalOptions="Center" SemanticProperties.HeadingLevel="Level1"/> | ||||||||
<ImageButton | ||||||||
Source="{StaticResource IconClean}" | ||||||||
|
@@ -70,15 +81,15 @@ | |||||||
Command="{Binding CleanTasksCommand}" | ||||||||
SemanticProperties.Description="Clean tasks" /> | ||||||||
</Grid> | ||||||||
<VerticalStackLayout Spacing="15" | ||||||||
<VerticalStackLayout Grid.Row="5" Spacing="15" | ||||||||
BindableLayout.ItemsSource="{Binding Tasks}"> | ||||||||
<BindableLayout.ItemTemplate> | ||||||||
<DataTemplate> | ||||||||
<controls:TaskView TaskCompletedCommand="{Binding TaskCompletedCommand, Source={RelativeSource AncestorType={x:Type pageModels:MainPageModel}}, x:DataType=pageModels:MainPageModel}" /> | ||||||||
</DataTemplate> | ||||||||
</BindableLayout.ItemTemplate> | ||||||||
</VerticalStackLayout> | ||||||||
</VerticalStackLayout> | ||||||||
</Grid> | ||||||||
</ScrollView> | ||||||||
</pullToRefresh:SfPullToRefresh.PullableContent> | ||||||||
</pullToRefresh:SfPullToRefresh> | ||||||||
|
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.
Copilot uses AI. Check for mistakes.