addHorizontalOverlays method

void addHorizontalOverlays(
  1. Size size
)

Implementation

void addHorizontalOverlays(Size size) {
  overlays.addEntry('horizontalController', (_, game) {
    return Stack(
      children: [
        Positioned(
          top: 0,
          right: 0,
          child: ConstrainedBox(
            constraints: BoxConstraints(
              maxWidth: size.width,
              maxHeight: options.horizontalControllerHeight,
            ),
            child: SingleChildScrollView(
              scrollDirection: Axis.horizontal,
              child: Row(
                children: [
                  ...(algorithm.horizontalOverlays(
                        world: world,
                        rootAlg: algorithm,
                        graphComponent: this,
                      ) ??
                      []),
                  if (algorithm
                          .verticalOverlays(
                              world: world,
                              rootAlg: algorithm,
                              graphComponent: this)
                          ?.isNotEmpty ==
                      true)
                    IconButton(
                      onPressed: () {
                        if (overlays.activeOverlays
                            .contains('verticalController')) {
                          overlays.remove('verticalController');
                        } else {
                          if (overlays.activeOverlays
                              .contains('vertexTapUpPanel')) {
                            overlays.remove('vertexTapUpPanel');
                          }
                          overlays.add('verticalController');
                        }
                      },
                      icon: const Icon(Icons.tune),
                    ),
                ],
              ),
            ),
          ),
        )
      ],
    );
  });
  overlays.add('horizontalController');
}