Flutter - Fixed position in a bidirectional scroll

2,861

You can wrap your scrollable into a Stack with positioned children to render that fixed position content

new Stack(
  children: [
    myScrollable,
    new Positioned(
      top: .0,
      right: .0,
      bottom: .0,
      child: new Container(width: 42.0, color: Colors.red),
    ),
  ],
)
Share:
2,861
Jesús Martín
Author by

Jesús Martín

Updated on December 04, 2022

Comments

  • Jesús Martín
    Jesús Martín over 1 year

    is there any way I can implement a bidirectional scroll list where a part of it has a fixed position? I mean, for example a table that has a legend in the top for each column, I want to keep that legend when I scroll up/down but I also want it to have functionality with the scroll right/left with the rest of the content. (I know how to implement a bidirectional scroll list, that is not what I am asking for)

  • Jesús Martín
    Jesús Martín about 6 years
    But if I scroll the listview the positioned won't move with it, it will keep its position static, won't it?
  • Rémi Rousselet
    Rémi Rousselet about 6 years
    Yes. That's what a fixed position is in css anyway.
  • Jesús Martín
    Jesús Martín about 6 years
    I was looking for something fixed in a axis but scrollable in the other