Skip to content

Conversation

@MunibullahShah
Copy link

@MunibullahShah MunibullahShah commented Jun 4, 2025

@veloce
Copy link
Contributor

veloce commented Jun 4, 2025

There is already a WakeLock widget. You should use it, no need to create one.

Also game screen is already keeping screen on (contrary to what the issue says...), so no need to modify game screen.
Happens here:

child: WakelockWidget(

(admitedly it would be better if it was on game screen, it could be changed);

@MunibullahShah
Copy link
Author

Removed the services created and used the already-made widget.
Also moved the Wakelock from GameBody to GameScreen with the condition if the loadedGame !=null


actions: [if (loadedGame != null) _GameMenu(gameId: loadedGame.gameId)],
return WakelockWidget(
shouldEnableOnFocusGained: () => loadedGame != null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that it is not the condition we want.

Before it was:

shouldEnableOnFocusGained: () => gameState.game.playable,

So I think you should revert the changes on game_body.dart and game_screen.dart.

Copy link
Contributor

@veloce veloce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code formatting is wrong for game_screen.dart; you can fix it by running dart format lib/src

final _whiteClockKey = GlobalKey(debugLabel: 'whiteClockOnTvScreen');
final _blackClockKey = GlobalKey(debugLabel: 'blackClockOnTvScreen');

@override
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code does nothing, it can be removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if the comment was not placed on the good line.

This is useful:

final _whiteClockKey = GlobalKey(debugLabel: 'whiteClockOnTvScreen');
  final _blackClockKey = GlobalKey(debugLabel: 'blackClockOnTvScreen');

This is useless:

@override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

final _blackClockKey = GlobalKey(debugLabel: 'blackClockOnGameScreen');
final _boardKey = GlobalKey(debugLabel: 'boardOnGameScreen');

@override
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove that

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are being used in GameBody where the comments says that these variables are being used to preserve state if orientation changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant the empty initState and dispose; they are useless here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, removing it now :)

@MunibullahShah
Copy link
Author

@veloce any update on this?

@MunibullahShah
Copy link
Author

MunibullahShah commented Jun 15, 2025

@veloce removed the code in both files

userId: widget.user?.id,
);

final _whiteClockKey = GlobalKey(debugLabel: 'whiteClockOnTvScreen');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay.
I still cannot accept the PR because these keys are removed where they should be kept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants