-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Description
Use case
The most common use-case I think of is when we have a horizontal scrollable in a vertical scrollable. We need to constrain the height of the horizontal one. We can use IntrinsicWidth
(which won't work with ListView
iirc and is expensive), or we can use SizedBox
with height. The latter would be either having a constant height (which usually will be a bad approach as it won't support changes in accessibility text scale) or manually calculating the height from TextPainter
s and dimension constants in the build.
Proposal
Inspired by the prototypeItem
from the ListView
, I came up with the idea of having a PrototypeWidth
, PrototypeHeight
and/or PrototypeSizedBox
that would set the dimension(s) of its child to ones that we got from laying out the prototype widget.
With such a widget I could wrap my horizontal ListView
with a PrototypeHeight
where I pass a list item widget as a prototype.
Execution
I'd be willing to implement such widget, coming up with the API myself or based on your suggestions here :)