diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/bebras-pandai.iml b/.idea/bebras-pandai.iml
new file mode 100644
index 0000000..f33560c
--- /dev/null
+++ b/.idea/bebras-pandai.iml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..2604166
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/android/app/build.gradle b/app/android/app/build.gradle
index 6548875..3e8e3c4 100644
--- a/app/android/app/build.gradle
+++ b/app/android/app/build.gradle
@@ -70,4 +70,5 @@ flutter {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation 'com.google.android.gms:play-services-vision:20.1.3'
}
diff --git a/app/assets/images/bebras-mascot.png b/app/assets/images/bebras-mascot.png
new file mode 100644
index 0000000..125eb4d
Binary files /dev/null and b/app/assets/images/bebras-mascot.png differ
diff --git a/app/lib/app.dart b/app/lib/app.dart
index 0b85c38..4d3b26e 100644
--- a/app/lib/app.dart
+++ b/app/lib/app.dart
@@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:google_fonts/google_fonts.dart';
+import 'features/authentication/register/bloc/user_register_bloc.dart';
import 'features/onboarding/presentation/bloc/user_initialization_bloc.dart';
import 'services/di.dart';
import 'services/router_service.dart';
@@ -18,16 +19,21 @@ class App extends StatelessWidget {
]);
return MultiBlocProvider(
providers: [
+ BlocProvider(create: (_) => get()
+ ..add(
+ InitEvent(),
+ )),
BlocProvider(
create: (_) => get()
..add(
OnboardingAuthEvent(),
),
+ lazy: false,
),
],
child: MaterialApp.router(
theme: ThemeData(
- textTheme: GoogleFonts.interTextTheme(),
+ textTheme: GoogleFonts.poppinsTextTheme(),
),
routerConfig: router,
debugShowCheckedModeBanner: false,
diff --git a/app/lib/core/bases/widgets/layout/bebras_scaffold.dart b/app/lib/core/bases/widgets/layout/bebras_scaffold.dart
index 93db499..eb267f3 100644
--- a/app/lib/core/bases/widgets/layout/bebras_scaffold.dart
+++ b/app/lib/core/bases/widgets/layout/bebras_scaffold.dart
@@ -2,11 +2,13 @@ import 'package:flutter/material.dart';
class BebrasScaffold extends StatelessWidget {
final Widget body;
- const BebrasScaffold({required this.body, super.key});
+ final bool avoidBottomInset;
+ const BebrasScaffold({required this.body, super.key, this.avoidBottomInset = true});
@override
Widget build(BuildContext context) {
return Scaffold(
+ resizeToAvoidBottomInset: avoidBottomInset,
body: SafeArea(
child: body,
),
diff --git a/app/lib/core/constants/assets.dart b/app/lib/core/constants/assets.dart
index bfa8295..4915cfb 100644
--- a/app/lib/core/constants/assets.dart
+++ b/app/lib/core/constants/assets.dart
@@ -2,4 +2,5 @@ class Assets {
static const logo = 'assets/images/logo.jpg';
static const bebrasPandaiText = 'assets/images/bebras-banner.png';
static const studyBackground = 'assets/images/study-background.jpg';
+ static const bebrasMascot = 'assets/images/bebras-mascot.png';
}
diff --git a/app/lib/core/constants/bebrasBiroDropdown.dart b/app/lib/core/constants/bebrasBiroDropdown.dart
new file mode 100644
index 0000000..f73e86b
--- /dev/null
+++ b/app/lib/core/constants/bebrasBiroDropdown.dart
@@ -0,0 +1,110 @@
+class BebrasBiro {
+ String bebrasBiroUniv;
+ String valueDropdown;
+ bool isActive;
+
+ BebrasBiro({
+ required this.bebrasBiroUniv,
+ required this.valueDropdown,
+ this.isActive = true,
+ });
+
+ String userAsString() {
+ return this.bebrasBiroUniv;
+ }
+}
+
+List bebrasBiroList = [
+ "Institut Teknologi Bandung",
+ "Institut Pertanian Bogor",
+ "Universitas Indonesia",
+ "Institut Teknologi Sepuluh November",
+ "Universitas Kristen Maranatha",
+ "Universitas Atmajaya Yogyakarta",
+ "Universitas Diponegoro",
+ "Universitas Islam Indonesia",
+ "Universitas Jendral Soedirman",
+ "Universitas Jember",
+ "Universitas Sriwijaya",
+ "Institut Teknologi Del",
+ "Sekolah Tinggi Teknologi Garut",
+ "Universitas Mulawarman",
+ "Unversitas Udayana",
+ "Universitas Negeri Malang",
+ "Universitas Dian Nuswantoro",
+ "Politeknik Caltex Riau",
+ "Universitas Katolik Parahyangan",
+ "Institut Teknologi Sumatera",
+ "Universitas Lambung Mangkurat",
+ "Universitas Tanjungpura",
+ "Universitas Sumatera Utara",
+ "Universitas Pembangunan Jaya",
+ "Universitas Kristen Satya Wacana",
+ "Universitas Maritim Raja Ali Haji",
+ "Universitas Paramadina",
+ "Universitas Katolik Widya Mandira",
+ "Politeknik Negeri Batam",
+ "Politeknik Negeri Malang",
+ "Universitas Katolik Soegijapranata",
+ "Universitas Muhammadiyah Surakarta",
+ "Politeknik Negeri Jakarta",
+ "Universitas Gadjah Mada",
+ "Universitas Negeri Yogyakarta",
+ "Politeknik Negeri Bandung",
+ "Universitas Hasanudin",
+ "UIN Alauddin Makassar",
+ "Universitas Pasundan",
+ "Universitas Telkom",
+ "Universitas Sanata Dharma",
+ "Universitas Andalas",
+ "Universitas Islam Nusantara",
+ "Universitas Sains Al-Qur’an Wonosobo",
+ "Universitas Bina Nusantara",
+ "Universitas Komputer Indonesia",
+ "Universitas Singaperbangsa Karawang",
+ "Universitas Pendidikan Indonesia Kampus Purwakarta",
+ "Universitas President",
+ "STIKOM PGRI Banyuwangi",
+ "Universitas Bumigora",
+ "Universitas Pendidikan Indonesia",
+ "Universitas Padjadjaran",
+ "Universitas Katolik De La Salle Manado",
+ "Universitas Ahmad Dahlan",
+ "Universitas Negeri Makassar",
+ "Universitas Pendidikan Muhammadiyah Sorong",
+ "Universitas Al-Azhar Indonesia",
+ "Politeknik Negeri Indramayu",
+ "Universitas Nahdlatul Ulama Sunan Giri Bojonegoro",
+ "Institut Bisnis dan Informatika Kwik Kian Gie",
+ "Universitas Internasional Semen Indonesia",
+ "Politeknik Negeri Madiun",
+ "Universitas Kristen Petra",
+ "Universitas Muhammadiyah Magelang",
+ "Universitas Surabaya",
+ "Universitas Katolik Indonesia Atma Jaya",
+ "Universitas Ciputra Surabaya",
+ "Universitas Katolik Widya Mandala Surabaya",
+ "Universitas Kristen Duta Wacana",
+ "Politeknik Manufaktur Negeri Bangka Belitung",
+ "Universitas Kristen Krida Wacana",
+ "Institut Agama Islam Negeri Salatiga",
+ "Universitas Muhammadiyah Purworejo",
+ "Institut Teknologi dan Bisnis Kalbis",
+ "Universitas Mercu Buana Jakarta",
+ "UPN “Veteran” Jakarta",
+ "Universitas Pertamina",
+ "Universitas Dr. Soetomo",
+ "Universitas Bakrie",
+ "Universitas Bengkulu",
+ "UIN Walisongo Semarang",
+ "Universitas Islam Sultan Agung Semarang",
+ "UIN Imam Bonjol Padang",
+ "Institut Pesantren Mathali’ul Falah Pati",
+ "UIN Sunan Gunung Djati Bandung",
+ "IAIN Pekalongan",
+ "UIN Sultan Aji Muhammad Idris Samarinda",
+ "Politeknik Jambi",
+ "Universitas Trisakti",
+ "Biro Institut Teknologi dan Bisnis Yadika Pasuruan",
+ "Biro Universitas Widyagama Malang",
+];
diff --git a/app/lib/core/constants/colorConstant.dart b/app/lib/core/constants/colorConstant.dart
new file mode 100644
index 0000000..f2c2fb0
--- /dev/null
+++ b/app/lib/core/constants/colorConstant.dart
@@ -0,0 +1,7 @@
+import 'dart:ui';
+
+class ColorConstants {
+ static const Color primaryBlueColor = Color(0XFF6191CB);
+ static const Color darkPrimaryBlueColor = Color(0XFF2f609c);
+ static const Color whiteColor = Color(0XFFFFFFFF);
+}
\ No newline at end of file
diff --git a/app/lib/core/constants/indonesiaProvince.dart b/app/lib/core/constants/indonesiaProvince.dart
new file mode 100644
index 0000000..0106e04
--- /dev/null
+++ b/app/lib/core/constants/indonesiaProvince.dart
@@ -0,0 +1,57 @@
+class IndonesiaProvince {
+ String provinceName;
+ String valueProvince;
+ bool isActive;
+
+ IndonesiaProvince({
+ required this.provinceName,
+ required this.valueProvince,
+ this.isActive = true,
+ });
+
+ String userAsString() {
+ return this.provinceName;
+ }
+}
+
+List provinceList = [
+ "Bali",
+ "Banten",
+ "Nanggroe Aceh Darussalam",
+ "Sumatera Utara",
+ "Sumatera Selatan",
+ "Sumatera Barat",
+ "Bengkulu",
+ "Riau",
+ "Kepulauan Riau",
+ "Jambi",
+ "Lampung",
+ "Bangka Belitung",
+ "Kalimantan Barat",
+ "Kalimantan Timur",
+ "Kalimantan Selatan",
+ "Kalimantan Tengah",
+ "Kalimantan Utara",
+ "DKI Jakarta",
+ "Jawa Barat",
+ "Jawa Tengah",
+ "DI Yogyakarta",
+ "Jawa Timur",
+ "Nusa Tenggara Timur",
+ "Nusa Tenggara Barat",
+ "Gorontalo",
+ "Sulawesi Barat",
+ "Sulawesi Tengah",
+ "Sulawesi Utara",
+ "Sulawesi Tenggara",
+ "Sulawesi Selatan",
+ "Maluku Utara",
+ "Maluku",
+ "Papua Barat",
+ "Papua",
+ "Papua Tengah",
+ "Papua Pegunungan",
+ "Papua Selatan",
+ "Papua Barat Daya",
+];
+
diff --git a/app/lib/features/authentication/register/bloc/user_register_bloc.dart b/app/lib/features/authentication/register/bloc/user_register_bloc.dart
new file mode 100644
index 0000000..69fcd41
--- /dev/null
+++ b/app/lib/features/authentication/register/bloc/user_register_bloc.dart
@@ -0,0 +1,157 @@
+import 'dart:async';
+
+import 'package:equatable/equatable.dart';
+import 'package:firebase_auth/firebase_auth.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:injectable/injectable.dart';
+
+import '../../../authentication/register/repositories/register_user_repo.dart';
+import '../model/form_item.dart';
+
+part 'user_register_event.dart';
+
+part 'user_register_state.dart';
+
+@injectable
+@singleton
+class UserRegisterBloc extends Bloc {
+ final RegisterUserRepository registerUserRepository;
+ UserRegisterBloc(this.registerUserRepository) : super(const RegisterFormState()) {
+ on(_initState);
+ on(_onEmailChanged);
+ on(_onNameChanged);
+ on(_onBirthDateChanged);
+ on(_onSchoolChanged);
+ on(_onProvinceChanged);
+ on(_onBebrasBiroChanged);
+ on(_onFormSubmitted);
+ on(_onFormReset);
+ }
+
+ final formKey = GlobalKey();
+
+ Future _initState(InitEvent event, Emitter emit) async {
+ emit(state.copyWith(formKey: formKey));
+ }
+
+ Future _onNameChanged(
+ NameEvent event, Emitter emit) async {
+ emit(
+ state.copyWith(
+ name: BlocFormItem(
+ value: event.name.value,
+ error: event.name.value == '' ? 'Mohon mengisi nama terlebih dahulu.' : null,
+ ),
+ formKey: formKey,
+ ),
+ );
+ }
+
+ Future _onEmailChanged(
+ EmailEvent event, Emitter emit) async {
+ emit(
+ state.copyWith(
+ email: BlocFormItem(
+ value: event.email.value,
+ error: event.email.value == '' ? 'Mohon mengisi e-mail terlebih dahulu.' : null,
+ ),
+ formKey: formKey,
+ ),
+ );
+ }
+
+ Future _onBirthDateChanged(
+ BirthDateEvent event, Emitter emit) async {
+ emit(
+ state.copyWith(
+ birth_date: BlocFormItem(
+ value: event.birthDate.value,
+ error: event.birthDate.value == '' ? 'Mohon mengisi tanggal lahir terlebih dahulu.' : null,
+ ),
+ formKey: formKey,
+ ),
+ );
+ }
+
+ Future _onSchoolChanged(
+ SchoolEvent event, Emitter emit) async {
+ emit(
+ state.copyWith(
+ school: BlocFormItem(
+ value: event.school.value,
+ error: event.school.value == '' ? 'Mohon mengisi nama sekolah terlebih dahulu.' : null,
+ ),
+ formKey: formKey,
+ ),
+ );
+ }
+
+ Future _onProvinceChanged(
+ ProvinceEvent event, Emitter emit) async {
+ emit(
+ state.copyWith(
+ province: BlocFormItem(
+ value: event.province.value,
+ error: event.province.value == '' ? 'Mohon mengisi nama provinsi terlebih dahulu.' : null,
+ ),
+ formKey: formKey,
+ ),
+ );
+ }
+
+ Future _onBebrasBiroChanged(
+ BebrasBiroEvent event, Emitter emit) async {
+ emit(
+ state.copyWith(
+ bebras_biro: BlocFormItem(
+ value: event.bebras_biro.value,
+ error: event.bebras_biro.value == '' ? 'Mohon mengisi biro bebras terlebih dahulu.' : null,
+ ),
+ formKey: formKey,
+ ),
+ );
+ }
+
+ Future _onFormReset(
+ FormResetEvent event,
+ Emitter emit,
+ ) async {
+ state.formKey?.currentState?.reset();
+ }
+
+ Future _onFormSubmitted(
+ FormSubmitEvent event,
+ Emitter emit,
+ ) async {
+ final FirebaseAuth auth = FirebaseAuth.instance;
+ String userId = auth.currentUser?.uid as String;
+
+ if (state.formKey!.currentState!.validate()) {
+
+ String email = state.email.value.toString();
+ String name = state.name.value.toString();
+ String birthDate = state.birth_date.value.toString();
+ String school = state.school.value.toString();
+ String province = state.province.value.toString();
+ String bebrasBiro = state.bebras_biro.value.toString();
+
+ emit(UserRegisterLoadingState());
+
+ try {
+ await registerUserRepository.create(
+ userId: userId,
+ email: email,
+ name: name,
+ birth_date: birthDate,
+ school: school,
+ province: province,
+ bebras_biro: bebrasBiro,
+ );
+ emit(UserRegisterSuccessState());
+ } catch (e) {
+ // emit(Us)
+ }
+ }
+ }
+}
diff --git a/app/lib/features/authentication/register/bloc/user_register_event.dart b/app/lib/features/authentication/register/bloc/user_register_event.dart
new file mode 100644
index 0000000..9513ead
--- /dev/null
+++ b/app/lib/features/authentication/register/bloc/user_register_event.dart
@@ -0,0 +1,62 @@
+part of 'user_register_bloc.dart';
+
+abstract class UserRegisterEvent extends Equatable {
+ const UserRegisterEvent();
+
+ @override
+ List