getButtuns method

Widget getButtuns(
  1. BuildContext context
)

Implementation

Widget getButtuns(BuildContext context) {
  final TrainingTheme theme=BlocProvider.of<TrainingBloc>(context).trainingTheme;

  switch (buttunsState) {
    case ButtunsState.start:
      return Row(
        children: [
          Visibility(
            visible: false,
            maintainSize: true,
            maintainAnimation: true,
            maintainState: true,
            child: Button(
              onTap: () {},
              buttonType: ButtonType.prevButton,
              heroTag: "p",
              background: theme.backgroundPrevBtn,
              iconColor: theme.iconColorPrevBtn,
              textColor: theme.textColorStartBtn,
            ),
          ),
          Expanded(child: Container()),
          SizedBox(
            width: 64,
            height: 64,
            child: Button(
              onTap: () {
                BlocProvider.of<TrainingBloc>(context).add(SetEvent(next: true));
              },
              buttonType: ButtonType.textButton,
              text: "start",
              heroTag: "next",
              background: theme.backgroundStartBtn,
              iconColor: theme.iconColorPrevBtn,
              textColor: theme.textColorStartBtn,
            ),
          ),
          Expanded(child: Container()),
          Visibility(
            visible: false,
            maintainSize: true,
            maintainAnimation: true,
            maintainState: true,
            child: Button(
              onTap: () {},
              buttonType: ButtonType.nextButton,
              heroTag: "n",
              background: theme.backgroundNextBtn,
              iconColor: theme.iconColorNextBtn,
              textColor: theme.textColorStartBtn,
            ),
          ),
        ],
      );
    case ButtunsState.back:
      return Row(
        children: [
          Visibility(
            visible: true,
            child: Button(
              onTap: () {
                BlocProvider.of<TrainingBloc>(context).add(SetEvent(next: false));
              },
              buttonType: ButtonType.prevButton,
              text: "back",
              heroTag: "back",
              background: theme.backgroundPrevBtn,
              iconColor: theme.iconColorPrevBtn,
              textColor: theme.textColorStartBtn,
            ),
          ),
          Expanded(child: Container()),
          Expanded(child: Container()),
          Visibility(
            visible: false,
            maintainSize: true,
            maintainAnimation: true,
            maintainState: true,
            child: Button(
              onTap: () {},
              buttonType: ButtonType.nextButton,
              heroTag: "n",
              background: theme.backgroundNextBtn,
              iconColor: theme.iconColorNextBtn,
              textColor: theme.textColorStartBtn,
            ),
          ),
        ],
      );
    case ButtunsState.backAndFinish:
      return Row(
        children: [
          Visibility(
            visible: true,
            child: Button(
              onTap: () {
                BlocProvider.of<TrainingBloc>(context).add(SetEvent(next: false));
              },
              buttonType: ButtonType.prevButton,
              text: "back",
              heroTag: "back",
              background: theme.backgroundPrevBtn,
              iconColor: theme.iconColorPrevBtn,
              textColor: theme.textColorStartBtn,
            ),
          ),
          Expanded(child: Container()),
          SizedBox(
            width: 64,
            height: 64,
            child: Button(
              onTap: () {
                BlocProvider.of<TrainingBloc>(context).add(SetEvent(next: true));
              },
              buttonType: ButtonType.textButton,
              text: "finish",
              heroTag: "finish",
              background: theme.backgroundFinishBtn,
              iconColor: theme.iconColorNextBtn,
              textColor: theme.textColorFinishBtn,
            ),
          ),
          Expanded(child: Container()),
          Visibility(
            visible: false,
            maintainSize: true,
            maintainAnimation: true,
            maintainState: true,
            child: Button(
              onTap: () {},
              buttonType: ButtonType.nextButton,
              heroTag: "n",
              background: theme.backgroundNextBtn,
              iconColor: theme.iconColorNextBtn,
              textColor: theme.textColorStartBtn,
            ),
          ),
        ],
      );
    case ButtunsState.backAndNext:
      return Row(
        children: [
          Visibility(
            visible: true,
            child: Button(
              onTap: () {
                BlocProvider.of<TrainingBloc>(context).add(SetEvent(next: false));
              },
              buttonType: ButtonType.prevButton,
              text: "back",
              heroTag: "back",
              background: theme.backgroundPrevBtn,
              iconColor: theme.iconColorPrevBtn,
              textColor: theme.textColorStartBtn,
            ),
          ),
          Expanded(child: Container()),
          Expanded(child: Container()),
          Visibility(
            visible: true,
            child: Button(
              onTap: () {
                BlocProvider.of<TrainingBloc>(context).add(SetEvent(next: true));
                },
              buttonType: ButtonType.nextButton,
              heroTag: "n",
              background: theme.backgroundNextBtn,
              iconColor: theme.iconColorNextBtn,
              textColor: theme.textColorStartBtn,
            ),
          ),
        ],
      );
    case ButtunsState.backWithTimer:
      return Row(
        children: [
          Visibility(
            visible: true,
            child: Button(
              onTap: () {
                BlocProvider.of<TrainingBloc>(context).add(SetEvent(next: false));
              },
              buttonType: ButtonType.prevButton,
              text: "back",
              heroTag: "back",
              background: theme.backgroundPrevBtn,
              iconColor: theme.iconColorPrevBtn,
              textColor: theme.textColorStartBtn,
            ),
          ),
          Expanded(child: Container()),
          TimerWidget(
              onTap: () {
                BlocProvider.of<TrainingBloc>(context).add(SetEvent(next: true));
              },
              text: "next",
              heroTag: "next",
              showNext: false,
              showProgress: true,
              onTick: (duration){

              },
              duration: duration!,
            background: theme.backgroundProgressTimer,
            textColor: theme.textColorProgressTimer,
            progressColor: theme.progressColorProgressTimer,
            nextTextColor: theme.textColorProgressTimer,
          ),
          Expanded(child: Container()),
          Visibility(
            visible: true,
            child: Button(
              onTap: () {
                BlocProvider.of<TrainingBloc>(context).add(SetEvent(next: true));
              },
              buttonType: ButtonType.nextButton,
              heroTag: "n",
              background: theme.backgroundNextBtn,
              iconColor: theme.iconColorNextBtn,
              textColor: theme.textColorStartBtn,
            ),
          ),
        ],
      );
    case ButtunsState.finish:
      return Row(
        children: [
          Visibility(
            visible: false,
            maintainSize: true,
            maintainAnimation: true,
            maintainState: true,
            child: Button(
              onTap: () {},
              buttonType: ButtonType.prevButton,
              heroTag: "p",
              background: theme.backgroundPrevBtn,
              iconColor: theme.iconColorPrevBtn,
              textColor: theme.textColorStartBtn,
            ),
          ),
          Expanded(child: Container()),
          SizedBox(
            height: 64,
            width: 64,
            child: Button(
              onTap: () {
                BlocProvider.of<TrainingBloc>(context).add(FinishEvent());
              },
              buttonType: ButtonType.textButton,
              text: "finish",
              heroTag: "finish",
              background: theme.backgroundFinishBtn,
              iconColor: theme.iconColorPrevBtn,
              textColor: theme.textColorFinishBtn,
            ),
          ),
          Expanded(child: Container()),
          Visibility(
            visible: false,
            maintainSize: true,
            maintainAnimation: true,
            maintainState: true,
            child: Button(
              onTap: () {},
              buttonType: ButtonType.nextButton,
              heroTag: "n",
              background: theme.backgroundNextBtn,
              iconColor: theme.iconColorNextBtn,
              textColor: theme.textColorStartBtn,
            ),
          ),
        ],
      );
    case ButtunsState.none:
      return Container();
  }
}