refactor: use rounds instead of balls

pull/213/head
RuiAlonso 3 years ago
parent b3c767636f
commit 18c12bce7d

@ -14,9 +14,7 @@ class RoundCountDisplay extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final l10n = context.l10n; final l10n = context.l10n;
// TODO(arturplaczek): refactor when GameState handle balls and rounds and final balls = context.select((GameBloc bloc) => bloc.state.rounds);
// select state.rounds property instead of state.ball
final balls = context.select((GameBloc bloc) => bloc.state.balls);
return Row( return Row(
children: [ children: [

@ -18,7 +18,9 @@ void main() {
const initialState = GameState( const initialState = GameState(
score: 1000, score: 1000,
multiplier: 1,
balls: 2, balls: 2,
rounds: 1,
bonusHistory: [], bonusHistory: [],
); );

@ -11,7 +11,9 @@ void main() {
late GameBloc gameBloc; late GameBloc gameBloc;
const initialState = GameState( const initialState = GameState(
score: 0, score: 0,
balls: 3, multiplier: 1,
balls: 1,
rounds: 3,
bonusHistory: [], bonusHistory: [],
); );
@ -37,7 +39,7 @@ void main() {
testWidgets('two active round indicator', (tester) async { testWidgets('two active round indicator', (tester) async {
final state = initialState.copyWith( final state = initialState.copyWith(
balls: 2, rounds: 2,
); );
whenListen( whenListen(
gameBloc, gameBloc,
@ -68,7 +70,7 @@ void main() {
testWidgets('one active round indicator', (tester) async { testWidgets('one active round indicator', (tester) async {
final state = initialState.copyWith( final state = initialState.copyWith(
balls: 1, rounds: 1,
); );
whenListen( whenListen(
gameBloc, gameBloc,

@ -15,7 +15,9 @@ void main() {
const score = 123456789; const score = 123456789;
const initialState = GameState( const initialState = GameState(
score: score, score: score,
multiplier: 1,
balls: 1, balls: 1,
rounds: 1,
bonusHistory: [], bonusHistory: [],
); );
@ -46,7 +48,7 @@ void main() {
stateController.add( stateController.add(
initialState.copyWith( initialState.copyWith(
balls: 0, rounds: 0,
), ),
); );

Loading…
Cancel
Save