flutter reorderable Stack

Viewed 25

Is it possible to create with package reorderables: ^0.5.0 a ReorderableStack instead of a ReorderableRow?

My aim is to build playing cards which are reorderable and overlapping each other. I tried to use the widgetList below as children of ReoderableRow but its not possible to overlap the two Stacks...

    widgetList = [
      Container(
        key: const ValueKey('1'),
        width: 200,
        height: 200,
        color: Colors.green,
        child: Stack(
          key: const ValueKey('1'),
          children: [
            Positioned(
              key: const ValueKey('1'),
              child: Container(
                key: const ValueKey('1'),
              ),
            ),
          ],
        ),
      ),
      Container(
        key: const ValueKey('2'),
        width: 200,
        height: 200,
        color: Colors.red,
        child: Stack(
          key: const ValueKey('2'),
          children: [
            Positioned(
              width: 200,
              height: 200,
              key: const ValueKey('2'),
              left: -50,
              child: Container(
                color: Colors.black,
                key: const ValueKey('2'),
              ),
            ),
          ],
        ),
      ),
    ];

1 Answers

You could use Stack also for the two Container elements of your list (so you get a Stack of two Stacks). Alternatively, consider using the Positioned widget

Related