Skip to content

Commit

Permalink
Merge pull request #184 from fleetimee/@refactor/refactor-shitty-code-v6
Browse files Browse the repository at this point in the history
fix: filtering by date range in the "My Orders" page
  • Loading branch information
fleetimee authored Apr 3, 2023
2 parents 092af12 + 4e7f98a commit f3092bd
Show file tree
Hide file tree
Showing 23 changed files with 1,695 additions and 1,300 deletions.
Binary file added assets/images/home/agunan_slider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/home/bisnis_slider.jpg
Binary file not shown.
Binary file added assets/images/home/bisnis_slider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/home/karakter_slider.jpg
Binary file not shown.
Binary file added assets/images/home/karakter_slider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/home/keuangan_slider.jpg
Binary file not shown.
Binary file added assets/images/home/keuangan_slider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/home/usaha_slider.jpg
Binary file not shown.
Binary file added assets/images/home/usaha_slider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions lib/app/modules/home/controllers/home_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ class HomeController extends GetxController {
// Controller for formKey
final formKey = GlobalKey<FormBuilderState>();

// Index for tabbar
var selectedIndex = 0.obs;

// Bunch of controllers for textfield
var uid = TextEditingController();
var setPassword = TextEditingController();
Expand Down
65 changes: 43 additions & 22 deletions lib/app/modules/home/widget/home_history_and_submission.dart
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
// 🐦 Flutter imports:
import 'package:akm/app/common/style.dart';
import 'package:akm/app/modules/home/controllers/home_controller.dart';
import 'package:akm/app/modules/home/widget/components/home_history_and_submission.dart/empty_history_and_submission.dart';
import 'package:akm/app/modules/home/widget/components/home_history_and_submission.dart/list_riwayat_input.dart';
import 'package:akm/app/modules/home/widget/components/home_history_and_submission.dart/list_riwayat_pengajuan.dart';
import 'package:akm/app/routes/app_pages.dart';
import 'package:avatar_glow/avatar_glow.dart';
import 'package:bootstrap_alert/bootstrap_alert.dart';
import 'package:flutter/material.dart';

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

class HomeHistoryAndSubmission extends StatelessWidget {
class HomeHistoryAndSubmission extends StatefulWidget {
final HomeController controller;

const HomeHistoryAndSubmission({
super.key,
required this.controller,
});

@override
State<HomeHistoryAndSubmission> createState() =>
_HomeHistoryAndSubmissionState();
}

class _HomeHistoryAndSubmissionState extends State<HomeHistoryAndSubmission> {
final bool _showAlert = true;
final int selectedIndex = 0;

int selectedIndex = 0;

@override
Widget build(BuildContext context) {
return DefaultTabController(
initialIndex: selectedIndex,
length: 2,
child: ScaffoldGradientBackground(
gradient: LinearGradient(
Expand All @@ -37,10 +46,15 @@ class HomeHistoryAndSubmission extends StatelessWidget {
),
body: Column(
children: [
const TabBar(
physics: NeverScrollableScrollPhysics(),
TabBar(
onTap: (index) {
setState(() {
selectedIndex = index;
});
},
physics: const NeverScrollableScrollPhysics(),
indicatorColor: Colors.white,
tabs: [
tabs: const [
Tab(
text: 'Riwayat Penginputan',
icon: Icon(Icons.history),
Expand All @@ -56,12 +70,12 @@ class HomeHistoryAndSubmission extends StatelessWidget {
physics: const NeverScrollableScrollPhysics(),
children: [
Obx(() {
if (controller.isMyInputProcessing.value) {
if (widget.controller.isMyInputProcessing.value) {
return const Center(
child: CircularProgressIndicator(),
);
} else {
if (controller.listMyInput.isNotEmpty) {
if (widget.controller.listMyInput.isNotEmpty) {
return Column(
children: [
BootstrapAlert(
Expand Down Expand Up @@ -105,29 +119,29 @@ class HomeHistoryAndSubmission extends StatelessWidget {
),
Expanded(
child: ListRiwayatInput(
controller: controller,
controller: widget.controller,
),
),
],
);
} else {
return EmptyHistoryAndSubmission(
controller: controller,
controller: widget.controller,
text: 'Belum ada riwayat penginputan',
onPressed: () {
controller.refreshInputtan();
widget.controller.refreshInputtan();
},
);
}
}
}),
Obx(() {
if (controller.isMySubmissionProcessing.value) {
if (widget.controller.isMySubmissionProcessing.value) {
return const Center(
child: CircularProgressIndicator(),
);
} else {
if (controller.listMySubmission.isNotEmpty) {
if (widget.controller.listMySubmission.isNotEmpty) {
return Column(
children: [
BootstrapAlert(
Expand All @@ -145,17 +159,17 @@ class HomeHistoryAndSubmission extends StatelessWidget {
),
Expanded(
child: ListRiwayatPengajuan(
controller: controller,
controller: widget.controller,
),
),
],
);
} else {
return EmptyHistoryAndSubmission(
controller: controller,
controller: widget.controller,
text: 'Belum ada riwayat pengajuan',
onPressed: () {
controller.refreshPengajuan();
widget.controller.refreshPengajuan();
},
);
}
Expand All @@ -167,13 +181,20 @@ class HomeHistoryAndSubmission extends StatelessWidget {
],
),
floatingActionButton: selectedIndex == 0
? FloatingActionButton(
onPressed: () {
Get.toNamed('/home/input');
},
child: const Icon(Icons.add),
? AvatarGlow(
endRadius: 50,
child: FloatingActionButton(
backgroundColor: primaryColor,
elevation: 10,
onPressed: () {
Get.toNamed(Routes.LIST_DEBITUR);
},
child: const Icon(
Icons.search_outlined,
),
),
)
: null,
: const SizedBox.shrink(),
),
);
}
Expand Down
1 change: 1 addition & 0 deletions lib/app/modules/insight_debitur/model/carousel_list.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading

1 comment on commit f3092bd

@vercel
Copy link

@vercel vercel bot commented on f3092bd Apr 3, 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.