question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Proposal] StateLayout

See original GitHub issue

StateLayout

Summary

Displaying a specific view when your app is in a specific state is a common pattern throughout any mobile app. Examples range from creating loading views to overlay on the screen, or on a subsection of the screen. Empty state views can be created for when there’s no data to display, and error state views can be displayed when an error occurs.

Detailed Design

StateLayout.shared.cs

public static class StateLayout
{
  public static readonly BindableProperty StateViewsProperty;
  public static readonly BindableProperty CurrentStateProperty;
  public static readonly BindableProperty CurrentCustomStateKeyProperty;
  public static readonly BindableProperty AnimateStateChangesProperty;
  
  public static IList<StateView>? GetStateViews(BindableObject b);
  public static void SetCurrentState(BindableObject b, LayoutState value);
  public static LayoutState GetCurrentState(BindableObject b);
  public static void SetCurrentCustomStateKey(BindableObject b, string value);
  public static string? GetCurrentCustomStateKey(BindableObject b);
  public static void SetAnimateStateChanges(BindableObject b, bool value);
  public static bool GetAnimateStateChanges(BindableObject b);
}

Usage Syntax

XAML Usage

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
             x:Class="MyLittleApp.MainPage">

     <Grid xct:StateLayout.CurrentState="{Binding CurrentState}">
      <xct:StateLayout.StateViews>
         <xct:StateView StateKey="Loading">
            <Grid BackgroundColor="White">
               <StackLayout VerticalOptions="Center" HorizontalOptions="Center">
                  <ActivityIndicator Color="#1abc9c" />
                  <Label Text="Loading..." HorizontalOptions="Center" />
               </StackLayout>
            </Grid>
         </xct:StateView>
      </xct:StateLayout.StateViews>      

     ...

  </Grid>

</ContentPage>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:6
  • Comments:28 (16 by maintainers)

github_iconTop GitHub Comments

3reactions
pictoscommented, Sep 17, 2022

Hey @developer9969, Addressing your comments…

I dont feel like I could do a as a good job as you guys!!

I’m 10000000% sure that you can do a great job! I mean, if my code pass the review process anyone can do it as well, and better!

Some outstanding developers have contributed to the xamarin toolkit but noticed that they have all dropped now. Pity . And they prefer write components in their own space rather than contribute here . Why do you think??

Devs that contributed to this project (during the Xamarin era and now) are still contributing. Devs that donate their feature to us will not create new ones, and still, give us some help improving those features. I’ve no idea why devs want to create their own libs instead of adding those here, maybe they want to rule their releases and how the project goes (?). IMHO this isn’t a bad thing, I really love to see that we aren’t the only lib that provides great components for .NET MAUI.

Do you think that you could streamline the pull request process - Champion concept and so on… In some social media , honestly dont remember which one they were some couple of well know devs that complained about the all process. I might as well talk nonsense here and apologies but all I am saying here is that I want this to be a huge success , and avoid picking up nugets here there and everywhere…

I agree with this, but this is just part of the picture. So let me expand this a little bit… Yeah, our process now is slower and “bureaucratic” (not sure if this is the best word to describe it), but with this process, we could improve our quality at the highest level. On XCT our docs suck, just a few of our features have docs and that is terrible for new users. Now we make sure to write docs before merging any PR, we demand unit tests (when it’s possible), we have just a few bugs opened and we can track and fix them much more quickly than before. And as you mentioned we do this in our free time (as core team members) and we have soo much responsibility. So we need to review PRs, guide new contributors, review/write docs, triage issues, and do the Standup. And after all, we need to fix bugs and port the features from XCT to here. I mean, we love what we do, but it’s a lot of work and if we don’t have the community helping us we will take a lot of time to port everything from XCT with the most high quality. So at the end of the day, having this process helps us to keep track of all features and make sure everything is in place to provide an amazing package to everyone in the community.

I will look and see if I can contribute and try to build in .net maui in isolation and when done and if done I will publish for review. Anyway Great job guys… Give us some cool stuff

Please do that, and help us to improve this package!

2reactions
angelrucommented, Aug 2, 2022

any news about this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

StateLayout is a simple-use Android layout library which ...
StateLayout is a simple-use Android layout library which handles Loading, Content and Error/Info states for the activity/fragment/view. This library is ...
Read more >
[Spec] StateLayout · Issue #275 · xamarin/ ...
StateLayout Displaying items when your app is in a specific state is a common pattern throughout any mobile app.
Read more >
Xamarin Community Toolkit StateLayout
The StateLayout control enables the user to turn any layout element like a Grid or StackLayout into an individual state-aware element.
Read more >
My proposed new state layout for the USA
I like the idea of all airports being in the same area, would make it much simpler and flights would be much shorter...
Read more >
STATEMAP Proposal Preparation Webinar
STATEMAP Proposal Preparation Webinar. By National Cooperative Geologic Mapping Program September 26, 2019.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found