Skip to content

PrototypeWidth/Height widgets (SizedBox but using size from laying out prototype widget) #169917

@Albert221

Description

@Albert221

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 TextPainters 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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy