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
Added the StateLayout #450
Conversation
I hope to be able to add some documentation for this and can port some of the existing samples from the repo. Not sure if I'll come around to writing some adequate tests due to time constraints, so if anyone is up for that feel free to add them. |
7c1ee29
to
1317af7
Compare
Builds 🎉 |
bd63fc2
to
188e9b7
Compare
188e9b7
to
5164ed5
Compare
5164ed5
to
bd43fec
Compare
XamarinCommunityToolkit/Converters/StateToBooleanConverter.shared.cs
Outdated
Show resolved
Hide resolved
XamarinCommunityToolkit/Converters/StateToBooleanConverter.shared.cs
Outdated
Show resolved
Hide resolved
Success, | ||
Error, | ||
Empty, | ||
Custom |
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.
I wonder, is there any sense to keep enum if we cannot describe all possible cases?
Maybe we can refactor it to static class (similar to how XF Device class operates with RuntimePlatform)
public static class LayoutState {
public const string None = nameof(None);
public const string Loading = nameof(Loading);
/// etc.
}
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.
Been trying this but so far it's been a bunch of misery :P The custom state is explicitly added for scenarios not covered by the default states. Also making it a string introduces some strange scenarios where the user has to explicitly set a value for it to work. We can fix that in the component obviously, but it feels a bit strange.
@@ -0,0 +1,13 @@ | |||
namespace Xamarin.CommunityToolkit.UI.Views | |||
{ | |||
public enum State |
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.
Hmm, LayoutState?
State is too general, I believe
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.
Thing is, that would mean we have StateLayout
and LayoutState
. That confuses me even more 😅
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, that's fair. But if we will add several new controls which have "State" property, it will confuse not less :)
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.
Agree. Perhaps I shall think a bit longer on an alternative :)
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.
Are we still going to change this name?
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.
Open to suggestions :)
XamarinCommunityToolkitSample.Android/Xamarin.CommunityToolkit.Sample.Android.csproj
Show resolved
Hide resolved
bd43fec
to
192c3fd
Compare
Hmmm, something went wrong with rebase, I guess |
Working on it :) |
aa8d532
to
ba24f54
Compare
I rebased once more. Unless we can come up with a better name I'd say leave |
That's up to you. |
1763133
to
04c8a1e
Compare
@AndreiMisiukevich I renamed to |
Description of Change
This PR adds
StateLayout
and all of its helper classes. This is currently up as a separate NuGet called "StateSquid" here:https://www.nuget.org/packages/Xamarin.Forms.StateSquid 🦑
Bugs Fixed
API Changes
Added all the classes as already described in #275. The only thing I haven't put in here is the
SkeletonView
that was mentioned there. I don't want to take that in to be honest, as I think it should be up to the user to create their own visualization. I'm sure we could come up with a better skeleton loading solution anyway.PR Checklist