You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have you ever thought about computed values and state management? While diving into the Mirai project, I noticed something was missing – the ability to create and manage your own states. I'm not entirely sure if skipping this feature was intentional, but I decided to take a shot at it and came up with a solution in this POC pull request.
The core idea is to allow the creation of states for your screen, similar to the classic counter app.
I've introduced a fresh concept called Computed Value to Mirai's engine. This concept revolves around performing calculations in runtime. To go hand in hand with this, I've also added a new action named MiraiSetStateAction, that, as the name implies, sets the state value.
To handle states effectively, I had to write a MiraiStateHolder InheritedWidget. This widget lets the widgets in the subtree access the state through context. Now, I've noticed you've used Cubit in certain areas, and we could have gone that route here. However, given the simplicity of the task at hand, an InheritedWidget seemed like the right tool for the job.
And as for the "computed" part, I've whipped up three simple parsers to showcase the concept: MiraiComputedToString, MiraiComputedSum, and MiraiComputedState. But the concept is extensible, so we can have any kind of runtime computation.
computed-example.mp4
Do you think this idea aligns well with the project's goals?
Requirements
State management
Computed values engine
The text was updated successfully, but these errors were encountered:
Description
Have you ever thought about computed values and state management? While diving into the Mirai project, I noticed something was missing – the ability to create and manage your own states. I'm not entirely sure if skipping this feature was intentional, but I decided to take a shot at it and came up with a solution in this POC pull request.
The core idea is to allow the creation of states for your screen, similar to the classic counter app.
I've introduced a fresh concept called
Computed Value
to Mirai's engine. This concept revolves around performing calculations in runtime. To go hand in hand with this, I've also added a new action namedMiraiSetStateAction
, that, as the name implies, sets the state value.To handle states effectively, I had to write a
MiraiStateHolder
InheritedWidget. This widget lets the widgets in the subtree access the state throughcontext
. Now, I've noticed you've usedCubit
in certain areas, and we could have gone that route here. However, given the simplicity of the task at hand, an InheritedWidget seemed like the right tool for the job.And as for the "computed" part, I've whipped up three simple parsers to showcase the concept:
MiraiComputedToString
,MiraiComputedSum
, andMiraiComputedState
. But the concept is extensible, so we can have any kind of runtime computation.computed-example.mp4
Do you think this idea aligns well with the project's goals?
Requirements
The text was updated successfully, but these errors were encountered: