Skip to content

Commit

Permalink
Merge pull request #122 from fleetimee/better_submit_pengajuan
Browse files Browse the repository at this point in the history
feat: better submit pengajuan with loading
  • Loading branch information
fleetimee authored Jan 5, 2023
2 parents 55c28b4 + ad6bd90 commit 76c3778
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 56 deletions.
Binary file added assets/images/home/send.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,10 @@ class InsightDebiturView extends GetView<InsightDebiturController> {
controller.insightDebitur.value,
);
},
text: 'Kirim Pengajuan',
text: controller.insightDebitur.value
.pengajuan!.isNotEmpty
? 'Kirim Pengajuan (lagi ?)'
: 'Kirim Pengajuan',
textStyle: const TextStyle(
color: Colors.white,
fontSize: 20.0,
Expand Down
47 changes: 0 additions & 47 deletions lib/app/modules/login-page/views/login_page_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,53 +41,6 @@ class LoginPageView extends GetView<LoginPageController> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Stack(
// children: [
// Center(
// child: Container(
// padding: const EdgeInsets.symmetric(
// vertical: 40, horizontal: 20),
// child: Image.asset(
// 'assets/images/home/stackable.png',
// fit: BoxFit.cover,
// ),
// ),
// ),
// Positioned(
// top: 160,
// left: 0,
// right: 0,
// child: Column(
// children: [
// Text(
// 'Welcome back',
// style: TextStyle(
// color: Colors.black87,
// fontSize: 35,
// fontFamily:
// GoogleFonts.montserrat().fontFamily,
// fontWeight: FontWeight.w600,
// ),
// ),
// const SizedBox(
// height: 10,
// ),
// Text(
// 'Sign in to your account',
// style: TextStyle(
// color: Colors.black87,
// fontSize: 15,
// fontWeight: FontWeight.bold,
// // add custom google font
// fontFamily:
// GoogleFonts.montserrat().fontFamily,
// ),
// ),
// ],
// ),
// ),
// ],
// ),
const SizedBox(
height: 50,
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// 🐦 Flutter imports:
import 'package:akm/app/modules/insight_debitur/controllers/insight_debitur_controller.dart';
import 'package:akm/app/widget/send_screen.dart';
import 'package:flutter/material.dart';

// 📦 Package imports:
Expand All @@ -14,6 +16,7 @@ import 'package:akm/app/modules/home/controllers/home_controller.dart';
class PengajuanSubmitAnalisController extends GetxController {
// Inject home controller
final homeCtrl = Get.put(HomeController());
final insightCtrl = Get.put(InsightDebiturController());

DebiturInsight data = Get.arguments;
var isPengajuanLoading = false.obs;
Expand Down Expand Up @@ -58,11 +61,17 @@ class PengajuanSubmitAnalisController extends GetxController {

try {
isPengajuanLoading(true);
Get.dialog(
const SendScreen(),
barrierDismissible: false,
);
PengajuanSubmitProvider().submitPengajuanAnalis(body).then((resp) {
isPengajuanLoading(false);
homeCtrl.getMySubmission();
insightCtrl.fetchOneDebitur(data.id!);
resetForm();

Get.back();
Get.back();
Get.snackbar(
'Success',
'Data berhasil disimpan',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ class PengajuanSubmitAnalisView
debugPrint(listFinal.toString());

controller.submitPengajuanAnalis();
Get.back();
} else {
Get.dialog(
const AlertDialog(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// 🐦 Flutter imports:
import 'package:akm/app/widget/send_screen.dart';
import 'package:flutter/material.dart';

// 📦 Package imports:
Expand Down Expand Up @@ -183,12 +184,21 @@ class PengutusSubmitController extends GetxController {

try {
isSubmitLoading(true);
Get.dialog(
const SendScreen(),
barrierDismissible: false,
);
PengajuanSubmitPutusanProvider()
.submitPengajuanPemutus(pengajuan.id!, body)
.then((resp) {
isSubmitLoading(false);
homeCtrl.getMyPendingPemutusan();
homeCtrl.getMyCompletedPutusan();

resetForm();
Get.back();
Get.back();
Get.back();
Get.snackbar(
'Success',
'Data berhasil disimpan',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ class PengutusSubmitView extends GetView<PengutusSubmitController> {
children: const [
Center(
child: Text(
'Tambahkan Bahasan Analis',
'Tambahkan Bahasan Pemutus',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w400,
Expand Down Expand Up @@ -1240,8 +1240,6 @@ class PengutusSubmitView extends GetView<PengutusSubmitController> {
debugPrint(listFinal.toString());

controller.savePutusan();
Get.back();
Get.back();
},
child: const Text('Ya'),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// 🐦 Flutter imports:
import 'package:akm/app/widget/send_screen.dart';
import 'package:flutter/material.dart';

// 📦 Package imports:
Expand Down Expand Up @@ -186,13 +187,20 @@ class ReviewerSubmitController extends GetxController {

try {
isSubmitLoading(true);
Get.dialog(
const SendScreen(),
barrierDismissible: false,
);
PengajuanSubmitReviewProvider()
.submitPengajuanAnalis(pengajuan.id!, body)
.then((resp) {
isSubmitLoading(false);
homeReviewCtrl.getMyPendingReview();
homeReviewCtrl.getMyCompletedReview();
resetForm();
Get.back();
Get.back();
Get.back();
Get.snackbar(
'Success',
'Data berhasil disimpan',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ class ReviewerSubmitView extends GetView<ReviewerSubmitController> {
children: const [
Center(
child: Text(
'Tambahkan Bahasan Analis',
'Tambahkan Bahasan Reviewer',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w400,
Expand Down Expand Up @@ -1188,8 +1188,6 @@ class ReviewerSubmitView extends GetView<ReviewerSubmitController> {
debugPrint(listFinal.toString());

controller.saveReview();
Get.back();
Get.back();
},
child: const Text('Ya'),
),
Expand Down
69 changes: 69 additions & 0 deletions lib/app/widget/send_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// 🐦 Flutter imports:
import 'package:flutter/material.dart';

// 📦 Package imports:
import 'package:lottie/lottie.dart';
import 'package:scaffold_gradient_background/scaffold_gradient_background.dart';

class SendScreen extends StatelessWidget {
const SendScreen({super.key});

@override
Widget build(BuildContext context) {
return ScaffoldGradientBackground(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.blue,
Colors.blue.shade900,
],
),
body: Align(
alignment: Alignment.center,
child: Container(
padding: const EdgeInsets.all(32),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Center(
child: Text(
'Sedang Mengirim',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 35,
fontWeight: FontWeight.bold,
),
),
),
Center(
child: Lottie.asset(
'assets/images/home/send.zip',
frameRate: FrameRate.max,
fit: BoxFit.cover,
height: 200,
repeat: true,
errorBuilder: (context, error, stackTrace) {
return const Text(
'Gagal memuat animasi',
style: TextStyle(
color: Colors.red,
),
);
},
),
),
const Center(
child: CircularProgressIndicator(
color: Colors.white,
),
),
],
),
),
),
);
}
}

1 comment on commit 76c3778

@vercel
Copy link

@vercel vercel bot commented on 76c3778 Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.