-
Notifications
You must be signed in to change notification settings - Fork 405
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
[Proposal] RatingView proposal #1607
Comments
Thanks @Eel2000! Inheritance / Implementationspublic class RatingView What does RatingView inherit / implement? E.g. Will it inherit from We should inherit from the highest possible .NET MAUI control (typically As an example, check out
RatingShape ExtensibilityI see that And as maintainers, this means that we'll be required to add new shapes to unblock users. Perhaps we could use public class RatingView
{
public string Shape { get; set; } = RatingViewShapes.Star;
}
public static class RatingViewShapes
{
public const string Star = nameof(Star);
public const string Heart = nameof(Heart);
public const string Like = nameof(Like);
public const string Dislike = nameof(Dislike);
} Naming Suggestionspublic enum RatingShapes If we decide to move forward with an public bool Animate Let's rename this to public bool AllowRating What does this boolean do? I'm a bit confused by its name because if public Color Fill { get; set; }
public Color EmptyColor { get; set; } I assume that these do the same, but opposite, tasks: If so, let's rename them to align better with each other. This will help signal to users that they do the same thing. Perhaps //the number of shapes filled to show the rating(default)
public double Value { get ; set ; } Let's use a more descriptive name. As a rule of thumb, if you have to leave a comment describing what a property does, it likely has a poor name. Maybe //number of shapes (clickable or not) to show on the view(page)
public int Maximum { get; set; } Let's use a more descriptive name. As a rule of thumb, if you have to leave a comment describing what a property does, it likely has a poor name. Maybe Minimum RatingSince we have Properties for This would allow users to set a minimum value to the rating. I could see users wanting like Custom AnimationSince we have public static readonly BindableProperty CustomAnimationProperty;
public Animation? CustomAnimation; When ICommand NullabilityThe default value for both public ICommand? Command { get; set; }
public object? CommandParameter { get; set; } BindControlWhat is public object BindControl { get; set; } |
Couple of solutions on points raised by @brminnick
I really like the idea of having it as
There's no platform-default, if I did look right the implementation is based on the shared layer using drawing controls. I know that Android has this View implemented, but not other platforms... So we need to think if we go all shared or use Android as native and build other platforms to match its behavior.
Should those be |
Thank you @brminnick InheritanceFor the inheritance, I'm still trying to see which high MAUI control it should inherit from as the original code was inheriting the Grid Element. RatingShape ExtensibilityConcerning the RatingShape, i like the @pictos Idea to write a source generator. the only issue is, I don't have any experience in it. I may need help with it. I thing that it is a great opportunity for me to improve the control and make it more interesting. Custom AnimationIt should be nullable. If the user chooses not to provide any value, the control should not animate at all. However, at this point, I guess, we should consider implementing default options for other platforms as previously specified by @pictos. |
Tanks @Eel2000! Could you please edit the Inheriting from GridAh yea, inheriting from any For example, every We can accomplish this by leveraging the 👇 Something like this public class RatingView : Grid
{
// ...
public new IReadOnlyList<IView> Children
{
get => base.Chilrdren;
private set => base.Children = value;
}
} Source GeneratorsI don't recommend you do anything with Source Generators for the first implementation of RatingView. They're very difficult to learn. I've seen a lot of well-intentioned devs go that path and fail. To keep things moving forward, let's do this:
|
Actually RatingView doesn't inherit from Grid, but from Here's the BaseTemplateView implementation. They do expose the |
I like the idea of this Control. I would like to add to the discussion around the Shape. Instead of an Enum or just a string, I would also like to propose to make it of type |
Approve. But please update the issue with the final design. |
Alright. It will be done. thanks |
From my experience in implementing the BTW: I did implement in the I think we should *allow users to provide their own custom shapes, should they choose to do so (and if they have not already selected a pre-defined
I also think we need a property to indicate the I know this all takes time and effort, but I do think it's personally worthwhile and of great benefit to the community. |
Thank you @GeorgeLeithead , I'm still working on the control and I do much appreciate your suggestion about the full or half fill options I forgot about that. for the Inheritance i think for now as i haven't fount another to do it without using templateview , I will still using the border element. |
Feature name
RatingView
Link to discussion
#1495
Progress tracker
Summary
Maui.RatingView - is a cross platform plugin for MAUI which allow you to use the rating capabilities in your application with ease and flexibility
Motivation
This feature aimes to add the rating capability in a maui application
Detailed Design
Usage Syntax
Here is a usage examples
Drawbacks
No response
Alternatives
No response
Unresolved Questions
No response
The text was updated successfully, but these errors were encountered: