previousAndNextButtons static method

Widget previousAndNextButtons(
  1. int index,
  2. int lastIndex,
  3. List tours,
  4. Config config,
  5. ScrollController scrollController,
)

Implementation

static Widget previousAndNextButtons(
  int index,
  int lastIndex,
  List<dynamic> tours,
  Config config,
  ScrollController scrollController,
) {
  return Row(
    mainAxisAlignment: MainAxisAlignment.spaceBetween,
    children: [
      GestureDetector(
        onTap: index == 0
            ? null
            : () async {
                final prevKey =
                    config.keys[tours[index - 1]["element"].toString()];
                await scrollToTarget(prevKey, scrollController);
                tutorialCoachMark.previous();
              },
        child: Text(index == 0 ? '' : 'Previous'),
      ),
      GestureDetector(
        onTap: index == lastIndex
            ? null
            : () async {
                final nextKey =
                    config.keys[tours[index + 1]["element"].toString()];
                await scrollToTarget(nextKey, scrollController);
                tutorialCoachMark.next();
              },
        child: Text(index == lastIndex ? '' : 'Next'),
      ),
    ],
  );
}