// Copyright 2022, the Flutter project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:provider/provider.dart'; import '../ads/ads_controller.dart'; import '../ads/banner_ad_widget.dart'; import '../games_services/score.dart'; import '../in_app_purchase/in_app_purchase.dart'; import '../style/palette.dart'; import '../style/responsive_screen.dart'; class WinGameScreen extends StatelessWidget { final Score score; const WinGameScreen({ super.key, required this.score, }); @override Widget build(BuildContext context) { final adsControllerAvailable = context.watch() != null; final adsRemoved = context.watch()?.adRemoval.active ?? false; final palette = context.watch(); const gap = SizedBox(height: 10); return Scaffold( backgroundColor: palette.backgroundPlaySession, body: ResponsiveScreen( squarishMainArea: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ if (adsControllerAvailable && !adsRemoved) ...[ const Expanded( child: Center( child: BannerAdWidget(), ), ), ], gap, const Center( child: Text( 'You won!', style: TextStyle(fontFamily: 'Permanent Marker', fontSize: 50), ), ), gap, Center( child: Text( 'Score: ${score.score}\n' 'Time: ${score.formattedTime}', style: const TextStyle( fontFamily: 'Permanent Marker', fontSize: 20), ), ), ], ), rectangularMenuArea: FilledButton( onPressed: () { GoRouter.of(context).go('/play'); }, child: const Text('Continue'), ), ), ); } }