Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 28-add-high-scores
  • 29-use-real-board-painter-to-draw-parameters-items
  • 32-add-block-size-limit-parameter
  • 39-improve-app-metadata
  • master
  • Release_0.0.10_10
  • Release_0.0.11_11
  • Release_0.0.12_12
  • Release_0.0.13_13
  • Release_0.0.14_14
  • Release_0.0.15_15
  • Release_0.0.16_16
  • Release_0.0.17_17
  • Release_0.0.18_18
  • Release_0.0.19_19
  • Release_0.0.1_1
  • Release_0.0.20_20
  • Release_0.0.21_21
  • Release_0.0.22_22
  • Release_0.0.23_23
  • Release_0.0.24_24
  • Release_0.0.25_25
  • Release_0.0.26_26
  • Release_0.0.27_27
  • Release_0.0.28_28
  • Release_0.0.29_29
  • Release_0.0.2_2
  • Release_0.0.30_30
  • Release_0.0.31_31
  • Release_0.0.3_3
  • Release_0.0.4_4
  • Release_0.0.5_5
  • Release_0.0.6_6
  • Release_0.0.7_7
  • Release_0.0.8_8
  • Release_0.0.9_9
  • Release_0.1.0_32
  • Release_0.1.1_33
  • Release_0.2.0_34
  • Release_0.2.1_35
  • Release_0.3.0_36
  • Release_0.3.1_37
  • Release_0.4.0_38
  • Release_0.4.1_39
  • Release_0.4.2_40
  • Release_0.5.0_41
  • Release_0.6.0_42
  • Release_0.7.0_43
  • Release_0.8.0_44
  • Release_0.8.1_45
  • Release_0.8.2_46
  • Release_0.9.0_47
  • Release_0.9.1_48
53 results

Target

Select target project
  • android/org.benoitharrault.jeweled
1 result
Select Git revision
  • 28-add-high-scores
  • 29-use-real-board-painter-to-draw-parameters-items
  • 32-add-block-size-limit-parameter
  • 39-improve-app-metadata
  • master
  • Release_0.0.10_10
  • Release_0.0.11_11
  • Release_0.0.12_12
  • Release_0.0.13_13
  • Release_0.0.14_14
  • Release_0.0.15_15
  • Release_0.0.16_16
  • Release_0.0.17_17
  • Release_0.0.18_18
  • Release_0.0.19_19
  • Release_0.0.1_1
  • Release_0.0.20_20
  • Release_0.0.21_21
  • Release_0.0.22_22
  • Release_0.0.23_23
  • Release_0.0.24_24
  • Release_0.0.25_25
  • Release_0.0.26_26
  • Release_0.0.27_27
  • Release_0.0.28_28
  • Release_0.0.29_29
  • Release_0.0.2_2
  • Release_0.0.30_30
  • Release_0.0.31_31
  • Release_0.0.3_3
  • Release_0.0.4_4
  • Release_0.0.5_5
  • Release_0.0.6_6
  • Release_0.0.7_7
  • Release_0.0.8_8
  • Release_0.0.9_9
  • Release_0.1.0_32
  • Release_0.1.1_33
  • Release_0.2.0_34
  • Release_0.2.1_35
  • Release_0.3.0_36
  • Release_0.3.1_37
  • Release_0.4.0_38
  • Release_0.4.1_39
  • Release_0.4.2_40
  • Release_0.5.0_41
  • Release_0.6.0_42
  • Release_0.7.0_43
  • Release_0.8.0_44
  • Release_0.8.1_45
  • Release_0.8.2_46
  • Release_0.9.0_47
  • Release_0.9.1_48
