createPositionedButtons method

Positioned createPositionedButtons(
  1. PadButtonItem padButton,
  2. double actualSize,
  3. int index,
  4. double innerCircleSize,
)

Implementation

Positioned createPositionedButtons(PadButtonItem padButton, double actualSize,
    int index, double innerCircleSize) {
  return Positioned(
    top: _calculatePositionYOfButton(index, innerCircleSize, actualSize),
    left: _calculatePositionXOfButton(index, innerCircleSize, actualSize),
    child: StatefulBuilder(builder: (context, setState) {
      return GestureDetector(
        onTap: () {
          _processGesture(padButton, Gestures.tap);
        },
        onTapUp: (details) {
          _processGesture(padButton, Gestures.tapUp);
          Future.delayed(const Duration(milliseconds: 50), () {
            setState(() => buttonsStateMap![padButton.index!] =
                padButton.backgroundColor!);
          });
        },
        onTapDown: (details) {
          _processGesture(padButton, Gestures.tapDown);

          setState(() =>
              buttonsStateMap![padButton.index!] = padButton.pressedColor!);
        },
        onTapCancel: () {
          _processGesture(padButton, Gestures.tapCancel);

          setState(() => buttonsStateMap![padButton.index!] =
              padButton.backgroundColor!);
        },
        onLongPress: () {
          _processGesture(padButton, Gestures.longPress);
        },
        onLongPressStart: (details) {
          _processGesture(padButton, Gestures.longPressStart);

          setState(() =>
              buttonsStateMap![padButton.index!] = padButton.pressedColor!);
        },
        onLongPressUp: () {
          _processGesture(padButton, Gestures.longPressUp);

          setState(() => buttonsStateMap![padButton.index!] =
              padButton.backgroundColor!);
        },
        child: Padding(
          padding: EdgeInsets.all(buttonsPadding!),
          child: CircleView.padButtonCircle(
              innerCircleSize,
              buttonsStateMap![padButton.index]!,
              padButton.buttonImage!,
              padButton.buttonIcon!,
              padButton.buttonText!),
        ),
      );
    }),
  );
}