stage

Build arbitrarily complex layout with imperative code.

Getting Started


import 'package:stage/stage.dart';

/// use Stage widget in your widget: 

Widget build(BuildContext context) {
    return Stage<int>(
        itemBuilder: (context, int layer) {
          return Text('$layer',
              textDirection: TextDirection.ltr, key: Key('$layer'));
        },
        stageBuilder: (constraints, selectItem) {
          final List<RenderBox> items = [
            selectItem(1),
            selectItem(2),
            selectItem(3),
          ];

          items.forEach((item) => item.layout(constraints));

          final data =
              items.map((item) => item.parentData as StageParentData).toList();

          data[0].offset = Offset(10, 10);
          data[1].offset = Offset(20, 20);
          data[2].offset = Offset(30, 30);

          return constraints.biggest;
        },
    );
}

Stage will render 3 Text widgets, with corresponding offset.

Libraries

stage