Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draw and win time - timer bug #5

Open
yagizdo opened this issue Aug 18, 2022 · 2 comments
Open

Draw and win time - timer bug #5

yagizdo opened this issue Aug 18, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@yagizdo
Copy link
Owner

yagizdo commented Aug 18, 2022

If someone wins or draws, the game stops, but the timer works again. But the timer should not work either.

@yagizdo yagizdo added the bug Something isn't working label Aug 18, 2022
@PoonamDevmurariTatva
Copy link

Got the solution, Do some changes as below

add/update in below files

1) navigation_service

void navigateToFirst() {
return Navigator.of(navigatorKey.currentContext!).popUntil((route) => route.isFirst);
}

2)game_view_model

@action
void quitGame(bool isDialog) {
resetGame();
if(isDialog){
_navigationService.navigateToFirst();
}
_navigationService.navigateTo(Routes.homeViewRoute);
}

3) game_dialog_quit_button

@OverRide
Widget build(BuildContext context) {
return SizedBox(
width: 126.w,
height: 40.h,
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
red,
),
elevation: MaterialStateProperty.all(0),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
),
onPressed: () {
_gameViewModel.quitGame(true);

    },
    child: Row(
      children: [
        const Icon(Icons.close),
        width5,
        Text(
          'Quit',
          style: Theme.of(context).textTheme.labelSmall,
        ),
      ],
    ),
  ),
);

}

4) quit_button

@OverRide
Widget build(BuildContext context) {
return SizedBox(
width: 100.w,
height: 40.h,
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
purple.withOpacity(0.5),
),
elevation: MaterialStateProperty.all(0),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
),
onPressed: () {
_gameViewModel.quitGame(false);
},
child: Row(
children: [
const Icon(Icons.close),
width9,
const Text('Quit'),
],
),
),
);
}

@yagizdo
Copy link
Owner Author

yagizdo commented Aug 28, 2023

Thank you for your answer.

I tried the answer you said but it is not fixed. In case I missed something,I created a new branch and pushed the added version of the code you said.

Commit: 4b4e5cd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants