Skip to content

Comments

feat: implement scoreboard#68

Closed
NonymousMorlock wants to merge 14 commits intoagtrlabs:mainfrom
NonymousMorlock:main
Closed

feat: implement scoreboard#68
NonymousMorlock wants to merge 14 commits intoagtrlabs:mainfrom
NonymousMorlock:main

Conversation

@NonymousMorlock
Copy link
Collaborator

Description

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

NonymousMorlock and others added 14 commits October 23, 2025 20:56
The `ViewModelInstance` and `ViewModelInstanceString` are now stored as instance variables in the `_GameButtonState`. This change allows for their proper disposal in the `dispose` method, preventing potential memory leaks by clearing listeners and disposing of the view model instance when the widget is removed from the tree.
The method for setting the text value on the Rive artboard has been updated. The deprecated direct `artboard.setText()` method has been replaced with data binding using `viewModelInstance.string('buttonText')?.value`. This aligns with modern Rive data binding practices.
This commit refactors the `Hint` widget to use Rive's ViewModel API for more efficient state management of the animation.

Key changes include:
*   Replaced direct `StateMachine` controllers with `ViewModelInstance`.
*   Bound animation properties (`isLightOn`, `isDarkTheme`, `hintCount`, `textColour`) directly to the ViewModel.
*   Simplified the widget tree by removing the explicit `Text` for the hint count and integrating it into the Rive animation itself.
*   Removed the now-redundant `Row` and `Baseline` widgets.
…clude a hint count as part of the animation itself
The method for loading Rive assets has been updated from `rootBundle.load` to the recommended `File.asset`. This change simplifies the code by removing manual decoding of `Uint8List` and aligns with current best practices for the Rive library. Additionally, the unused `flutter/services.dart` import has been removed.
The `GamePlayBoard` widget was converted from a `StatelessWidget` to a `StatefulWidget`. This change allows for the proper management of the `GridBoardController`'s lifecycle.

The controller is now initialized in `initState` and disposed of in `dispose`, preventing potential memory leaks and ensuring it is correctly handled within the widget's state.
A new `Scorecard` widget, built with Rive, has been introduced to display game statistics like the current level and failed attempts. This animated widget replaces the simple text title in the `GamePlayHeader`.

The `GamePlayHeader` is now responsive, showing a different layout for mobile and desktop screens. Additionally, the `GamePlayPage` has been updated to include a bottom border on the header for better visual separation.
The `Scorecard` widget has been refactored to utilize a Rive state machine for managing its appearance and layout, including dark mode awareness and responsiveness.

Key changes include:
- Removing manual color properties and instead controlling the theme via a `isDarkMode` boolean input in the Rive state machine.
- Implementing responsive layouts for narrow and wide screens by adjusting Rive state machine enums.
- Updating `GamePlayHeader` to support the refactored `Scorecard` and improve its layout for different screen sizes.
- Removing a redundant `DecoratedBox` from `GamePlayPage`.
A new test file has been created for the `Scorecard` widget to ensure it renders correctly. The test provides a mock `ThemeCubit` and verifies that a single `Scorecard` widget is found on the screen.
The CI build was failing during the test phase with an error indicating that the Rive native library (`librive_native_plugin.so`) could not be found. This was caused by the absence of required system libraries for Rive on the GitHub Actions Linux runner.

This commit updates the `main.yaml` workflow to install the necessary Mesa OpenGL libraries (`libgl1-mesa-glx` and `libegl1-mesa-dev`) before running the tests. This resolves the native library loading issue and allows Rive-dependent tests to pass in the CI environment.
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.

1 participant