Indexer.shadow constructor

Indexer.shadow({
  1. Key? key,
  2. AlignmentGeometry alignment = AlignmentDirectional.topStart,
  3. TextDirection? textDirection,
  4. bool reversed = false,
  5. StackFit fit = StackFit.loose,
  6. Clip clipBehavior = Clip.hardEdge,
  7. List<Widget> children = const <Widget>[],
  8. List<int> shadow = const <int>[],
})

use shadow list to sort items

Implementation

Indexer.shadow({
  super.key,
  super.alignment,
  super.textDirection,
  this.reversed = false,
  super.fit,
  super.clipBehavior,
  List<Widget> children = const <Widget>[],
  List<int> shadow = const <int>[],
})  : assert(shadow.length == children.length),
      super(
        children: children
          ..sort((Widget a, Widget b) {
            int _reverser = reversed ? -1 : 1;
            return shadow[children.indexOf(a)] -
                shadow[children.indexOf(b)] * _reverser;
          }),
      );