|
@ -1,7 +1,6 @@ |
|
|
import 'package:flutter/material.dart'; |
|
|
import 'package:flutter/material.dart'; |
|
|
import 'package:flutter_bloc/flutter_bloc.dart'; |
|
|
import 'package:flutter_bloc/flutter_bloc.dart'; |
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart'; |
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart'; |
|
|
import 'package:image_picker/image_picker.dart'; |
|
|
|
|
|
import 'package:my_flutter_puzzle/application/states/image_splitter_state.dart'; |
|
|
import 'package:my_flutter_puzzle/application/states/image_splitter_state.dart'; |
|
|
import 'package:my_flutter_puzzle/application/states/puzzle_state.dart'; |
|
|
import 'package:my_flutter_puzzle/application/states/puzzle_state.dart'; |
|
|
import 'package:my_flutter_puzzle/cubits/count_down_timer_cubit.dart'; |
|
|
import 'package:my_flutter_puzzle/cubits/count_down_timer_cubit.dart'; |
|
@ -43,7 +42,6 @@ class _SoloScreenLargeState extends ConsumerState<PhotoScreenLarge> { |
|
|
late final RiveAnimationController _riveController; |
|
|
late final RiveAnimationController _riveController; |
|
|
bool _puzzleSolved = false; |
|
|
bool _puzzleSolved = false; |
|
|
bool _isStartPressed = false; |
|
|
bool _isStartPressed = false; |
|
|
final _imagePicker = ImagePicker(); |
|
|
|
|
|
final double _fontSize = 70.0; |
|
|
final double _fontSize = 70.0; |
|
|
final double _boardSize = 280.0; |
|
|
final double _boardSize = 280.0; |
|
|
final int _spacing = 4; |
|
|
final int _spacing = 4; |
|
@ -82,6 +80,9 @@ class _SoloScreenLargeState extends ConsumerState<PhotoScreenLarge> { |
|
|
_previousImage = next.image; |
|
|
_previousImage = next.image; |
|
|
_previousPalette = next.palette; |
|
|
_previousPalette = next.palette; |
|
|
}); |
|
|
}); |
|
|
|
|
|
ref.read(puzzleNotifierProvider(_solverClient).notifier).initializePuzzle( |
|
|
|
|
|
initialPuzzleData: _initialPuzzleData, |
|
|
|
|
|
); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -102,13 +103,18 @@ class _SoloScreenLargeState extends ConsumerState<PhotoScreenLarge> { |
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
children: [ |
|
|
children: [ |
|
|
|
|
|
Visibility( |
|
|
|
|
|
visible: !_isStartPressed, |
|
|
|
|
|
child: ImageViewer( |
|
|
|
|
|
puzzleSize: _puzzleSize, |
|
|
|
|
|
previousImage: _previousImage, |
|
|
|
|
|
previousPalette: _previousPalette, |
|
|
|
|
|
imageSize: 200, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
const SizedBox(height: 32), |
|
|
const SizedBox(height: 32), |
|
|
MovesTilesWidget(solverClient: _solverClient, fontSize: 16), |
|
|
MovesTilesWidget(solverClient: _solverClient, fontSize: 16), |
|
|
const SizedBox(height: 32), |
|
|
const SizedBox(height: 32), |
|
|
GameButtonWidget( |
|
|
|
|
|
solverClient: _solverClient, |
|
|
|
|
|
initialPuzzleData: _initialPuzzleData, |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
@ -190,7 +196,6 @@ class _SoloScreenLargeState extends ConsumerState<PhotoScreenLarge> { |
|
|
CountdownWidget( |
|
|
CountdownWidget( |
|
|
isStartPressed: _isStartPressed, |
|
|
isStartPressed: _isStartPressed, |
|
|
onFinish: () { |
|
|
onFinish: () { |
|
|
// ref.read(timerNotifierProvider.notifier).startTimer(); |
|
|
|
|
|
BlocProvider.of<CountDownTimerCubit>(context).start(); |
|
|
BlocProvider.of<CountDownTimerCubit>(context).start(); |
|
|
setState(() { |
|
|
setState(() { |
|
|
_isStartPressed = false; |
|
|
_isStartPressed = false; |
|
@ -198,16 +203,6 @@ class _SoloScreenLargeState extends ConsumerState<PhotoScreenLarge> { |
|
|
}, |
|
|
}, |
|
|
initialSpeed: kInitialSpeed, |
|
|
initialSpeed: kInitialSpeed, |
|
|
), |
|
|
), |
|
|
Visibility( |
|
|
|
|
|
visible: !_isStartPressed, |
|
|
|
|
|
child: ImageViewer( |
|
|
|
|
|
imagePicker: _imagePicker, |
|
|
|
|
|
puzzleSize: _puzzleSize, |
|
|
|
|
|
previousImage: _previousImage, |
|
|
|
|
|
previousPalette: _previousPalette, |
|
|
|
|
|
imageSize: 200, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
], |
|
|
], |
|
|