Skip to content

[rfw] Add Flexible widget support to core widgets #173313

@BottlePumpkin

Description

@BottlePumpkin

Use case

When building dynamic layouts through RFW, developers need the ability to create flexible layouts with fine-grained control over how space is distributed among children in a Row or Column. Currently, RFW only supports:

  • Expanded: Always takes all available space (FlexFit.tight)
  • No option for FlexFit.loose behavior

Real-world scenarios where Flexible is needed:

  1. Creating layouts where widgets should only take the space they need (loose fit)
  2. Building responsive designs that adapt to content size
  3. Implementing complex flex layouts that mix tight and loose fitting widgets

Current Limitation

// Currently impossible in RFW - only Expanded is available
Column(
  children: [
    Flexible(  // ❌ Not supported
      fit: "loose",
      child: Text(text: "Only takes needed space")
    ),
    Expanded(  // ✅ Supported
      child: Text(text: "Takes all remaining space")
    ),
  ],
)

Proposal

Add Flexible widget support to RFW's core widgets library with the following API:

  • flex: int (default: 1) - The flex factor
  • fit: FlexFit enum ("loose" | "tight", default: "loose") - How the child fills available space
  • child: Widget (required) - The widget below this in the tree

This matches Flutter's native Flexible widget API exactly, ensuring consistency and predictability for developers.

flutter/packages#9750 provides a complete implementation with tests.

Metadata

Metadata

Assignees

Labels

c: new featureNothing broken; request for a new capabilityc: new widgetMust also have "c: new feature". Request for a new widget.c: proposalA detailed proposal for a change to Flutterp: rfwRemote Flutter Widgets packagepackageflutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions