Indexer constructor

Indexer({
  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>[],
})

Implementation

Indexer({
  super.key,
  super.alignment,
  super.textDirection,
  this.reversed = false,
  super.fit,
  super.clipBehavior,
  List<Widget> children = const <Widget>[],
}) : super(
  children: children
    ..sort((Widget a, Widget b) {
      int reverser = reversed ? -1 : 1;
      int aIndex = 1;
      int bIndex = 1;
      if (a is IndexedInterface) {
        aIndex = (a as IndexedInterface).index;
      }
      if (b is IndexedInterface) {
        bIndex = (b as IndexedInterface).index;
      }
      return aIndex - bIndex * reverser;
    }),
);