puzzle_cube library
An interactive 3D twisty-puzzle cube for Flutter: a pure-Dart 3x3 model with
layer turns, scrambling, validation and solved-state detection, plus a
gesture-driven Cube widget (orbit, tap-to-select and drag-to-turn) built
on the ditredi renderer.
Classes
- Cube
- An interactive 3D cube widget driven by a CubeController.
- CubeColors
- The six sticker colours of a standard cube, plus helpers for snapping, naming and validating colours.
- CubeColorValidator
- Checks whether a cube's colouring could belong to a real, solvable 3x3 cube.
- CubeController
- Drives a Cube widget: owns the cube state, queues animated moves, and tracks the view rotation.
- CubeDrag
- The layer turn a drag-on-the-cube resolves to.
- CubeValidationIssue
- A single problem found while validating a cube's colouring.
- CubeValidationResult
- The outcome of validating a cube: whether it is isValid and the list of issues found.
- CubieBuilder
- Builds the DiTreDi 3D geometry for a single CubieModel: a black body cube plus one coloured plane per visible sticker.
- CubieModel
- One of the 27 small cubes ("cubies") that make up the puzzle.
- PuzzleCubeState
- The full state of a 3x3 cube: its 27 cubies and the operations that turn layers, scramble, serialise and check for a solved state.
Enums
- CubeMove
- A single quarter-turn move in standard cube notation.
- CubeValidationIssueType
- What part of the cube a CubeValidationIssue refers to.
- CubieFace
- The six outward faces of a single cubie, named by the axis they point along.
Extensions
- CubeMoveInverse on CubeMove
- Inverse lookup for CubeMove.
Constants
- kStickersPerColor → const int
- The number of stickers each colour must appear exactly once-per-face times on a 3x3 cube (9).
Functions
-
cubeDragFor(
{required Offset start, required Offset delta, required Size size, required double scale, required double viewRotationX, required double viewRotationY}) → CubeDrag? -
Resolves a drag starting at
start(widget-local) moving bydeltainto the layer turn it should perform, or null if it started off the cube. -
cubeFaceAtTap(
{required Offset tap, required Size size, required double scale, required double viewRotationX, required double viewRotationY}) → CubieFace? -
Returns the front-most cube face under
tap(widget-local coordinates), or null if the tap missed the cube.