From 2435166453b5f6d52aefda19773bd970a630e698 Mon Sep 17 00:00:00 2001 From: Rosyid Date: Sun, 22 Oct 2023 15:13:58 +0700 Subject: [PATCH] add dummy final score page --- .../final_score/final_score_page.dart | 62 +++++++++++++++++++ .../main/presentation/pages/main_page.dart | 10 +++ .../presentation/pages/splash_screen.dart | 7 ++- app/lib/services/router_service.dart | 4 ++ 4 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 app/lib/features/final_score/final_score_page.dart diff --git a/app/lib/features/final_score/final_score_page.dart b/app/lib/features/final_score/final_score_page.dart new file mode 100644 index 0000000..c12a49c --- /dev/null +++ b/app/lib/features/final_score/final_score_page.dart @@ -0,0 +1,62 @@ +import 'package:flutter/material.dart'; + +import '../../core/bases/widgets/layout/bebras_scaffold.dart'; +import '../../core/constants/assets.dart'; + +class FinalScorePage extends StatefulWidget { + const FinalScorePage({super.key}); + + @override + State createState() => _FinalScorePageState(); +} + +class _FinalScorePageState extends State { + @override + Widget build(BuildContext context) { + return BebrasScaffold( + body: SingleChildScrollView( + child: Stack(children: [ + Padding( + padding: const EdgeInsets.all(32), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + Assets.bebrasPandaiText, + ), + const SizedBox( + height: 40, + ), + const Text('LATIHAN SELESAI'), + const SizedBox( + height: 20, + ), + Image.asset( + Assets.logo, + ), + const SizedBox( + height: 20, + ), + Container( + padding: EdgeInsets.all(16), + decoration: + BoxDecoration(border: Border.all(), color: Colors.grey), + child: Column( + children: [ + Text('Total Nilai: 20'), + Text('benar: 3, salah: 10'), + Text('MANTAP!!!') + ], + ), + ), + const SizedBox( + height: 20, + ), + const Text('Sampai jumpa di Latihan Bebras selanjutnya'), + ], + ), + ), + ]), + )); + } +} diff --git a/app/lib/features/main/presentation/pages/main_page.dart b/app/lib/features/main/presentation/pages/main_page.dart index 27de950..30ecadf 100644 --- a/app/lib/features/main/presentation/pages/main_page.dart +++ b/app/lib/features/main/presentation/pages/main_page.dart @@ -80,6 +80,16 @@ class _MainPageState extends State { const SizedBox( height: 10, ), + Button( + buttonType: ButtonType.primary, + onTap: () async { + await context.push('/final_score'); + }, + text: '(Dummy) Final Score Page', + ), + const SizedBox( + height: 10, + ), Button( buttonType: ButtonType.primary, onTap: () async { diff --git a/app/lib/features/onboarding/presentation/pages/splash_screen.dart b/app/lib/features/onboarding/presentation/pages/splash_screen.dart index 859159d..af6291c 100644 --- a/app/lib/features/onboarding/presentation/pages/splash_screen.dart +++ b/app/lib/features/onboarding/presentation/pages/splash_screen.dart @@ -8,16 +8,17 @@ class SplashScreen extends StatelessWidget { final size = MediaQuery.of(context).size; return BlocListener( listener: (context, state) { - if (state is UserUnauthenticated) { + if (state is UserUnauthenticated) { context.go('/onboarding'); } else if (state is UserUnregistered) { context.go('/register'); } else if (state is UserRegistered) { - context.go('/main'); + context.go('/main'); } - }, + }, child: Scaffold( body: Column( + crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Padding( diff --git a/app/lib/services/router_service.dart b/app/lib/services/router_service.dart index 868c9dd..359b2cc 100644 --- a/app/lib/services/router_service.dart +++ b/app/lib/services/router_service.dart @@ -3,6 +3,7 @@ import 'package:go_router/go_router.dart'; import '../features/authentication/register/presentation/pages/_pages.dart'; import '../features/authentication/signin/presentation/pages/_pages.dart'; import '../features/error/presentation/pages/_pages.dart'; +import '../features/final_score/final_score_page.dart'; import '../features/main/presentation/pages/_pages.dart'; import '../features/onboarding/presentation/pages/_pages.dart'; import '../features/quiz_registration/presentation/pages/_pages.dart'; @@ -33,5 +34,8 @@ GoRouter router = GoRouter( path: '/quiz_registration', builder: (context, state) => const QuizRegistrationPage(), ), + GoRoute( + path: '/final_score', + builder: (context, state) => const FinalScorePage()) ], );