Minesweeper (saolei) is an open-source Flutter minesweeper with separate phone-touch, desktop-mouse and browser controls, custom boards, local leaderboards and light and dark themes.
- v1.0.0
- Published at
- 2d ago
- 0
- Stars
- 11
- Download
Latest release
v1.0.0Dec 3, 2026, 10:24 AMREADME
Project Overview
Minesweeper (saolei) turns one click into a reveal, a flood fill and a win-or-lose verdict, all from a single Flutter codebase shared by phone touch, desktop mouse and browser. The board logic sits in lib/logic/, which imports no Flutter at all, so mine placement, chording and score keeping can be unit tested without a widget tree; lib/ui/ only paints cells and forwards events. The interface is Chinese only, with a theme that cycles system, light and dark.
| Item | Value |
|---|---|
| Platform | Android, iOS, Web, Windows, Linux, macOS |
| Stack | Flutter, Dart SDK ^3.12.2 |
| Runtime dependencies | Only shared_preferences and cupertino_icons |
| UI language | Simplified Chinese |
| Storage | SharedPreferences under the saolei. key prefix |
The rules are the old ones; the controls are rebuilt for each platform.
Rules and Gameplay
- Fixed difficulties: beginner 9x9 with 10 mines, intermediate 16x16 with 40, expert 16x30 with 99, plus a landscape 30x16 board with 99
- Custom boards: rows and columns from 5 to 40, mines capped at
rows × cols - 9, which always leaves 9 safe cells - First-click safety: on by default, delaying mine placement until the first click and excluding that cell; it can be switched off in settings
- Blank flood fill: revealing an empty cell spreads outward through a BFS queue
- Chord reveal: on a revealed number whose surrounding flag count matches, one click opens every unmarked neighbour, and hitting a mine still loses
- Three-state marking: hidden, flagged, question, back to hidden, cycled by long press or right click
- Win and loss: clearing every non-mine cell wins; hitting a mine reveals the whole field and tints the mines that were flagged
Key Features
- Single-click mode slider: switch the board between dig and flag semantics, by tapping the icon or swiping left and right
- Timer and counter: the clock starts on the first action and stops at the end, while remaining mines show as total minus flags placed
- Three-state theme: system, light, dark, persisted locally
- Win celebration: one of four randomised animations, showing the time and the rank
- Web adaptation: the browser context menu is suppressed at startup so right click belongs to the board
- Test coverage: 100 random seeds assert that the first click never hits a mine, alongside cases for flood fill, chording, the marking state machine and score ordering
Leaderboards and Storage
Each difficulty keeps its own board, sorted ascending and trimmed to the fastest 10 entries. Custom boards get their own board keyed by size plus mine count, using custom_{rows}x{cols}_{mines}, and appear under a second level of tabs.
| Key | Contents |
|---|---|
saolei.theme.mode |
system / light / dark |
saolei.scores.<storageKey> |
JSON array of scores for that board |
saolei.custom.config |
Last custom parameters, as rows,cols,mines |
saolei.custom.boards |
Custom boards used so far, de-duplicated in first-use order |
Runtime
| Item | Requirement |
|---|---|
| OS | Android, iOS, Web, Windows, Linux, macOS |
| Toolchain | Flutter SDK with Dart ^3.12.2 |
| Build targets | flutter build apk, flutter build web, flutter build windows |
flutter pub get
flutter run -d chrome
flutter testNotes
- No multiplayer and no cloud sync: scores stay in local SharedPreferences and do not follow you to another device
- Question marks ignore taps: a cell marked as a question only responds to long press or right click to cycle back to hidden
- Custom boards are capped: saving is refused when rows or columns exceed 40 or mines exceed
rows × cols - 9 - No licence file in the repo: there is no LICENSE at the root, so confirm terms with the author before redistributing or shipping commercially