-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #192 from fleetimee/refactor_submit
feat: refactor submit reviewer
- Loading branch information
Showing
23 changed files
with
2,951 additions
and
1,906 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2,266 changes: 403 additions & 1,863 deletions
2,266
lib/app/modules/reviewer_submit/views/reviewer_submit_view.dart
Large diffs are not rendered by default.
Oops, something went wrong.
178 changes: 178 additions & 0 deletions
178
...viewer_submit/widget/components/reviewer_submit_agunan/reviewer_submit_agunan_button.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
// 🎯 Dart imports: | ||
|
||
// 🐦 Flutter imports: | ||
import 'package:akm/app/modules/reviewer_submit/controllers/reviewer_submit_controller.dart'; | ||
import 'package:akm/app/widget/dialog_box.dart'; | ||
import 'package:akm/app/widget/simple_snackbar.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
// 📦 Package imports: | ||
import 'package:flutter_form_builder/flutter_form_builder.dart'; | ||
import 'package:form_builder_validators/form_builder_validators.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:getwidget/getwidget.dart'; | ||
|
||
// 🌎 Project imports: | ||
import 'package:akm/app/common/style.dart'; | ||
import 'package:akm/app/routes/app_pages.dart'; | ||
|
||
class ReviewerAgunanSectionButton extends StatelessWidget { | ||
const ReviewerAgunanSectionButton({ | ||
super.key, | ||
required this.controller, | ||
required this.iconNotyet, | ||
required this.iconDone, | ||
required this.buttonStyle, | ||
}); | ||
|
||
final ReviewerSubmitController controller; | ||
final Icon iconNotyet; | ||
final Icon iconDone; | ||
final TextStyle buttonStyle; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
TextStyle promptText(Color backgroundColor, BuildContext context) { | ||
return Theme.of(context).textTheme.bodySmall!.merge( | ||
TextStyle( | ||
fontSize: 24, | ||
fontWeight: FontWeight.w600, | ||
color: Colors.black87, | ||
backgroundColor: backgroundColor, | ||
), | ||
); | ||
} | ||
|
||
TextStyle promptTextSubtitle(Color backgroundColor, BuildContext context) { | ||
return Theme.of(context).textTheme.bodySmall!.merge( | ||
TextStyle( | ||
fontSize: 18, | ||
fontWeight: FontWeight.w600, | ||
color: Colors.black87, | ||
backgroundColor: backgroundColor, | ||
), | ||
); | ||
} | ||
|
||
return Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Row( | ||
children: [ | ||
Obx( | ||
() => controller.isAnalisaAgunanRead.value == false | ||
? iconNotyet | ||
: iconDone, | ||
), | ||
const SizedBox( | ||
width: 5.0, | ||
), | ||
Expanded( | ||
child: GFButton( | ||
onPressed: () { | ||
Get.toNamed(Routes.AGUNAN_PRINT, | ||
arguments: controller.insightDebitur.value); | ||
|
||
controller.isAnalisaAgunanRead(true); | ||
}, | ||
color: primaryColor, | ||
shape: GFButtonShape.pills, | ||
text: 'Cek Analisa Agunan', | ||
textStyle: buttonStyle, | ||
fullWidthButton: true, | ||
size: GFSize.LARGE, | ||
), | ||
), | ||
], | ||
), | ||
const SizedBox( | ||
height: 10.0, | ||
), | ||
Row( | ||
children: [ | ||
Obx( | ||
() => controller.isDetailAgunanRead.value == false | ||
? iconNotyet | ||
: iconDone, | ||
), | ||
const SizedBox( | ||
width: 5.0, | ||
), | ||
Expanded( | ||
child: GFButton( | ||
onPressed: () { | ||
Get.toNamed(Routes.DETAIL_AGUNAN, | ||
arguments: controller.insightDebitur.value); | ||
|
||
controller.isDetailAgunanRead(true); | ||
}, | ||
color: primaryColor, | ||
shape: GFButtonShape.pills, | ||
text: 'Cek Detail Agunan', | ||
textStyle: buttonStyle, | ||
fullWidthButton: true, | ||
size: GFSize.LARGE, | ||
), | ||
), | ||
], | ||
), | ||
const SizedBox(height: 10), | ||
Obx( | ||
() => GestureDetector( | ||
onTap: () { | ||
if (!controller.isDetailAgunanRead.value || | ||
!controller.isAnalisaAgunanRead.value) { | ||
ErrorDialog( | ||
title: 'Perhatian', | ||
desc: | ||
'Silahkan cek detail agunan dan analisa agunan terlebih dahulu', | ||
context: context, | ||
btnOkOnPress: () {}, | ||
).show(); | ||
} | ||
}, | ||
child: FormBuilderRadioGroup( | ||
name: 'agunan', | ||
activeColor: primaryColor, | ||
enabled: controller.isDetailAgunanRead.value && | ||
controller.isAnalisaAgunanRead.value, | ||
wrapAlignment: WrapAlignment.center, | ||
onChanged: (value) { | ||
// if clicked then change isPressed to true | ||
controller.isAgunanPressed.value = true; | ||
|
||
if (value == true) { | ||
CustomSnackBar.show( | ||
context, 'Agunan debitur ini dinyatakan LAYAK'); | ||
} else { | ||
CustomSnackBar.show( | ||
context, 'Agunan debitur ini dinyatakan TIDAK LAYAK'); | ||
} | ||
}, | ||
decoration: InputDecoration( | ||
labelText: 'Apakah agunan debitur ini layak?', | ||
floatingLabelAlignment: FloatingLabelAlignment.center, | ||
labelStyle: promptText(Colors.transparent, context), | ||
border: InputBorder.none, | ||
alignLabelWithHint: true, | ||
), | ||
options: [ | ||
FormBuilderFieldOption( | ||
value: true, | ||
child: Text('YA', | ||
style: promptTextSubtitle(Colors.transparent, context)), | ||
), | ||
FormBuilderFieldOption( | ||
value: false, | ||
child: Text('TIDAK', | ||
style: promptTextSubtitle(Colors.transparent, context)), | ||
), | ||
], | ||
validator: FormBuilderValidators.required(), | ||
), | ||
), | ||
), | ||
], | ||
); | ||
} | ||
} |
155 changes: 155 additions & 0 deletions
155
...viewer_submit/widget/components/reviewer_submit_bisnis/reviewer_submit_bisnis_button.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
// 🎯 Dart imports: | ||
|
||
// 🐦 Flutter imports: | ||
import 'package:akm/app/modules/reviewer_submit/controllers/reviewer_submit_controller.dart'; | ||
import 'package:akm/app/widget/dialog_box.dart'; | ||
import 'package:akm/app/widget/simple_snackbar.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
// 📦 Package imports: | ||
import 'package:flutter_form_builder/flutter_form_builder.dart'; | ||
import 'package:form_builder_validators/form_builder_validators.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:getwidget/getwidget.dart'; | ||
|
||
// 🌎 Project imports: | ||
import 'package:akm/app/common/style.dart'; | ||
import 'package:akm/app/routes/app_pages.dart'; | ||
|
||
class ReviewerSubmitBisnisButton extends StatelessWidget { | ||
const ReviewerSubmitBisnisButton({ | ||
super.key, | ||
required this.controller, | ||
required this.iconNotYet, | ||
required this.iconDone, | ||
required this.buttonStyle, | ||
}); | ||
|
||
final ReviewerSubmitController controller; | ||
final Icon iconNotYet; | ||
final Icon iconDone; | ||
final TextStyle buttonStyle; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
TextStyle promptText(Color backgroundColor, BuildContext context) { | ||
return Theme.of(context).textTheme.bodySmall!.merge( | ||
TextStyle( | ||
fontSize: 24, | ||
fontWeight: FontWeight.w600, | ||
color: Colors.black87, | ||
backgroundColor: backgroundColor, | ||
), | ||
); | ||
} | ||
|
||
TextStyle promptTextSubtitle(Color backgroundColor, BuildContext context) { | ||
return Theme.of(context).textTheme.bodySmall!.merge( | ||
TextStyle( | ||
fontSize: 18, | ||
fontWeight: FontWeight.w600, | ||
color: Colors.black87, | ||
backgroundColor: backgroundColor, | ||
), | ||
); | ||
} | ||
|
||
return Column( | ||
children: [ | ||
Row( | ||
children: [ | ||
Obx( | ||
() => controller.isAnalisisBisnisRead.value == true | ||
? iconDone | ||
: iconNotYet, | ||
), | ||
const SizedBox( | ||
width: 5, | ||
), | ||
Expanded( | ||
child: GFButton( | ||
onPressed: () { | ||
Get.toNamed(Routes.BISNIS_PRINT, | ||
arguments: controller.insightDebitur.value); | ||
|
||
controller.isAnalisisBisnisRead(true); | ||
}, | ||
color: primaryColor, | ||
shape: GFButtonShape.pills, | ||
text: 'Cek Analisa Bisnis', | ||
textStyle: buttonStyle, | ||
fullWidthButton: true, | ||
size: GFSize.LARGE, | ||
), | ||
) | ||
], | ||
), | ||
const SizedBox( | ||
height: 10, | ||
), | ||
Obx( | ||
() => GestureDetector( | ||
onTap: () { | ||
if (!controller.isAnalisisBisnisRead.value) { | ||
// Show snackbar indicating that the radio group is disabled | ||
ErrorDialog( | ||
title: 'Analisa Bisnis Belum Dibaca', | ||
desc: 'Silahkan baca analisa bisnis terlebih dahulu', | ||
context: context, | ||
btnOkOnPress: () {}, | ||
).show(); | ||
} | ||
}, | ||
child: FormBuilderRadioGroup( | ||
name: 'bisnis', | ||
activeColor: primaryColor, | ||
enabled: controller.isAnalisisBisnisRead.value, | ||
wrapAlignment: WrapAlignment.center, | ||
onChanged: (value) { | ||
// if clicked then change isPressed to true | ||
controller.isBisnisPressed.value = true; | ||
|
||
if (value == true) { | ||
CustomSnackBar.show( | ||
context, | ||
'Bisnis debitur ini dinyatakan LAYAK', | ||
); | ||
} else { | ||
CustomSnackBar.show( | ||
context, | ||
'Bisnis debitur ini dinyatakan TIDAK LAYAK', | ||
); | ||
} | ||
}, | ||
decoration: InputDecoration( | ||
labelText: 'Apakah bisnis debitur ini layak?', | ||
floatingLabelAlignment: FloatingLabelAlignment.center, | ||
labelStyle: promptText(Colors.transparent, context), | ||
border: InputBorder.none, | ||
alignLabelWithHint: true, | ||
), | ||
options: [ | ||
FormBuilderFieldOption( | ||
value: true, | ||
child: Text( | ||
'YA', | ||
style: promptTextSubtitle( | ||
Colors.transparent, | ||
context, | ||
), | ||
), | ||
), | ||
FormBuilderFieldOption( | ||
value: false, | ||
child: Text('TIDAK', | ||
style: promptTextSubtitle(Colors.transparent, context)), | ||
), | ||
], | ||
validator: FormBuilderValidators.required(), | ||
), | ||
), | ||
), | ||
], | ||
); | ||
} | ||
} |
Oops, something went wrong.
822eeba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
infinite-impermanence – ./
infinite-impermanence.vercel.app
infinite-impermanence-git-master-fleetime.vercel.app
infinite-impermanence-fleetime.vercel.app
docs-akm.fleetime.my.id