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 =
|
final TextEditingController confirmPasswordController =
|
||||||
TextEditingController();
|
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
|
// Form keys
|
||||||
final GlobalKey<FormState> loginFormKey = GlobalKey<FormState>();
|
final GlobalKey<FormState> loginFormKey = GlobalKey<FormState>();
|
||||||
final GlobalKey<FormState> registerFormKey = GlobalKey<FormState>();
|
final GlobalKey<FormState> registerFormKey = GlobalKey<FormState>();
|
||||||
@ -58,30 +48,13 @@ class AuthController extends GetxController {
|
|||||||
try {
|
try {
|
||||||
if (emailController.text.isNotEmpty) emailController.clear();
|
if (emailController.text.isNotEmpty) emailController.clear();
|
||||||
if (passwordController.text.isNotEmpty) passwordController.clear();
|
if (passwordController.text.isNotEmpty) passwordController.clear();
|
||||||
if (confirmPasswordController.text.isNotEmpty)
|
if (confirmPasswordController.text.isNotEmpty) {
|
||||||
confirmPasswordController.clear();
|
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();
|
emailController.dispose();
|
||||||
passwordController.dispose();
|
passwordController.dispose();
|
||||||
confirmPasswordController.dispose();
|
confirmPasswordController.dispose();
|
||||||
nikController.dispose();
|
|
||||||
namaLengkapController.dispose();
|
|
||||||
jenisKelaminController.dispose();
|
|
||||||
noHpController.dispose();
|
|
||||||
alamatController.dispose();
|
|
||||||
tempatLahirController.dispose();
|
|
||||||
tanggalLahirController.dispose();
|
|
||||||
agamaController.dispose();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error disposing controllers: $e');
|
print('Error disposing controllers: $e');
|
||||||
}
|
}
|
||||||
@ -108,19 +81,19 @@ class AuthController extends GetxController {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Jika tidak ada user yang login, arahkan ke halaman login
|
// 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
|
// Bersihkan dependensi form sebelum navigasi
|
||||||
clearFormDependencies();
|
clearFormDependencies();
|
||||||
Get.offAllNamed(Routes.LOGIN);
|
Get.offAllNamed(Routes.login);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error checking auth status: $e');
|
print('Error checking auth status: $e');
|
||||||
// Jika terjadi error, arahkan ke halaman login
|
// Jika terjadi error, arahkan ke halaman login
|
||||||
if (Get.currentRoute != Routes.LOGIN) {
|
if (Get.currentRoute != Routes.login) {
|
||||||
// Bersihkan dependensi form sebelum navigasi
|
// Bersihkan dependensi form sebelum navigasi
|
||||||
clearFormDependencies();
|
clearFormDependencies();
|
||||||
Get.offAllNamed(Routes.LOGIN);
|
Get.offAllNamed(Routes.login);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
@ -164,19 +137,19 @@ class AuthController extends GetxController {
|
|||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case 'WARGA':
|
case 'WARGA':
|
||||||
Get.offAllNamed(Routes.WARGA_DASHBOARD);
|
Get.offAllNamed(Routes.wargaDashboard);
|
||||||
break;
|
break;
|
||||||
case 'PETUGASVERIFIKASI':
|
case 'PETUGASVERIFIKASI':
|
||||||
Get.offAllNamed(Routes.PETUGAS_VERIFIKASI_DASHBOARD);
|
Get.offAllNamed(Routes.petugasVerifikasiDashboard);
|
||||||
break;
|
break;
|
||||||
case 'PETUGASDESA':
|
case 'PETUGASDESA':
|
||||||
Get.offAllNamed(Routes.PETUGAS_DESA_DASHBOARD);
|
Get.offAllNamed(Routes.petugasDesaDashboard);
|
||||||
break;
|
break;
|
||||||
case 'DONATUR':
|
case 'DONATUR':
|
||||||
Get.offAllNamed(Routes.DONATUR_DASHBOARD);
|
Get.offAllNamed(Routes.donaturDashboard);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Get.offAllNamed(Routes.HOME);
|
Get.offAllNamed(Routes.home);
|
||||||
break;
|
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
|
// Metode untuk logout
|
||||||
Future<void> logout() async {
|
Future<void> logout() async {
|
||||||
try {
|
try {
|
||||||
@ -390,7 +283,7 @@ class AuthController extends GetxController {
|
|||||||
// Bersihkan dependensi form sebelum navigasi
|
// Bersihkan dependensi form sebelum navigasi
|
||||||
clearFormDependencies();
|
clearFormDependencies();
|
||||||
|
|
||||||
Get.offAllNamed(Routes.LOGIN);
|
Get.offAllNamed(Routes.login);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Get.snackbar(
|
Get.snackbar(
|
||||||
'Error',
|
'Error',
|
||||||
@ -407,8 +300,9 @@ class AuthController extends GetxController {
|
|||||||
try {
|
try {
|
||||||
if (emailController.text.isNotEmpty) emailController.clear();
|
if (emailController.text.isNotEmpty) emailController.clear();
|
||||||
if (passwordController.text.isNotEmpty) passwordController.clear();
|
if (passwordController.text.isNotEmpty) passwordController.clear();
|
||||||
if (confirmPasswordController.text.isNotEmpty)
|
if (confirmPasswordController.text.isNotEmpty) {
|
||||||
confirmPasswordController.clear();
|
confirmPasswordController.clear();
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error clearing controllers: $e');
|
print('Error clearing controllers: $e');
|
||||||
}
|
}
|
||||||
@ -489,24 +383,15 @@ class AuthController extends GetxController {
|
|||||||
String _getTargetRouteForRole(String role) {
|
String _getTargetRouteForRole(String role) {
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case 'WARGA':
|
case 'WARGA':
|
||||||
return Routes.WARGA_DASHBOARD;
|
return Routes.wargaDashboard;
|
||||||
case 'PETUGASVERIFIKASI':
|
case 'PETUGASVERIFIKASI':
|
||||||
return Routes.PETUGAS_VERIFIKASI_DASHBOARD;
|
return Routes.petugasVerifikasiDashboard;
|
||||||
case 'PETUGASDESA':
|
case 'PETUGASDESA':
|
||||||
return Routes.PETUGAS_DESA_DASHBOARD;
|
return Routes.petugasDesaDashboard;
|
||||||
case 'DONATUR':
|
case 'DONATUR':
|
||||||
return Routes.DONATUR_DASHBOARD;
|
return Routes.donaturDashboard;
|
||||||
default:
|
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),
|
const SizedBox(height: 50),
|
||||||
|
|
||||||
// Email Field
|
// Email Field
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: controller.emailController,
|
controller: controller.emailController,
|
||||||
@ -57,7 +57,7 @@ class LoginView extends GetView<AuthController> {
|
|||||||
validator: controller.validateEmail,
|
validator: controller.validateEmail,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
|
|
||||||
// Password Field
|
// Password Field
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: controller.passwordController,
|
controller: controller.passwordController,
|
||||||
@ -72,7 +72,7 @@ class LoginView extends GetView<AuthController> {
|
|||||||
validator: controller.validatePassword,
|
validator: controller.validatePassword,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
|
|
||||||
// Forgot Password
|
// Forgot Password
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
@ -84,40 +84,40 @@ class LoginView extends GetView<AuthController> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
|
|
||||||
// Login Button
|
// Login Button
|
||||||
Obx(() => ElevatedButton(
|
Obx(() => ElevatedButton(
|
||||||
onPressed: controller.isLoading.value
|
onPressed: controller.isLoading.value
|
||||||
? null
|
? null
|
||||||
: controller.login,
|
: controller.login,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 15),
|
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(10),
|
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,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)),
|
),
|
||||||
|
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),
|
const SizedBox(height: 20),
|
||||||
|
|
||||||
// Register Link
|
// Register Link
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const Text('Belum punya akun?'),
|
const Text('Belum punya akun?'),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Get.toNamed(Routes.REGISTER),
|
onPressed: () => Get.toNamed(Routes.register),
|
||||||
child: const Text('Daftar'),
|
child: const Text('Daftar'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -130,4 +130,4 @@ class LoginView extends GetView<AuthController> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ class RegisterView extends GetView<AuthController> {
|
|||||||
children: [
|
children: [
|
||||||
const Text('Sudah punya akun?'),
|
const Text('Sudah punya akun?'),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Get.offAllNamed(Routes.LOGIN),
|
onPressed: () => Get.offAllNamed(Routes.login),
|
||||||
child: const Text('Masuk'),
|
child: const Text('Masuk'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -211,14 +211,6 @@ class WargaDashboardView extends GetView<DashboardController> {
|
|||||||
style: TextStyle(fontSize: 12),
|
style: TextStyle(fontSize: 12),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
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:get/get.dart';
|
||||||
import 'package:penyaluran_app/app/modules/auth/views/login_view.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/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/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/warga_dashboard_view.dart';
|
||||||
import 'package:penyaluran_app/app/modules/dashboard/views/petugas_verifikasi_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 {
|
class AppPages {
|
||||||
AppPages._();
|
AppPages._();
|
||||||
|
|
||||||
static const INITIAL = Routes.LOGIN;
|
static const initial = Routes.login;
|
||||||
|
|
||||||
static final routes = [
|
static final routes = [
|
||||||
GetPage(
|
GetPage(
|
||||||
name: _Paths.HOME,
|
name: _Paths.home,
|
||||||
page: () => const HomeView(),
|
page: () => const HomeView(),
|
||||||
binding: HomeBinding(),
|
binding: HomeBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: _Paths.LOGIN,
|
name: _Paths.login,
|
||||||
page: () => const LoginView(),
|
page: () => const LoginView(),
|
||||||
binding: AuthBinding(),
|
binding: AuthBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: _Paths.REGISTER,
|
name: _Paths.register,
|
||||||
page: () => const RegisterView(),
|
page: () => const RegisterView(),
|
||||||
binding: AuthBinding(),
|
binding: AuthBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: _Paths.COMPLETE_PROFILE,
|
name: _Paths.wargaDashboard,
|
||||||
page: () => const CompleteProfileView(),
|
|
||||||
binding: AuthBinding(),
|
|
||||||
),
|
|
||||||
GetPage(
|
|
||||||
name: _Paths.WARGA_DASHBOARD,
|
|
||||||
page: () => const WargaDashboardView(),
|
page: () => const WargaDashboardView(),
|
||||||
binding: DashboardBinding(),
|
binding: DashboardBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: _Paths.PETUGAS_VERIFIKASI_DASHBOARD,
|
name: _Paths.petugasVerifikasiDashboard,
|
||||||
page: () => const PetugasVerifikasiDashboardView(),
|
page: () => const PetugasVerifikasiDashboardView(),
|
||||||
binding: DashboardBinding(),
|
binding: DashboardBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: _Paths.PETUGAS_DESA_DASHBOARD,
|
name: _Paths.petugasDesaDashboard,
|
||||||
page: () => const PetugasDesaDashboardView(),
|
page: () => const PetugasDesaDashboardView(),
|
||||||
binding: DashboardBinding(),
|
binding: DashboardBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: _Paths.DONATUR_DASHBOARD,
|
name: _Paths.donaturDashboard,
|
||||||
page: () => const DonaturDashboardView(),
|
page: () => const DonaturDashboardView(),
|
||||||
binding: DashboardBinding(),
|
binding: DashboardBinding(),
|
||||||
),
|
),
|
||||||
|
@ -2,25 +2,22 @@ part of 'app_pages.dart';
|
|||||||
|
|
||||||
abstract class Routes {
|
abstract class Routes {
|
||||||
Routes._();
|
Routes._();
|
||||||
static const HOME = _Paths.HOME;
|
static const home = _Paths.home;
|
||||||
static const LOGIN = _Paths.LOGIN;
|
static const login = _Paths.login;
|
||||||
static const REGISTER = _Paths.REGISTER;
|
static const register = _Paths.register;
|
||||||
static const COMPLETE_PROFILE = _Paths.COMPLETE_PROFILE;
|
static const wargaDashboard = _Paths.wargaDashboard;
|
||||||
static const WARGA_DASHBOARD = _Paths.WARGA_DASHBOARD;
|
static const petugasVerifikasiDashboard = _Paths.petugasVerifikasiDashboard;
|
||||||
static const PETUGAS_VERIFIKASI_DASHBOARD =
|
static const petugasDesaDashboard = _Paths.petugasDesaDashboard;
|
||||||
_Paths.PETUGAS_VERIFIKASI_DASHBOARD;
|
static const donaturDashboard = _Paths.donaturDashboard;
|
||||||
static const PETUGAS_DESA_DASHBOARD = _Paths.PETUGAS_DESA_DASHBOARD;
|
|
||||||
static const DONATUR_DASHBOARD = _Paths.DONATUR_DASHBOARD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _Paths {
|
abstract class _Paths {
|
||||||
_Paths._();
|
_Paths._();
|
||||||
static const HOME = '/home';
|
static const home = '/home';
|
||||||
static const LOGIN = '/login';
|
static const login = '/login';
|
||||||
static const REGISTER = '/register';
|
static const register = '/register';
|
||||||
static const COMPLETE_PROFILE = '/complete-profile';
|
static const wargaDashboard = '/warga-dashboard';
|
||||||
static const WARGA_DASHBOARD = '/warga-dashboard';
|
static const petugasVerifikasiDashboard = '/petugas-verifikasi-dashboard';
|
||||||
static const PETUGAS_VERIFIKASI_DASHBOARD = '/petugas-verifikasi-dashboard';
|
static const petugasDesaDashboard = '/petugas-desa-dashboard';
|
||||||
static const PETUGAS_DESA_DASHBOARD = '/petugas-desa-dashboard';
|
static const donaturDashboard = '/donatur-dashboard';
|
||||||
static const DONATUR_DASHBOARD = '/donatur-dashboard';
|
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ class MyApp extends StatelessWidget {
|
|||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
),
|
),
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
initialRoute: AppPages.INITIAL,
|
initialRoute: AppPages.initial,
|
||||||
getPages: AppPages.routes,
|
getPages: AppPages.routes,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user