Skip to content

Commit

Permalink
add dummy final score page
Browse files Browse the repository at this point in the history
  • Loading branch information
gmochid committed Oct 22, 2023
1 parent f7d747b commit 2435166
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 3 deletions.
62 changes: 62 additions & 0 deletions app/lib/features/final_score/final_score_page.dart
Original file line number Diff line number Diff line change
@@ -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<FinalScorePage> createState() => _FinalScorePageState();
}

class _FinalScorePageState extends State<FinalScorePage> {
@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'),
],
),
),
]),
));
}
}
10 changes: 10 additions & 0 deletions app/lib/features/main/presentation/pages/main_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ class _MainPageState extends State<MainPage> {
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ class SplashScreen extends StatelessWidget {
final size = MediaQuery.of(context).size;
return BlocListener<UserInitializationBloc, UserInitializationState>(
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(
Expand Down
4 changes: 4 additions & 0 deletions app/lib/services/router_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -33,5 +34,8 @@ GoRouter router = GoRouter(
path: '/quiz_registration',
builder: (context, state) => const QuizRegistrationPage(),
),
GoRoute(
path: '/final_score',
builder: (context, state) => const FinalScorePage())
],
);

0 comments on commit 2435166

Please sign in to comment.