Select Git revision
button_game_start_new.dart
-
Benoît Harrault authoredBenoît Harrault authored
button_game_start_new.dart 1.26 KiB
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:momomotus/cubit/game_cubit.dart';
import 'package:momomotus/cubit/settings_game_cubit.dart';
import 'package:momomotus/cubit/settings_global_cubit.dart';
import 'package:momomotus/ui/helpers/styled_button.dart';
class StartNewGameButton extends StatelessWidget {
const StartNewGameButton({super.key});
@override
Widget build(BuildContext context) {
return BlocBuilder<GameSettingsCubit, GameSettingsState>(
builder: (BuildContext context, GameSettingsState gameSettingsState) {
return BlocBuilder<GlobalSettingsCubit, GlobalSettingsState>(
builder: (BuildContext context, GlobalSettingsState globalSettingsState) {
return StyledButton(
color: Colors.blue,
onPressed: () {
BlocProvider.of<GameCubit>(context).startNewGame(
gameSettings: gameSettingsState.settings,
globalSettings: globalSettingsState.settings,
);
},
child: const Image(
image: AssetImage('assets/ui/button_start.png'),
fit: BoxFit.fill,
),
);
},
);
},
);
}
}