You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.0 KiB

2 years ago
  1. import 'package:flutter/foundation.dart';
  2. import 'package:flutter/widgets.dart';
  3. class PuzzleData {
  4. final List<List<int>> board2D;
  5. final List<int> board1D;
  6. final int moves;
  7. final int tiles;
  8. final int puzzleSize;
  9. final Map<int, FractionalOffset> offsetMap;
  10. PuzzleData({
  11. required this.board2D,
  12. required this.board1D,
  13. required this.offsetMap,
  14. required this.moves,
  15. required this.tiles,
  16. required this.puzzleSize,
  17. });
  18. @override
  19. bool operator ==(Object other) {
  20. if (identical(this, other)) return true;
  21. return other is PuzzleData &&
  22. listEquals(other.board2D, board2D) &&
  23. listEquals(other.board1D, board1D) &&
  24. other.moves == moves &&
  25. other.tiles == tiles &&
  26. other.puzzleSize == puzzleSize &&
  27. mapEquals(other.offsetMap, offsetMap);
  28. }
  29. @override
  30. int get hashCode {
  31. return board2D.hashCode ^
  32. board1D.hashCode ^
  33. moves.hashCode ^
  34. tiles.hashCode ^
  35. puzzleSize.hashCode ^
  36. offsetMap.hashCode;
  37. }
  38. }