Search code examples
flutterflutter-layout

How to force Rows to fill horizontal space in a Positioned Column inside a Stack in flutter?


Here's my widget tree:

Stack(
  children:[
    IrrelevantWidget(),
    Positioned(
      right: 0,
      top: 0,
      child: Container(
        child: Column(
          children: [
            Row(...),
            Row(...),
            Row(...),
            ...

It works fine, but I'd like all the Row() to have the same width as the widest Row(). The Container() containing the Column() has the width of the widest Row(), but I can't find a way to stretch the other Row() to the full width of the Container().

Everything I tried either breaks the view with a paint error or enlarges the Container() to the full width of the screen due to the nature of Stack().

Is it possible?


Solution

  • Wrapping that Column in IntrinsicWidth should expand each Row to the largest of all the children of the Column.