Skip to content

Conversation

Ninja260
Copy link

No description provided.

@Ninja260 Ninja260 changed the title Stateful Widget state losing issue fix. Stateful widget state losing issue fix. Jan 25, 2024
@Ninja260 Ninja260 marked this pull request as draft February 1, 2024 08:50
@Ninja260 Ninja260 marked this pull request as ready for review February 1, 2024 08:53
@Ninja260
Copy link
Author

Ninja260 commented Feb 1, 2024

Hello bro @rayliverified, I am waiting follow up from you for my pull request.
I am having state losing issue because of layout change while I am using the library. This is why this pull request happens. I will be waiting for you reply.

@rayliverified
Copy link
Contributor

KK, taking a look.

Thank you for raising this issue.

@rayliverified
Copy link
Contributor

I don't understand what Flex solves here. Can you help me understand?

@Ninja260
Copy link
Author

Ninja260 commented Feb 13, 2024

@rayliverified If we put a StatefulWidget under a ResponsiveRowColumn widget, the stateful widget loses state when the ResponsiveRowColumn layout change from Row to Column, and vice versa. This is because the inner widget tree of the ResponsiveRowColumn changes when Row or Column is being conditionally rendered.

To Solve this issue, I proposed to use Flex in place of using Row and Column. Flex have the same constructor arguments as Row or Column. The only difference is that we need to define the direction argument, which is used to decide whether to render as Row or Column.

In that way, the inner widget tree of the ResponsiveRowColumn will remain intact even the layout changes. The state losing issue is prevented.

@Ninja260
Copy link
Author

bro @rayliverified . I am waiting response from you. :)

@rayliverified
Copy link
Contributor

rayliverified commented Feb 23, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants