diff --git a/Sources/bowlin_project/assets/images/image_scoreboard.png b/Sources/bowlin_project/assets/images/image_scoreboard.png new file mode 100644 index 0000000..8d48932 Binary files /dev/null and b/Sources/bowlin_project/assets/images/image_scoreboard.png differ diff --git a/Sources/bowlin_project/lib/config/app_router.dart b/Sources/bowlin_project/lib/config/app_router.dart index 4b60aee..a443419 100644 --- a/Sources/bowlin_project/lib/config/app_router.dart +++ b/Sources/bowlin_project/lib/config/app_router.dart @@ -6,6 +6,7 @@ import '../views/ingame_screen.dart'; import '../views/main_screen.dart'; import '../views/rank_screen.dart'; import '../views/welcome_screen.dart'; +import '../widgets/ingame_widgets.dart'; final GoRouter router = GoRouter( routes: [ @@ -36,7 +37,7 @@ final GoRouter router = GoRouter( GoRoute( path: 'in-game', builder: (BuildContext context, GoRouterState state) { - return const InGameScreen(); + return InGameScreen(); }, ), ], diff --git a/Sources/bowlin_project/lib/model/StubManager/StubData.dart b/Sources/bowlin_project/lib/model/StubManager/StubData.dart index a0d4fb1..22b06cc 100644 --- a/Sources/bowlin_project/lib/model/StubManager/StubData.dart +++ b/Sources/bowlin_project/lib/model/StubManager/StubData.dart @@ -24,8 +24,8 @@ class StubData extends IManager { _initRounds(); _initGameDetails(); _initGame(); - players[8].games = games; - userCurrent = players[8]; + userCurrent = players[8] as User; + userCurrent.games = games; } IUserManager get userMgr => _userMgr; @@ -51,8 +51,7 @@ class StubData extends IManager { Achievement("Win a game") ], [], - Stat(10, 2, 12, 130, 7, 6, 700, 58.33, 30.2) - ), + Stat(10, 2, 12, 130, 7, 6, 700, 58.33, 30.2)), User( 9, "Dave", @@ -64,8 +63,7 @@ class StubData extends IManager { Achievement("Win a game") ], [], - Stat(2, 7, 9, 80, 4, 3, 250, 27.77, 10.55) - ) + Stat(2, 7, 9, 80, 4, 3, 250, 27.77, 10.55)) ]; List _gameDetails = []; @@ -101,7 +99,7 @@ class StubData extends IManager { rounds.add(Round(4, 5, 9, players[7])); rounds.add(Round(4, 1, 5, players[8])); } - + List get rounds => _rounds; List _games = []; @@ -115,6 +113,6 @@ class StubData extends IManager { games.add(Game(gameDetails[1].id, DateTime.now(), 101, true, [players[1].id, players[0].id])); } - + List get games => _games; } diff --git a/Sources/bowlin_project/lib/views/game_screen.dart b/Sources/bowlin_project/lib/views/game_screen.dart index ce2f8e5..636359c 100644 --- a/Sources/bowlin_project/lib/views/game_screen.dart +++ b/Sources/bowlin_project/lib/views/game_screen.dart @@ -29,23 +29,18 @@ class _GameScreenState extends State { ], )), ), - Align( - alignment: AlignmentDirectional.topCenter, - child: Container( - height: 120, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/image_score.png"), - )), - child: Center( - child: Text( - "Scores", - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.white, - fontSize: 20), - )), - ), + Container( + height: 120, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/image_score.png"), + )), + child: Center( + child: Text( + "Scores", + style: TextStyle( + fontWeight: FontWeight.bold, color: Colors.white, fontSize: 20), + )), ), Column( mainAxisAlignment: MainAxisAlignment.end, @@ -54,19 +49,14 @@ class _GameScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ ButtonNewParty(), - SizedBox(width: 20), + const SizedBox(width: 20), ButtonJoinParty(), ], ), - Align( - alignment: Alignment.bottomCenter, - child: Positioned( - bottom: 0, - child: Container( - height: MediaQuery.of(context).size.height - 140, - width: MediaQuery.of(context).size.width, - child: ListCardGame(), - )), + Container( + height: MediaQuery.of(context).size.height - 140, + width: MediaQuery.of(context).size.width, + child: ListCardGame(), ), ], ) diff --git a/Sources/bowlin_project/lib/widgets/button_new_party.dart b/Sources/bowlin_project/lib/widgets/button_new_party.dart index a5283ff..ef5f5a5 100644 --- a/Sources/bowlin_project/lib/widgets/button_new_party.dart +++ b/Sources/bowlin_project/lib/widgets/button_new_party.dart @@ -1,13 +1,16 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:go_router/go_router.dart'; import 'package:google_fonts/google_fonts.dart'; +import 'ingame_widgets.dart'; + class ButtonNewParty extends StatelessWidget { @override Widget build(BuildContext context) { return ElevatedButton( - onPressed: () {}, + onPressed: () => context.go('/in-game'), child: Text("+ New game"), style: ElevatedButton.styleFrom( side: BorderSide( @@ -139,6 +142,65 @@ class NewGameModal extends StatelessWidget { } } +class ScoreBoardModal extends StatelessWidget { + const ScoreBoardModal({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Dialog( + child: Stack( + alignment: Alignment.topCenter, + children: [ + Transform.scale( + scale: 1.14, + child: Image.asset("assets/images/image_scoreboard.png")), + SizedBox( + height: 245, + child: + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Expanded( + child: Padding( + padding: EdgeInsets.fromLTRB(0, 40, 0, 0), + child: Stack( + alignment: Alignment.topCenter, + children: [ + Positioned( + child: PodiumGameOverWidget( + isfirst: 2, + pseudo: 'Lucas', + score: 123, + ), + top: 70, + left: 30, + ), + Positioned( + child: PodiumGameOverWidget( + isfirst: 1, + pseudo: 'Momo', + score: 160, + ), + top: 10, + ), + Positioned( + child: PodiumGameOverWidget( + isfirst: 3, + pseudo: 'popo', + score: 110, + ), + top: 70, + right: 30, + ) + ], + ), + )), + ]), + ) + ], + ), + ); + } +} + class ButtonJoinParty extends StatelessWidget { @override Widget build(BuildContext context) { diff --git a/Sources/bowlin_project/lib/widgets/scores_list_widget.dart b/Sources/bowlin_project/lib/widgets/scores_list_widget.dart index 4b70297..fa810e0 100644 --- a/Sources/bowlin_project/lib/widgets/scores_list_widget.dart +++ b/Sources/bowlin_project/lib/widgets/scores_list_widget.dart @@ -1,4 +1,5 @@ import 'package:bowl_in/main.dart'; +import 'package:bowl_in/widgets/button_new_party.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; @@ -108,17 +109,17 @@ class CardGame extends StatelessWidget { child: SizedBox( width: 130, child: Wrap( - spacing: 5, - runSpacing: 5, - children: game.playersId - .map((item) => ProfilPicture( - path: MyApp.controller.userMgr - .getUserById(item) - .image, - )) - .toList(), - ))), - Spacer(), + spacing: 5, + runSpacing: 5, + children: game.playersId + .map((e) => ProfilPicture( + path: MyApp.controller.userMgr + .getUserById(e) + .image + .toString(), + )) + .toList()))), + const Spacer(), Padding( padding: EdgeInsets.fromLTRB(0, 30, 15, 0), child: GradientText( @@ -144,7 +145,13 @@ class CardGame extends StatelessWidget { ), ], ), - onTap: () => context.go('/in-game'), + onTap: () { + showDialog( + context: context, + builder: (BuildContext context) { + return ScoreBoardModal(); + }); + }, )); } }