fixed the loading issue
This commit is contained in:
parent
fd57686c8a
commit
a88d085001
@ -117,6 +117,7 @@ class _PaymentRequestBottomSheetState extends State<_PaymentRequestBottomSheet>
|
|||||||
: "Create Payment Request",
|
: "Create Payment Request",
|
||||||
isSubmitting: controller.isSubmitting.value,
|
isSubmitting: controller.isSubmitting.value,
|
||||||
onCancel: Get.back,
|
onCancel: Get.back,
|
||||||
|
submitText: "Save as Draft",
|
||||||
onSubmit: () async {
|
onSubmit: () async {
|
||||||
if (_formKey.currentState!.validate() && _validateSelections()) {
|
if (_formKey.currentState!.validate() && _validateSelections()) {
|
||||||
final success = await controller.submitPaymentRequest();
|
final success = await controller.submitPaymentRequest();
|
||||||
|
|||||||
@ -105,16 +105,25 @@ class _PaymentRequestDetailScreenState extends State<PaymentRequestDetailScreen>
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
appBar: _buildAppBar(),
|
appBar: _buildAppBar(),
|
||||||
body: SafeArea(
|
body: SafeArea(child: Obx(() {
|
||||||
child: Obx(() {
|
if (controller.isLoading.value &&
|
||||||
if (controller.isLoading.value) {
|
controller.paymentRequest.value == null) {
|
||||||
|
// Show skeleton only if data not yet loaded
|
||||||
return SkeletonLoaders.paymentRequestDetailSkeletonLoader();
|
return SkeletonLoaders.paymentRequestDetailSkeletonLoader();
|
||||||
}
|
}
|
||||||
|
|
||||||
final request = controller.paymentRequest.value;
|
final request = controller.paymentRequest.value;
|
||||||
if (controller.errorMessage.isNotEmpty || request == null) {
|
|
||||||
|
if (controller.errorMessage.isNotEmpty) {
|
||||||
|
return Center(
|
||||||
|
child: MyText.bodyMedium(controller.errorMessage.value));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request == null) {
|
||||||
return Center(child: MyText.bodyMedium("No data to display."));
|
return Center(child: MyText.bodyMedium("No data to display."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ✅ Actual content
|
||||||
return MyRefreshIndicator(
|
return MyRefreshIndicator(
|
||||||
onRefresh: controller.fetchPaymentRequestDetail,
|
onRefresh: controller.fetchPaymentRequestDetail,
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
@ -140,8 +149,7 @@ class _PaymentRequestDetailScreenState extends State<PaymentRequestDetailScreen>
|
|||||||
_Header(request: request, colorParser: _parseColor),
|
_Header(request: request, colorParser: _parseColor),
|
||||||
const Divider(height: 30, thickness: 1.2),
|
const Divider(height: 30, thickness: 1.2),
|
||||||
_Logs(
|
_Logs(
|
||||||
logs: request.updateLogs,
|
logs: request.updateLogs, colorParser: _parseColor),
|
||||||
colorParser: _parseColor),
|
|
||||||
const Divider(height: 30, thickness: 1.2),
|
const Divider(height: 30, thickness: 1.2),
|
||||||
_Parties(request: request),
|
_Parties(request: request),
|
||||||
const Divider(height: 30, thickness: 1.2),
|
const Divider(height: 30, thickness: 1.2),
|
||||||
@ -157,24 +165,18 @@ class _PaymentRequestDetailScreenState extends State<PaymentRequestDetailScreen>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
})),
|
||||||
),
|
|
||||||
bottomNavigationBar: _buildBottomActionBar(),
|
bottomNavigationBar: _buildBottomActionBar(),
|
||||||
|
|
||||||
// ✅ Added Floating Action Button for Edit
|
// ✅ Added Floating Action Button for Edit
|
||||||
floatingActionButton: Obx(() {
|
floatingActionButton: Obx(() {
|
||||||
if (controller.isLoading.value) return const SizedBox.shrink();
|
|
||||||
|
|
||||||
final request = controller.paymentRequest.value;
|
final request = controller.paymentRequest.value;
|
||||||
if (controller.errorMessage.isNotEmpty || request == null) {
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_checkedPermission) {
|
// Don't show FAB if loading or data not loaded
|
||||||
_checkedPermission = true;
|
if (controller.isLoading.value ||
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
request == null ||
|
||||||
_checkPermissionToSubmit(request);
|
employeeInfo == null) {
|
||||||
});
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|
||||||
final canEdit = PaymentRequestPermissionHelper.canEditPaymentRequest(
|
final canEdit = PaymentRequestPermissionHelper.canEditPaymentRequest(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user