Open esDotDev opened 3 years ago
It's feasible but needs adding support for mounting RenderObjects using hooks.
Doable, but requires a bit of work.
Nice! I took a stab at it, but am really out of my depth when trying to use gesture detection manually without a widget. Cant find a clear code example anywhere on how this would actually be setup.
It's feasible but needs adding support for mounting RenderObjects using hooks.
Doable, but requires a bit of work.
Would such addition provide the possibility to create a hook like useConstraints
, the equivalent to a LayoutBuilder
?
That would be very useful for responsive UI related hooks and extract common logic in the app.
For example a custom hook like:
useAvailableSpace()
. It could return an enum (narrow, medium, wide) by using the constraints hook under the hood.
LayoutBuilder is special
I don't think it's feasible to implement as a hook. The main issue is, it invokes its builder asynchronously. So hooks wouldn't be able to synchronously get the value
Is your feature request related to a problem? Please describe. It's cumbersome to manually create desktop effects for the mouse cursor. We need to either use a StatefulWidget w/ MouseRegion widget 2 event listeners, and an internal
_isMouseDown
bool, or some combination of nested Build widgets.Similarly, getting the mouse position is a fairly verbose process of using MouseRegion, some local Offset, and maybe a globalToLocal call on the context.
Describe the solution you'd like bool isMouseOver = useMouseOver(); Offset mousePos = useMouseOffset(); Offset localMousePos = useMouseOffset(local: true);