Refactor routing dan hapus fitur lengkapi profil
- Ubah konstanta rute menjadi lowercase - Hapus metode dan tampilan lengkapi profil - Hapus kontroler dan field yang tidak digunakan - Perbarui navigasi dengan rute baru - Singkronkan perubahan di seluruh modul auth
This commit is contained in:
@ -21,16 +21,6 @@ class AuthController extends GetxController {
|
||||
final TextEditingController confirmPasswordController =
|
||||
TextEditingController();
|
||||
|
||||
// Form controllers untuk data warga
|
||||
final TextEditingController nikController = TextEditingController();
|
||||
final TextEditingController namaLengkapController = TextEditingController();
|
||||
final TextEditingController jenisKelaminController = TextEditingController();
|
||||
final TextEditingController noHpController = TextEditingController();
|
||||
final TextEditingController alamatController = TextEditingController();
|
||||
final TextEditingController tempatLahirController = TextEditingController();
|
||||
final TextEditingController tanggalLahirController = TextEditingController();
|
||||
final TextEditingController agamaController = TextEditingController();
|
||||
|
||||
// Form keys
|
||||
final GlobalKey<FormState> loginFormKey = GlobalKey<FormState>();
|
||||
final GlobalKey<FormState> registerFormKey = GlobalKey<FormState>();
|
||||
@ -58,30 +48,13 @@ class AuthController extends GetxController {
|
||||
try {
|
||||
if (emailController.text.isNotEmpty) emailController.clear();
|
||||
if (passwordController.text.isNotEmpty) passwordController.clear();
|
||||
if (confirmPasswordController.text.isNotEmpty)
|
||||
if (confirmPasswordController.text.isNotEmpty) {
|
||||
confirmPasswordController.clear();
|
||||
if (nikController.text.isNotEmpty) nikController.clear();
|
||||
if (namaLengkapController.text.isNotEmpty) namaLengkapController.clear();
|
||||
if (jenisKelaminController.text.isNotEmpty)
|
||||
jenisKelaminController.clear();
|
||||
if (noHpController.text.isNotEmpty) noHpController.clear();
|
||||
if (alamatController.text.isNotEmpty) alamatController.clear();
|
||||
if (tempatLahirController.text.isNotEmpty) tempatLahirController.clear();
|
||||
if (tanggalLahirController.text.isNotEmpty)
|
||||
tanggalLahirController.clear();
|
||||
if (agamaController.text.isNotEmpty) agamaController.clear();
|
||||
}
|
||||
|
||||
emailController.dispose();
|
||||
passwordController.dispose();
|
||||
confirmPasswordController.dispose();
|
||||
nikController.dispose();
|
||||
namaLengkapController.dispose();
|
||||
jenisKelaminController.dispose();
|
||||
noHpController.dispose();
|
||||
alamatController.dispose();
|
||||
tempatLahirController.dispose();
|
||||
tanggalLahirController.dispose();
|
||||
agamaController.dispose();
|
||||
} catch (e) {
|
||||
print('Error disposing controllers: $e');
|
||||
}
|
||||
@ -108,19 +81,19 @@ class AuthController extends GetxController {
|
||||
}
|
||||
} else {
|
||||
// Jika tidak ada user yang login, arahkan ke halaman login
|
||||
if (Get.currentRoute != Routes.LOGIN) {
|
||||
if (Get.currentRoute != Routes.login) {
|
||||
// Bersihkan dependensi form sebelum navigasi
|
||||
clearFormDependencies();
|
||||
Get.offAllNamed(Routes.LOGIN);
|
||||
Get.offAllNamed(Routes.login);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error checking auth status: $e');
|
||||
// Jika terjadi error, arahkan ke halaman login
|
||||
if (Get.currentRoute != Routes.LOGIN) {
|
||||
if (Get.currentRoute != Routes.login) {
|
||||
// Bersihkan dependensi form sebelum navigasi
|
||||
clearFormDependencies();
|
||||
Get.offAllNamed(Routes.LOGIN);
|
||||
Get.offAllNamed(Routes.login);
|
||||
}
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
@ -164,19 +137,19 @@ class AuthController extends GetxController {
|
||||
|
||||
switch (role) {
|
||||
case 'WARGA':
|
||||
Get.offAllNamed(Routes.WARGA_DASHBOARD);
|
||||
Get.offAllNamed(Routes.wargaDashboard);
|
||||
break;
|
||||
case 'PETUGASVERIFIKASI':
|
||||
Get.offAllNamed(Routes.PETUGAS_VERIFIKASI_DASHBOARD);
|
||||
Get.offAllNamed(Routes.petugasVerifikasiDashboard);
|
||||
break;
|
||||
case 'PETUGASDESA':
|
||||
Get.offAllNamed(Routes.PETUGAS_DESA_DASHBOARD);
|
||||
Get.offAllNamed(Routes.petugasDesaDashboard);
|
||||
break;
|
||||
case 'DONATUR':
|
||||
Get.offAllNamed(Routes.DONATUR_DASHBOARD);
|
||||
Get.offAllNamed(Routes.donaturDashboard);
|
||||
break;
|
||||
default:
|
||||
Get.offAllNamed(Routes.HOME);
|
||||
Get.offAllNamed(Routes.home);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -300,86 +273,6 @@ class AuthController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
// Metode untuk melengkapi profil warga
|
||||
Future<void> completeWargaProfile() async {
|
||||
if (!wargaProfileFormKey.currentState!.validate()) return;
|
||||
|
||||
// Simpan nilai dari controller sebelum melakukan operasi asinkron
|
||||
final nik = nikController.text.trim();
|
||||
final namaLengkap = namaLengkapController.text.trim();
|
||||
final jenisKelamin = jenisKelaminController.text.trim();
|
||||
final noHp = noHpController.text.trim();
|
||||
final alamat = alamatController.text.trim();
|
||||
final tempatLahir = tempatLahirController.text.trim();
|
||||
final tanggalLahirText = tanggalLahirController.text;
|
||||
final agama = agamaController.text.trim();
|
||||
|
||||
try {
|
||||
isLoading.value = true;
|
||||
|
||||
DateTime? tanggalLahir;
|
||||
if (tanggalLahirText.isNotEmpty) {
|
||||
try {
|
||||
final parts = tanggalLahirText.split('-');
|
||||
if (parts.length == 3) {
|
||||
tanggalLahir = DateTime(
|
||||
int.parse(parts[2]), // tahun
|
||||
int.parse(parts[1]), // bulan
|
||||
int.parse(parts[0]), // hari
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error parsing date: $e');
|
||||
}
|
||||
}
|
||||
|
||||
await _authProvider.createWargaProfile(
|
||||
nik: nik,
|
||||
namaLengkap: namaLengkap,
|
||||
jenisKelamin: jenisKelamin,
|
||||
noHp: noHp,
|
||||
alamat: alamat,
|
||||
tempatLahir: tempatLahir,
|
||||
tanggalLahir: tanggalLahir,
|
||||
agama: agama,
|
||||
);
|
||||
|
||||
isWargaProfileComplete.value = true;
|
||||
|
||||
// Kembali ke halaman sebelumnya jika menggunakan Get.toNamed
|
||||
if (Get.previousRoute.isNotEmpty) {
|
||||
Get.back();
|
||||
Get.snackbar(
|
||||
'Berhasil',
|
||||
'Profil berhasil dilengkapi',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
} else {
|
||||
// Jika tidak ada halaman sebelumnya, navigasi ke dashboard warga
|
||||
Get.offAllNamed(Routes.WARGA_DASHBOARD);
|
||||
Get.snackbar(
|
||||
'Berhasil',
|
||||
'Profil berhasil dilengkapi',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Gagal melengkapi profil: ${e.toString()}',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Metode untuk logout
|
||||
Future<void> logout() async {
|
||||
try {
|
||||
@ -390,7 +283,7 @@ class AuthController extends GetxController {
|
||||
// Bersihkan dependensi form sebelum navigasi
|
||||
clearFormDependencies();
|
||||
|
||||
Get.offAllNamed(Routes.LOGIN);
|
||||
Get.offAllNamed(Routes.login);
|
||||
} catch (e) {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
@ -407,8 +300,9 @@ class AuthController extends GetxController {
|
||||
try {
|
||||
if (emailController.text.isNotEmpty) emailController.clear();
|
||||
if (passwordController.text.isNotEmpty) passwordController.clear();
|
||||
if (confirmPasswordController.text.isNotEmpty)
|
||||
if (confirmPasswordController.text.isNotEmpty) {
|
||||
confirmPasswordController.clear();
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error clearing controllers: $e');
|
||||
}
|
||||
@ -489,24 +383,15 @@ class AuthController extends GetxController {
|
||||
String _getTargetRouteForRole(String role) {
|
||||
switch (role) {
|
||||
case 'WARGA':
|
||||
return Routes.WARGA_DASHBOARD;
|
||||
return Routes.wargaDashboard;
|
||||
case 'PETUGASVERIFIKASI':
|
||||
return Routes.PETUGAS_VERIFIKASI_DASHBOARD;
|
||||
return Routes.petugasVerifikasiDashboard;
|
||||
case 'PETUGASDESA':
|
||||
return Routes.PETUGAS_DESA_DASHBOARD;
|
||||
return Routes.petugasDesaDashboard;
|
||||
case 'DONATUR':
|
||||
return Routes.DONATUR_DASHBOARD;
|
||||
return Routes.donaturDashboard;
|
||||
default:
|
||||
return Routes.HOME;
|
||||
return Routes.home;
|
||||
}
|
||||
}
|
||||
|
||||
// Metode untuk navigasi ke halaman lengkapi profil
|
||||
void navigateToCompleteProfile() {
|
||||
// Bersihkan dependensi form sebelum navigasi
|
||||
clearFormDependencies();
|
||||
|
||||
// Gunakan preventDuplicates untuk mencegah navigasi berulang
|
||||
Get.toNamed(Routes.COMPLETE_PROFILE, preventDuplicates: true);
|
||||
}
|
||||
}
|
||||
|
@ -1,270 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:penyaluran_app/app/modules/auth/controllers/auth_controller.dart';
|
||||
|
||||
class CompleteProfileView extends GetView<AuthController> {
|
||||
const CompleteProfileView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Lengkapi Profil'),
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
onPressed: () => Get.back(),
|
||||
),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Form(
|
||||
key: controller.wargaProfileFormKey,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
const Center(
|
||||
child: Text(
|
||||
'Lengkapi Data Diri Anda',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
const Center(
|
||||
child: Text(
|
||||
'Data ini diperlukan untuk verifikasi',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
|
||||
// NIK Field
|
||||
TextFormField(
|
||||
controller: controller.nikController,
|
||||
keyboardType: TextInputType.number,
|
||||
maxLength: 16,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'NIK',
|
||||
prefixIcon: const Icon(Icons.credit_card),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
validator: controller.validateNIK,
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
|
||||
// Nama Lengkap Field
|
||||
TextFormField(
|
||||
controller: controller.namaLengkapController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Nama Lengkap',
|
||||
prefixIcon: const Icon(Icons.person),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
validator: controller.validateNamaLengkap,
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
|
||||
// Jenis Kelamin Field
|
||||
DropdownButtonFormField<String>(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Jenis Kelamin',
|
||||
prefixIcon: const Icon(Icons.people),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: 'LAKI-LAKI',
|
||||
child: Text('Laki-laki'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'PEREMPUAN',
|
||||
child: Text('Perempuan'),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
controller.jenisKelaminController.text = value ?? '';
|
||||
},
|
||||
validator: controller.validateJenisKelamin,
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
|
||||
// No HP Field
|
||||
TextFormField(
|
||||
controller: controller.noHpController,
|
||||
keyboardType: TextInputType.phone,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'No. HP',
|
||||
prefixIcon: const Icon(Icons.phone),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
|
||||
// Alamat Field
|
||||
TextFormField(
|
||||
controller: controller.alamatController,
|
||||
maxLines: 3,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Alamat',
|
||||
prefixIcon: const Icon(Icons.home),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
|
||||
// Tempat Lahir Field
|
||||
TextFormField(
|
||||
controller: controller.tempatLahirController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Tempat Lahir',
|
||||
prefixIcon: const Icon(Icons.location_city),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
|
||||
// Tanggal Lahir Field
|
||||
TextFormField(
|
||||
controller: controller.tanggalLahirController,
|
||||
keyboardType: TextInputType.datetime,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Tanggal Lahir (DD-MM-YYYY)',
|
||||
prefixIcon: const Icon(Icons.calendar_today),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
onTap: () async {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
final DateTime? picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(1900),
|
||||
lastDate: DateTime.now(),
|
||||
);
|
||||
if (picked != null) {
|
||||
controller.tanggalLahirController.text =
|
||||
'${picked.day.toString().padLeft(2, '0')}-'
|
||||
'${picked.month.toString().padLeft(2, '0')}-'
|
||||
'${picked.year}';
|
||||
}
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
|
||||
// Agama Field
|
||||
DropdownButtonFormField<String>(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Agama',
|
||||
prefixIcon: const Icon(Icons.church),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: 'ISLAM',
|
||||
child: Text('Islam'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'KRISTEN PROTESTAN',
|
||||
child: Text('Kristen Protestan'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'KRISTEN KATOLIK',
|
||||
child: Text('Kristen Katolik'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'HINDU',
|
||||
child: Text('Hindu'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'BUDHA',
|
||||
child: Text('Budha'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'KONGHUCU',
|
||||
child: Text('Konghucu'),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
controller.agamaController.text = value ?? '';
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
|
||||
// Submit Button
|
||||
Obx(() => ElevatedButton(
|
||||
onPressed: controller.isLoading.value
|
||||
? null
|
||||
: controller.completeWargaProfile,
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: controller.isLoading.value
|
||||
? const SpinKitThreeBounce(
|
||||
color: Colors.white,
|
||||
size: 24,
|
||||
)
|
||||
: const Text(
|
||||
'SIMPAN',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
)),
|
||||
const SizedBox(height: 15),
|
||||
|
||||
// Kembali Button
|
||||
OutlinedButton(
|
||||
onPressed: () => Get.back(),
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'KEMBALI KE DASHBOARD',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -42,7 +42,7 @@ class LoginView extends GetView<AuthController> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 50),
|
||||
|
||||
|
||||
// Email Field
|
||||
TextFormField(
|
||||
controller: controller.emailController,
|
||||
@ -57,7 +57,7 @@ class LoginView extends GetView<AuthController> {
|
||||
validator: controller.validateEmail,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
|
||||
// Password Field
|
||||
TextFormField(
|
||||
controller: controller.passwordController,
|
||||
@ -72,7 +72,7 @@ class LoginView extends GetView<AuthController> {
|
||||
validator: controller.validatePassword,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
|
||||
|
||||
// Forgot Password
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
@ -84,40 +84,40 @@ class LoginView extends GetView<AuthController> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
|
||||
// Login Button
|
||||
Obx(() => ElevatedButton(
|
||||
onPressed: controller.isLoading.value
|
||||
? null
|
||||
: controller.login,
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: controller.isLoading.value
|
||||
? const SpinKitThreeBounce(
|
||||
color: Colors.white,
|
||||
size: 24,
|
||||
)
|
||||
: const Text(
|
||||
'MASUK',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
onPressed: controller.isLoading.value
|
||||
? null
|
||||
: controller.login,
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
)),
|
||||
),
|
||||
child: controller.isLoading.value
|
||||
? const SpinKitThreeBounce(
|
||||
color: Colors.white,
|
||||
size: 24,
|
||||
)
|
||||
: const Text(
|
||||
'MASUK',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
)),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
|
||||
// Register Link
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text('Belum punya akun?'),
|
||||
TextButton(
|
||||
onPressed: () => Get.toNamed(Routes.REGISTER),
|
||||
onPressed: () => Get.toNamed(Routes.register),
|
||||
child: const Text('Daftar'),
|
||||
),
|
||||
],
|
||||
@ -130,4 +130,4 @@ class LoginView extends GetView<AuthController> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ class RegisterView extends GetView<AuthController> {
|
||||
children: [
|
||||
const Text('Sudah punya akun?'),
|
||||
TextButton(
|
||||
onPressed: () => Get.offAllNamed(Routes.LOGIN),
|
||||
onPressed: () => Get.offAllNamed(Routes.login),
|
||||
child: const Text('Masuk'),
|
||||
),
|
||||
],
|
||||
|
@ -211,14 +211,6 @@ class WargaDashboardView extends GetView<DashboardController> {
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
ElevatedButton(
|
||||
onPressed: authController.navigateToCompleteProfile,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.orange,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
child: const Text('Lengkapi Profil'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -1,7 +1,6 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:penyaluran_app/app/modules/auth/views/login_view.dart';
|
||||
import 'package:penyaluran_app/app/modules/auth/views/register_view.dart';
|
||||
import 'package:penyaluran_app/app/modules/auth/views/complete_profile_view.dart';
|
||||
import 'package:penyaluran_app/app/modules/home/views/home_view.dart';
|
||||
import 'package:penyaluran_app/app/modules/dashboard/views/warga_dashboard_view.dart';
|
||||
import 'package:penyaluran_app/app/modules/dashboard/views/petugas_verifikasi_dashboard_view.dart';
|
||||
@ -16,46 +15,41 @@ part 'app_routes.dart';
|
||||
class AppPages {
|
||||
AppPages._();
|
||||
|
||||
static const INITIAL = Routes.LOGIN;
|
||||
static const initial = Routes.login;
|
||||
|
||||
static final routes = [
|
||||
GetPage(
|
||||
name: _Paths.HOME,
|
||||
name: _Paths.home,
|
||||
page: () => const HomeView(),
|
||||
binding: HomeBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: _Paths.LOGIN,
|
||||
name: _Paths.login,
|
||||
page: () => const LoginView(),
|
||||
binding: AuthBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: _Paths.REGISTER,
|
||||
name: _Paths.register,
|
||||
page: () => const RegisterView(),
|
||||
binding: AuthBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: _Paths.COMPLETE_PROFILE,
|
||||
page: () => const CompleteProfileView(),
|
||||
binding: AuthBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: _Paths.WARGA_DASHBOARD,
|
||||
name: _Paths.wargaDashboard,
|
||||
page: () => const WargaDashboardView(),
|
||||
binding: DashboardBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: _Paths.PETUGAS_VERIFIKASI_DASHBOARD,
|
||||
name: _Paths.petugasVerifikasiDashboard,
|
||||
page: () => const PetugasVerifikasiDashboardView(),
|
||||
binding: DashboardBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: _Paths.PETUGAS_DESA_DASHBOARD,
|
||||
name: _Paths.petugasDesaDashboard,
|
||||
page: () => const PetugasDesaDashboardView(),
|
||||
binding: DashboardBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: _Paths.DONATUR_DASHBOARD,
|
||||
name: _Paths.donaturDashboard,
|
||||
page: () => const DonaturDashboardView(),
|
||||
binding: DashboardBinding(),
|
||||
),
|
||||
|
@ -2,25 +2,22 @@ part of 'app_pages.dart';
|
||||
|
||||
abstract class Routes {
|
||||
Routes._();
|
||||
static const HOME = _Paths.HOME;
|
||||
static const LOGIN = _Paths.LOGIN;
|
||||
static const REGISTER = _Paths.REGISTER;
|
||||
static const COMPLETE_PROFILE = _Paths.COMPLETE_PROFILE;
|
||||
static const WARGA_DASHBOARD = _Paths.WARGA_DASHBOARD;
|
||||
static const PETUGAS_VERIFIKASI_DASHBOARD =
|
||||
_Paths.PETUGAS_VERIFIKASI_DASHBOARD;
|
||||
static const PETUGAS_DESA_DASHBOARD = _Paths.PETUGAS_DESA_DASHBOARD;
|
||||
static const DONATUR_DASHBOARD = _Paths.DONATUR_DASHBOARD;
|
||||
static const home = _Paths.home;
|
||||
static const login = _Paths.login;
|
||||
static const register = _Paths.register;
|
||||
static const wargaDashboard = _Paths.wargaDashboard;
|
||||
static const petugasVerifikasiDashboard = _Paths.petugasVerifikasiDashboard;
|
||||
static const petugasDesaDashboard = _Paths.petugasDesaDashboard;
|
||||
static const donaturDashboard = _Paths.donaturDashboard;
|
||||
}
|
||||
|
||||
abstract class _Paths {
|
||||
_Paths._();
|
||||
static const HOME = '/home';
|
||||
static const LOGIN = '/login';
|
||||
static const REGISTER = '/register';
|
||||
static const COMPLETE_PROFILE = '/complete-profile';
|
||||
static const WARGA_DASHBOARD = '/warga-dashboard';
|
||||
static const PETUGAS_VERIFIKASI_DASHBOARD = '/petugas-verifikasi-dashboard';
|
||||
static const PETUGAS_DESA_DASHBOARD = '/petugas-desa-dashboard';
|
||||
static const DONATUR_DASHBOARD = '/donatur-dashboard';
|
||||
static const home = '/home';
|
||||
static const login = '/login';
|
||||
static const register = '/register';
|
||||
static const wargaDashboard = '/warga-dashboard';
|
||||
static const petugasVerifikasiDashboard = '/petugas-verifikasi-dashboard';
|
||||
static const petugasDesaDashboard = '/petugas-desa-dashboard';
|
||||
static const donaturDashboard = '/donatur-dashboard';
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class MyApp extends StatelessWidget {
|
||||
useMaterial3: true,
|
||||
),
|
||||
debugShowCheckedModeBanner: false,
|
||||
initialRoute: AppPages.INITIAL,
|
||||
initialRoute: AppPages.initial,
|
||||
getPages: AppPages.routes,
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user