53 results
Show changes
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:jeweled/cubit/game_cubit.dart';
import 'package:jeweled/ui/widgets/game.dart';
import 'package:jeweled/ui/widgets/parameters.dart';
class ScreenGame extends StatelessWidget {
const ScreenGame({super.key});
@override
Widget build(BuildContext context) {
return Material(
color: Theme.of(context).colorScheme.background,
child: Column(
children: <Widget>[
const SizedBox(height: 8),
BlocBuilder<GameCubit, GameState>(
builder: (BuildContext context, GameState gameState) {
return gameState.currentGame.isRunning ? const GameWidget() : const Parameters();
},
),
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:jeweled/ui/screens/game.dart';
import 'package:jeweled/ui/widgets/global_app_bar.dart';
class SkeletonScreen extends StatelessWidget {
const SkeletonScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: GlobalAppBar(),
extendBodyBehindAppBar: false,
body: ScreenGame(),
backgroundColor: Theme.of(context).colorScheme.background,
);
}
}
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
class AppTitle extends StatelessWidget {
const AppTitle({super.key, required this.text});
final String text;
@override
Widget build(BuildContext context) {
return Text(
tr(text),
textAlign: TextAlign.start,
style: Theme.of(context).textTheme.headlineLarge!.apply(fontWeightDelta: 2),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:jeweled/cubit/game_cubit.dart';
import 'package:jeweled/models/game.dart';
import 'package:jeweled/ui/widgets/game_board.dart';
import 'package:jeweled/ui/widgets/game_bottom_buttons.dart';
import 'package:jeweled/ui/widgets/game_top_indicator.dart';
class GameWidget extends StatelessWidget {
const GameWidget({super.key});
@override
Widget build(BuildContext context) {
return BlocBuilder<GameCubit, GameState>(
builder: (BuildContext context, GameState gameState) {
final Game currentGame = gameState.currentGame;
return Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 8),
const GameTopIndicatorWidget(),
const SizedBox(height: 2),
const GameBoard(),
const SizedBox(height: 2),
currentGame.isFinished ? const GameBottomButtonsWidget() : const SizedBox.shrink(),
],
);
},
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:jeweled/cubit/game_cubit.dart';
import 'package:jeweled/models/game.dart';
import 'package:jeweled/models/cell_location.dart';
import 'package:jeweled/ui/painters/game_board_painter.dart';
class GameBoard extends StatelessWidget {
const GameBoard({super.key});
@override
Widget build(BuildContext context) {
final double displayWidth = MediaQuery.of(context).size.width;
return Center(
child: BlocBuilder<GameCubit, GameState>(
builder: (BuildContext context, GameState gameState) {
final Game currentGame = gameState.currentGame;
return GestureDetector(
onTapUp: (details) {
double xTap = details.localPosition.dx;
double yTap = details.localPosition.dy;
int col = xTap ~/ (displayWidth / currentGame.settings.boardSize);
int row = yTap ~/ (displayWidth / currentGame.settings.boardSize);
final GameCubit gameCubit = BlocProvider.of<GameCubit>(context);
gameCubit.tapOnCell(CellLocation.go(row, col));
},
child: CustomPaint(
size: Size(displayWidth, displayWidth),
willChange: false,
painter: GameBoardPainter(currentGame),
isComplex: true,
),
);
},
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:jeweled/cubit/game_cubit.dart';
class GameBottomButtonsWidget extends StatelessWidget {
const GameBottomButtonsWidget({super.key});
@override
Widget build(BuildContext context) {
String decorationImageAssetName = 'assets/icons/game_fail.png';
Widget decorationWidget = TextButton(
child: Image(
image: AssetImage(decorationImageAssetName),
fit: BoxFit.fill,
),
onPressed: () => null,
);
return Container(
child: Table(
defaultColumnWidth: IntrinsicColumnWidth(),
children: [
TableRow(
children: [
Column(
children: [decorationWidget],
),
Column(
children: [
TextButton(
child: Image(
image: AssetImage('assets/icons/button_back.png'),
fit: BoxFit.fill,
),
onPressed: () {
final GameCubit gameCubit = BlocProvider.of<GameCubit>(context);
gameCubit.quitGame();
},
)
],
),
Column(
children: [decorationWidget],
),
],
),
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:jeweled/cubit/game_cubit.dart';
import 'package:jeweled/models/game.dart';
class GameTopIndicatorWidget extends StatelessWidget {
const GameTopIndicatorWidget({super.key});
@override
Widget build(BuildContext context) {
const Color scoreTextColor = Colors.white;
const Color movesCountTextColor = Colors.grey;
const Color availableBlocksCountTextColor = Colors.green;
const double scoreFontSize = 40;
const double movesCountFontSize = 15;
const double availableBlocksCountFontSize = 20;
return BlocBuilder<GameCubit, GameState>(
builder: (BuildContext context, GameState gameState) {
final Game currentGame = gameState.currentGame;
return Table(
children: [
TableRow(
children: [
Column(
children: [
Text(
currentGame.score.toString(),
style: const TextStyle(
fontSize: scoreFontSize,
fontWeight: FontWeight.w600,
color: scoreTextColor,
),
),
Text(
currentGame.movesCount.toString(),
style: const TextStyle(
fontSize: movesCountFontSize,
fontWeight: FontWeight.w600,
color: movesCountTextColor,
),
),
],
),
Column(
children: [
Text(
currentGame.availableBlocksCount.toString(),
style: const TextStyle(
fontSize: availableBlocksCountFontSize,
fontWeight: FontWeight.w600,
color: availableBlocksCountTextColor,
),
),
],
),
],
),
],
);
},
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:jeweled/cubit/game_cubit.dart';
import 'package:jeweled/models/game.dart';
import 'package:jeweled/ui/widgets/app_titles.dart';
class GlobalAppBar extends StatelessWidget implements PreferredSizeWidget {
const GlobalAppBar({super.key});
@override
Widget build(BuildContext context) {
return BlocBuilder<GameCubit, GameState>(
builder: (BuildContext context, GameState gameState) {
final Game currentGame = gameState.currentGame;
final List<Widget> menuActions = [];
if (currentGame.isRunning) {
menuActions.add(TextButton(
child: Container(
child: Image(
image: AssetImage('assets/icons/button_back.png'),
fit: BoxFit.fill,
),
),
onPressed: () => null,
onLongPress: () {
final GameCubit gameCubit = BlocProvider.of<GameCubit>(context);
gameCubit.quitGame();
},
));
}
return AppBar(
title: const AppTitle(text: 'app_name'),
actions: menuActions,
);
},
);
}
@override
Size get preferredSize => const Size.fromHeight(50);
}
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:jeweled/config/default_game_settings.dart';
import 'package:jeweled/cubit/game_cubit.dart';
import 'package:jeweled/cubit/settings_cubit.dart';
import 'package:jeweled/models/game_settings.dart';
class Parameters extends StatelessWidget {
const Parameters({super.key});
static const double separatorHeight = 2.0;
static const double blockMargin = 3.0;
static const double blockPadding = 2.0;
static const Color buttonBackgroundColor = Colors.white;
static const Color buttonBorderColorActive = Colors.blue;
static const Color buttonBorderColorInactive = Colors.white;
static const double buttonBorderWidth = 10.0;
static const double buttonBorderRadius = 8.0;
static const double buttonPadding = 0.0;
static const double buttonMargin = 0.0;
@override
Widget build(BuildContext context) {
return BlocBuilder<SettingsCubit, SettingsState>(
builder: (BuildContext context, SettingsState settingsState) {
final GameCubit gameCubit = BlocProvider.of<GameCubit>(context);
final SettingsCubit settingsCubit = BlocProvider.of<SettingsCubit>(context);
final List<Widget> lines = [];
DefaultGameSettings.availableParameters.forEach((code) {
final List<dynamic> availableValues = DefaultGameSettings.getAvailableValues(code);
if (availableValues.length > 1) {
final List<Widget> parameterButtons = [];
final dynamic currentValue = settingsCubit.getParameterValue(code);
availableValues.forEach((value) {
final bool isActive = (value == currentValue);
final String imageAsset = code + '_' + value.toString();
final Widget parameterButton = TextButton(
child: Container(
margin: EdgeInsets.all(buttonMargin),
padding: EdgeInsets.all(buttonPadding),
decoration: BoxDecoration(
color: buttonBackgroundColor,
borderRadius: BorderRadius.circular(buttonBorderRadius),
border: Border.all(
color: isActive ? buttonBorderColorActive : buttonBorderColorInactive,
width: buttonBorderWidth,
),
),
child: buildImageWidget(imageAsset),
),
onPressed: () => settingsCubit.setParameterValue(code, value),
);
parameterButtons.add(parameterButton);
});
lines.add(Table(
defaultColumnWidth: IntrinsicColumnWidth(),
children: [
TableRow(
children: parameterButtons,
),
],
));
lines.add(SizedBox(height: separatorHeight));
}
});
return Container(
child: Column(
children: [
SizedBox(height: separatorHeight),
Column(
children: lines,
),
SizedBox(height: separatorHeight),
buildStartNewGameButton(gameCubit, settingsState.settings),
],
),
);
},
);
}
static Image buildImageWidget(String imageAssetCode) {
return Image(
image: AssetImage('assets/icons/' + imageAssetCode + '.png'),
fit: BoxFit.fill,
);
}
static Container buildImageContainerWidget(String imageAssetCode) {
return Container(
child: buildImageWidget(imageAssetCode),
);
}
static Column buildDecorationImageWidget() {
return Column(
children: [
TextButton(
child: buildImageContainerWidget('placeholder'),
onPressed: () => null,
),
],
);
}
static Container buildStartNewGameButton(GameCubit gameCubit, GameSettings settings) {
return Container(
margin: EdgeInsets.all(blockMargin),
padding: EdgeInsets.all(blockPadding),
child: Table(
defaultColumnWidth: IntrinsicColumnWidth(),
children: [
TableRow(
children: [
buildDecorationImageWidget(),
Column(
children: [
TextButton(
child: buildImageContainerWidget('button_start'),
onPressed: () => gameCubit.startNewGame(settings),
),
],
),
buildDecorationImageWidget(),
],
),
],
),
);
}
}
import 'dart:math';
import 'package:jeweled_game/entities/cell.dart';
import 'package:jeweled_game/provider/data.dart';
class BoardUtils {
static printGrid(List cells) {
print('');
print('-------');
for (var rowIndex = 0; rowIndex < cells.length; rowIndex++) {
String row = '';
for (var colIndex = 0; colIndex < cells[rowIndex].length; colIndex++) {
row += cells[rowIndex][colIndex].value;
}
print(row);
}
print('-------');
print('');
}
static createNewBoard(Data myProvider) {
int boardSizeHorizontal = myProvider.sizeHorizontal;
int boardSizeVertical = myProvider.sizeVertical;
int maxValue = myProvider.colorsCount;
var rand = new Random();
List<List<Cell>> grid = [];
for (var rowIndex = 0; rowIndex < boardSizeVertical; rowIndex++) {
List<Cell> row = [];
for (var colIndex = 0; colIndex < boardSizeHorizontal; colIndex++) {
int value = 1 + rand.nextInt(maxValue);
row.add(Cell(value.toString()));
}
grid.add(row);
}
printGrid(grid);
myProvider.resetGame();
myProvider.updateCells(grid);
myProvider.updateAvailableBlocksCount(getAvailableBlocks(myProvider).length);
}
// static List createBoardFromSavedState(Data myProvider, String savedBoard) {
// List<List<Cell?>> board = [];
// int boardSize = pow((savedBoard.length / 6), 1 / 2).round();
// String boardSizeAsString = boardSize.toString() + 'x' + boardSize.toString();
// myProvider.updateParameterSize(boardSizeAsString);
// int index = 0;
// for (var rowIndex = 0; rowIndex < boardSize; rowIndex++) {
// List<Cell?> row = [];
// for (var colIndex = 0; colIndex < boardSize; colIndex++) {
// String value = savedBoard[index++];
// Cell cell = Cell(value);
// row.add(cell);
// }
// board.add(row);
// }
// printGrid(board);
// return board;
// }
static List<List<int>> getSiblingCells(
Data myProvider, row, col, List<List<int>> siblingCells) {
int boardSizeHorizontal = myProvider.sizeHorizontal;
int boardSizeVertical = myProvider.sizeVertical;
String referenceValue = myProvider.getCellValue(row, col);
for (var deltaRow = -1; deltaRow <= 1; deltaRow++) {
for (var deltaCol = -1; deltaCol <= 1; deltaCol++) {
if (deltaCol == 0 || deltaRow == 0) {
int candidateRow = row + deltaRow;
int candidateCol = col + deltaCol;
if ((candidateRow >= 0 && candidateRow < boardSizeVertical) &&
(candidateCol >= 0 && candidateCol < boardSizeHorizontal)) {
if (myProvider.getCellValue(candidateRow, candidateCol) == referenceValue) {
bool alreadyFound = false;
for (var index = 0; index < siblingCells.length; index++) {
if ((siblingCells[index][0] == candidateRow) &&
(siblingCells[index][1] == candidateCol)) {
alreadyFound = true;
}
}
if (!alreadyFound) {
siblingCells.add([candidateRow, candidateCol]);
siblingCells =
getSiblingCells(myProvider, candidateRow, candidateCol, siblingCells);
}
}
}
}
}
}
return siblingCells;
}
static List getAvailableBlocks(Data myProvider) {
int boardSizeHorizontal = myProvider.sizeHorizontal;
int boardSizeVertical = myProvider.sizeVertical;
List blocks = [];
for (var row = 0; row < boardSizeVertical; row++) {
for (var col = 0; col < boardSizeHorizontal; col++) {
if (myProvider.getCellValue(row, col) != '0') {
// if current cell not already in a found block
bool alreadyFound = false;
blocks.forEach((foundBlock) {
foundBlock.forEach((foundBlockCell) {
if ((foundBlockCell[0] == row) && (foundBlockCell[1] == col)) {
alreadyFound = true;
}
});
});
if (!alreadyFound) {
List<List<int>> block = getSiblingCells(myProvider, row, col, []);
if (block.length >= 3) {
blocks.add(block);
}
}
}
}
}
return blocks;
}
static bool checkBoardIsBlocked(Data myProvider) {
int boardSizeHorizontal = myProvider.sizeHorizontal;
int boardSizeVertical = myProvider.sizeVertical;
for (var row = 0; row < boardSizeVertical; row++) {
for (var col = 0; col < boardSizeHorizontal; col++) {
if (myProvider.getCellValue(row, col) != '0') {
List<List<int>> block = getSiblingCells(myProvider, row, col, []);
if (block.length >= 3) {
// found one block => ok, not locked
return false;
}
}
}
}
print('Board is locked');
return true;
}
static bool isInBoard(Data myProvider, int row, int col) {
if (row > 0 &&
row < myProvider.sizeHorizontal &&
col > 0 &&
col < myProvider.sizeVertical) {
return true;
}
return false;
}
static String getFillValue(Data myProvider, int row, int col) {
// build a list of values to pick one
List<String> values = [];
// All eligible values
int maxValue = myProvider.colorsCount;
for (int i = 1; i <= maxValue; i++) {
values.add(i.toString());
}
// Add values of current col
for (int r = 0; r <= myProvider.sizeVertical; r++) {
if (isInBoard(myProvider, r, col)) {
String value = myProvider.getCellValue(r, col);
if (value != '0') {
values.add(value);
}
}
}
// Add values of sibling cols
for (int deltaCol = -1; deltaCol <= 1; deltaCol++) {
int c = col + deltaCol;
for (int r = 0; r < myProvider.sizeVertical; r++) {
if (isInBoard(myProvider, r, c)) {
String value = myProvider.getCellValue(r, c);
if (value != '0') {
values.add(value);
}
}
}
}
// Add values of sibling cells
for (int deltaCol = -2; deltaCol <= 2; deltaCol++) {
int c = col + deltaCol;
for (int deltaRow = -2; deltaRow <= 2; deltaRow++) {
int r = row + deltaRow;
if (isInBoard(myProvider, r, c)) {
String value = myProvider.getCellValue(r, c);
if (value != '0') {
values.add(value);
}
}
}
}
// Pick random value from "ponderated" list
return values[Random().nextInt(values.length)];
}
static moveCellsDown(Data myProvider) {
int boardSizeHorizontal = myProvider.sizeHorizontal;
int boardSizeVertical = myProvider.sizeVertical;
for (int row = 0; row < boardSizeVertical; row++) {
for (int col = 0; col < boardSizeHorizontal; col++) {
if (myProvider.getCellValue(row, col) == '0') {
for (int r = row; r > 0; r--) {
myProvider.updateCellValue(col, r, myProvider.getCellValue(r - 1, col));
}
myProvider.updateCellValue(col, 0, getFillValue(myProvider, row, col));
}
}
}
}
static deleteCell(Data myProvider, int row, int col) {
myProvider.updateCellValue(col, row, '0');
}
static void deleteBlock(Data myProvider, List<List<int>> block) {
// Sort cells from top to bottom
block.sort((cell1, cell2) => cell1[0].compareTo(cell2[0]));
// Delete all cells
block.forEach((element) {
deleteCell(myProvider, element[0], element[1]);
});
// Gravity!
moveCellsDown(myProvider);
}
static int getScoreFromBlock(int blockSize) {
return 3 * (blockSize - 2);
}
static void tapOnCell(Data myProvider, int row, int col) {
String cellValue = myProvider.getCellValue(row, col);
print('Tap on cell[' + col.toString() + '][' + row.toString() + ']: ' + cellValue);
if (cellValue != '0') {
List<List<int>> block = getSiblingCells(myProvider, row, col, []);
if (block.length >= 3) {
deleteBlock(myProvider, block);
myProvider.increaseMovesCount();
myProvider.increaseScore(block.length);
myProvider.updateAvailableBlocksCount(getAvailableBlocks(myProvider).length);
}
}
if (checkBoardIsBlocked(myProvider)) {
myProvider.updateGameIsFinished(true);
}
}
}
import 'dart:ui';
extension ColorExtension on Color {
Color darken([int percent = 40]) {
assert(1 <= percent && percent <= 100);
final value = 1 - percent / 100;
return Color.fromARGB(
alpha,
(red * value).round(),
(green * value).round(),
(blue * value).round(),
);
}
Color lighten([int percent = 40]) {
assert(1 <= percent && percent <= 100);
final value = percent / 100;
return Color.fromARGB(
alpha,
(red + ((255 - red) * value)).round(),
(green + ((255 - green) * value)).round(),
(blue + ((255 - blue) * value)).round(),
);
}
Color avg(Color other) {
final red = (this.red + other.red) ~/ 2;
final green = (this.green + other.green) ~/ 2;
final blue = (this.blue + other.blue) ~/ 2;
final alpha = (this.alpha + other.alpha) ~/ 2;
return Color.fromARGB(alpha, red, green, blue);
}
}
import 'package:flutter/material.dart';
class ColorTheme {
static Map<String, List<int>> itemColors = {
'default': [
0xffffff,
0xe63a3f,
0x708cfd,
0x359c35,
0xffce2c,
0xff6f43,
0xa13cb1,
0x38ffff,
0xf2739d,
],
};
static int defaultItemColor = 0x808080;
static int getColorCode(int? value) {
const skin = 'default';
if (value != null && itemColors.containsKey(skin) && null != itemColors[skin]) {
List<int> skinColors = itemColors[skin] ?? [];
if (skinColors.length > value) {
return (skinColors[value]) | 0xFF000000;
}
}
return defaultItemColor | 0xFF000000;
}
static Color getBorderColor() {
return Colors.black;
}
}
import 'package:jeweled_game/provider/data.dart';
import 'package:jeweled_game/utils/board_utils.dart';
// import 'package:jeweled_game/utils/board_utils.dart';
class GameUtils {
static Future<void> quitGame(Data myProvider) async {
myProvider.updateGameIsRunning(false);
}
static Future<void> startNewGame(Data myProvider) async {
print('Starting game');
print('- level: ' + myProvider.parameterLevel);
print('- size: ' + myProvider.parameterSize);
myProvider.resetGame();
BoardUtils.createNewBoard(myProvider);
myProvider.updateGameIsRunning(true);
}
static void deleteSavedGame(Data myProvider) {
myProvider.resetCurrentSavedState();
}
static void resumeSavedGame(Data myProvider) {
Map<String, dynamic> savedState = myProvider.getCurrentSavedState();
if (savedState.isNotEmpty) {
try {
myProvider.setParameterValue('level', savedState['level']);
myProvider.setParameterValue('size', savedState['size']);
myProvider.setParameterValue('skin', savedState['skin']);
// myProvider.updateCells(
// BoardUtils.createBoardFromSavedState(myProvider, savedState['board']));
myProvider.updateGameIsRunning(true);
} catch (e) {
print('Failed to resume game. Will start new one instead.');
myProvider.resetCurrentSavedState();
myProvider.initParametersValues();
startNewGame(myProvider);
}
} else {
myProvider.resetCurrentSavedState();
myProvider.initParametersValues();
startNewGame(myProvider);
}
}
}
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
async: args:
dependency: transitive dependency: transitive
description: description:
name: async name: args
url: "https://pub.dartlang.org" sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
url: "https://pub.dev"
source: hosted source: hosted
version: "2.9.0" version: "2.4.2"
boolean_selector: bloc:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: bloc
url: "https://pub.dartlang.org" sha256: "3820f15f502372d979121de1f6b97bfcf1630ebff8fe1d52fb2b0bfa49be5b49"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.0" version: "8.1.2"
characters: characters:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
url: "https://pub.dartlang.org" sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.1" version: "1.3.0"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.dartlang.org" sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.1" version: "1.1.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.18.0"
crypto:
dependency: transitive
description:
name: crypto
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
url: "https://pub.dev"
source: hosted source: hosted
version: "1.16.0" version: "3.0.3"
fake_async: easy_localization:
dependency: "direct main"
description:
name: easy_localization
sha256: de63e3b422adfc97f256cbb3f8cf12739b6a4993d390f3cadb3f51837afaefe5
url: "https://pub.dev"
source: hosted
version: "3.0.3"
easy_logger:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: easy_logger
url: "https://pub.dartlang.org" sha256: c764a6e024846f33405a2342caf91c62e357c24b02c04dbc712ef232bf30ffb7
url: "https://pub.dev"
source: hosted
version: "0.0.2"
equatable:
dependency: "direct main"
description:
name: equatable
sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2
url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.1" version: "2.0.5"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
name: ffi name: ffi
url: "https://pub.dartlang.org" sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.1" version: "2.1.0"
file: file:
dependency: transitive dependency: transitive
description: description:
name: file name: file
url: "https://pub.dartlang.org" sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
url: "https://pub.dev"
source: hosted source: hosted
version: "6.1.4" version: "7.0.0"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_test: flutter_bloc:
dependency: "direct dev" dependency: "direct main"
description:
name: flutter_bloc
sha256: e74efb89ee6945bcbce74a5b3a5a3376b088e5f21f55c263fc38cbdc6237faae
url: "https://pub.dev"
source: hosted
version: "8.1.3"
flutter_localizations:
dependency: transitive
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
...@@ -72,228 +112,251 @@ packages: ...@@ -72,228 +112,251 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
js: hive:
dependency: transitive dependency: transitive
description: description:
name: js name: hive
url: "https://pub.dartlang.org" sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941"
url: "https://pub.dev"
source: hosted source: hosted
version: "0.6.4" version: "2.2.3"
matcher: hydrated_bloc:
dependency: "direct main"
description:
name: hydrated_bloc
sha256: c925e49704c052a8f249226ae7603f86bfa776b910816390763b956c71d2cbaf
url: "https://pub.dev"
source: hosted
version: "9.1.3"
intl:
dependency: transitive dependency: transitive
description: description:
name: matcher name: intl
url: "https://pub.dartlang.org" sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
url: "https://pub.dev"
source: hosted source: hosted
version: "0.12.12" version: "0.18.1"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
url: "https://pub.dartlang.org" sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
url: "https://pub.dev"
source: hosted source: hosted
version: "0.1.5" version: "0.5.0"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev"
source: hosted source: hosted
version: "1.8.0" version: "1.10.0"
nested: nested:
dependency: transitive dependency: transitive
description: description:
name: nested name: nested
url: "https://pub.dartlang.org" sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
overlay_support: path:
dependency: transitive
description:
name: path
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
url: "https://pub.dev"
source: hosted
version: "1.8.3"
path_provider:
dependency: "direct main" dependency: "direct main"
description: description:
name: overlay_support name: path_provider
url: "https://pub.dartlang.org" sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.1" version: "2.1.2"
path: path_provider_android:
dependency: transitive dependency: transitive
description: description:
name: path name: path_provider_android
url: "https://pub.dartlang.org" sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668"
url: "https://pub.dev"
source: hosted source: hosted
version: "1.8.2" version: "2.2.2"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f"
url: "https://pub.dev"
source: hosted
version: "2.3.2"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
name: path_provider_linux name: path_provider_linux
url: "https://pub.dartlang.org" sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.7" version: "2.2.1"
path_provider_platform_interface: path_provider_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: path_provider_platform_interface name: path_provider_platform_interface
url: "https://pub.dartlang.org" sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.5" version: "2.1.2"
path_provider_windows: path_provider_windows:
dependency: transitive dependency: transitive
description: description:
name: path_provider_windows name: path_provider_windows
url: "https://pub.dartlang.org" sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.3" version: "2.2.1"
platform: platform:
dependency: transitive dependency: transitive
description: description:
name: platform name: platform
url: "https://pub.dartlang.org" sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.0" version: "3.1.4"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: plugin_platform_interface name: plugin_platform_interface
url: "https://pub.dartlang.org" sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
source: hosted url: "https://pub.dev"
version: "2.1.3"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.2.4" version: "2.1.8"
provider: provider:
dependency: "direct main" dependency: transitive
description: description:
name: provider name: provider
url: "https://pub.dartlang.org" sha256: "9a96a0a19b594dbc5bf0f1f27d2bc67d5f95957359b461cd9feb44ed6ae75096"
url: "https://pub.dev"
source: hosted source: hosted
version: "6.0.3" version: "6.1.1"
shared_preferences: shared_preferences:
dependency: "direct main" dependency: transitive
description: description:
name: shared_preferences name: shared_preferences
url: "https://pub.dartlang.org" sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.15" version: "2.2.2"
shared_preferences_android: shared_preferences_android:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_android name: shared_preferences_android
url: "https://pub.dartlang.org" sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.13" version: "2.2.1"
shared_preferences_ios: shared_preferences_foundation:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_ios name: shared_preferences_foundation
url: "https://pub.dartlang.org" sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" version: "2.3.5"
shared_preferences_linux: shared_preferences_linux:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_linux name: shared_preferences_linux
url: "https://pub.dartlang.org" sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa"
source: hosted url: "https://pub.dev"
version: "2.1.1"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.4" version: "2.3.2"
shared_preferences_platform_interface: shared_preferences_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_platform_interface name: shared_preferences_platform_interface
url: "https://pub.dartlang.org" sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.0" version: "2.3.2"
shared_preferences_web: shared_preferences_web:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_web name: shared_preferences_web
url: "https://pub.dartlang.org" sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.4" version: "2.2.2"
shared_preferences_windows: shared_preferences_windows:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_windows name: shared_preferences_windows
url: "https://pub.dartlang.org" sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" version: "2.3.2"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.99" version: "0.0.99"
source_span: synchronized:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: synchronized
url: "https://pub.dartlang.org" sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.0" version: "3.1.0+1"
string_scanner: typed_data:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: typed_data
url: "https://pub.dartlang.org" sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.1" version: "1.3.2"
term_glyph: unicons:
dependency: transitive dependency: "direct main"
description: description:
name: term_glyph name: unicons
url: "https://pub.dartlang.org" sha256: dbfcf93ff4d4ea19b324113857e358e4882115ab85db04417a4ba1c72b17a670
url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.1" version: "2.1.1"
test_api: vector_math:
dependency: transitive dependency: transitive
description: description:
name: test_api name: vector_math
url: "https://pub.dartlang.org" sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev"
source: hosted source: hosted
version: "0.4.12" version: "2.1.4"
vector_math: web:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: web
url: "https://pub.dartlang.org" sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.2" version: "0.3.0"
win32: win32:
dependency: transitive dependency: transitive
description: description:
name: win32 name: win32
url: "https://pub.dartlang.org" sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8"
url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.0" version: "5.2.0"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
name: xdg_directories name: xdg_directories
url: "https://pub.dartlang.org" sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d
url: "https://pub.dev"
source: hosted source: hosted
version: "0.2.0+2" version: "1.0.4"
sdks: sdks:
dart: ">=2.17.0 <3.0.0" dart: ">=3.2.0 <4.0.0"
flutter: ">=3.0.0" flutter: ">=3.16.0"
name: jeweled_game name: jeweled
description: Jeweled Game description: Jeweled Game
publish_to: 'none' publish_to: 'none'
version: 1.0.0+1
version: 0.0.9+9
environment: environment:
sdk: ">=2.16.1 <3.0.0" sdk: '^3.0.0'
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
provider: ^6.0.2 easy_localization: ^3.0.1
shared_preferences: ^2.0.6 equatable: ^2.0.5
overlay_support: ^2.0.1 flutter_bloc: ^8.1.1
hydrated_bloc: ^9.0.0
dev_dependencies: path_provider: ^2.0.11
flutter_test: unicons: ^2.1.1
sdk: flutter
flutter: flutter:
uses-material-design: true uses-material-design: false
assets: assets:
- assets/icons/ - assets/icons/
- assets/skins/ - assets/translations/
fonts:
- family: Nunito
fonts:
- asset: assets/fonts/Nunito-Bold.ttf
weight: 700
- asset: assets/fonts/Nunito-Medium.ttf
weight: 500
- asset: assets/fonts/Nunito-Regular.ttf
weight: 400
- asset: assets/fonts/Nunito-Light.ttf
weight: 300