Flutter Stack size to sibling

I had the same issue and finally managed to solve it using this answer:

Inside your Stack, you should wrap your background widget in a Positioned.fill.

return new Stack(
  children: <Widget>[
    new Positioned.fill(
      child: background,
    ),
    foreground,
  ],
);

— Mary, https://stackoverflow.com/a/45745479

Applying that to your question results in the following:

Stack(
  children: <Widget>[
    ListTile(
      leading: AssetImage('foo.jpg'),
      title: Text('Bar'),
      subtitle: Text('yipeee'),
      isThreeLine: true,
    ),
    Positioned.fill(
      child: Container(color: Colors.grey, child: Text('foo')),
    ),
  ],
),

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)