update payment
This commit is contained in:
@@ -9,11 +9,9 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:worker/core/constants/ui_constants.dart';
|
||||
import 'package:worker/core/database/models/enums.dart';
|
||||
import 'package:worker/core/theme/colors.dart';
|
||||
import 'package:worker/core/utils/extensions.dart';
|
||||
import 'package:worker/features/orders/data/models/invoice_model.dart';
|
||||
import 'package:worker/features/orders/presentation/providers/invoices_provider.dart';
|
||||
import 'package:worker/features/orders/domain/entities/payment.dart';
|
||||
import 'package:worker/features/orders/presentation/providers/payments_provider.dart';
|
||||
|
||||
/// Payments Page
|
||||
///
|
||||
@@ -27,97 +25,101 @@ class PaymentsPage extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final invoicesAsync = ref.watch(invoicesProvider);
|
||||
final paymentsAsync = ref.watch(paymentsProvider);
|
||||
final colorScheme = context.colorScheme;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF8FAFC),
|
||||
backgroundColor: colorScheme.surfaceContainerLowest,
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
||||
icon: Icon(Icons.arrow_back, color: colorScheme.onSurface),
|
||||
onPressed: () => context.pop(),
|
||||
),
|
||||
title: const Text(
|
||||
title: Text(
|
||||
'Lịch sử Thanh toán',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
color: colorScheme.onSurface,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
elevation: AppBarSpecs.elevation,
|
||||
backgroundColor: AppColors.white,
|
||||
backgroundColor: colorScheme.surface,
|
||||
centerTitle: false,
|
||||
actions: const [SizedBox(width: AppSpacing.sm)],
|
||||
),
|
||||
body: invoicesAsync.when(
|
||||
data: (invoices) {
|
||||
// Sort by issue date (newest first)
|
||||
final sortedInvoices = List<InvoiceModel>.from(invoices)
|
||||
..sort((a, b) => b.issueDate.compareTo(a.issueDate));
|
||||
|
||||
if (sortedInvoices.isEmpty) {
|
||||
return _buildEmptyState(ref);
|
||||
body: paymentsAsync.when(
|
||||
data: (payments) {
|
||||
if (payments.isEmpty) {
|
||||
return _buildEmptyState(context, ref);
|
||||
}
|
||||
|
||||
return RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
await ref.read(invoicesProvider.notifier).refresh();
|
||||
await ref.read(paymentsProvider.notifier).refresh();
|
||||
},
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.all(20),
|
||||
itemCount: sortedInvoices.length,
|
||||
itemCount: payments.length,
|
||||
itemBuilder: (context, index) {
|
||||
final invoice = sortedInvoices[index];
|
||||
final payment = payments[index];
|
||||
return _TransactionCard(
|
||||
invoice: invoice,
|
||||
onTap: () => _showTransactionDetail(context, invoice),
|
||||
payment: payment,
|
||||
onTap: () => _showTransactionDetail(context, payment),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (error, stack) => Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
FaIcon(
|
||||
FontAwesomeIcons.circleExclamation,
|
||||
size: 64,
|
||||
color: AppColors.danger.withValues(alpha: 0.7),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
'Có lỗi xảy ra',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey900,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
error.toString(),
|
||||
style: const TextStyle(fontSize: 14, color: AppColors.grey500),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () => ref.invalidate(invoicesProvider),
|
||||
child: const Text('Thử lại'),
|
||||
),
|
||||
],
|
||||
error: (error, stack) => _buildErrorState(context, ref, error),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build error state
|
||||
Widget _buildErrorState(BuildContext context, WidgetRef ref, Object error) {
|
||||
final colorScheme = context.colorScheme;
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
FaIcon(
|
||||
FontAwesomeIcons.circleExclamation,
|
||||
size: 64,
|
||||
color: colorScheme.error.withValues(alpha: 0.7),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'Có lỗi xảy ra',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
error.toString(),
|
||||
style: TextStyle(fontSize: 14, color: colorScheme.onSurfaceVariant),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () => ref.invalidate(paymentsProvider),
|
||||
child: const Text('Thử lại'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build empty state
|
||||
Widget _buildEmptyState(WidgetRef ref) {
|
||||
Widget _buildEmptyState(BuildContext context, WidgetRef ref) {
|
||||
final colorScheme = context.colorScheme;
|
||||
return RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
await ref.read(invoicesProvider.notifier).refresh();
|
||||
await ref.read(paymentsProvider.notifier).refresh();
|
||||
},
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
@@ -131,7 +133,7 @@ class PaymentsPage extends ConsumerWidget {
|
||||
FaIcon(
|
||||
FontAwesomeIcons.receipt,
|
||||
size: 64,
|
||||
color: AppColors.grey500.withValues(alpha: 0.5),
|
||||
color: colorScheme.onSurfaceVariant.withValues(alpha: 0.5),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
@@ -139,13 +141,16 @@ class PaymentsPage extends ConsumerWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey900.withValues(alpha: 0.8),
|
||||
color: colorScheme.onSurface.withValues(alpha: 0.8),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Text(
|
||||
Text(
|
||||
'Hiện tại không có giao dịch nào trong danh mục này',
|
||||
style: TextStyle(fontSize: 14, color: AppColors.grey500),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
@@ -158,22 +163,23 @@ class PaymentsPage extends ConsumerWidget {
|
||||
}
|
||||
|
||||
/// Show transaction detail modal
|
||||
void _showTransactionDetail(BuildContext context, InvoiceModel invoice) {
|
||||
void _showTransactionDetail(BuildContext context, Payment payment) {
|
||||
final colorScheme = context.colorScheme;
|
||||
final currencyFormatter = NumberFormat.currency(
|
||||
locale: 'vi_VN',
|
||||
symbol: 'đ',
|
||||
decimalDigits: 0,
|
||||
);
|
||||
final dateTimeFormatter = DateFormat('dd/MM/yyyy - HH:mm');
|
||||
final dateTimeFormatter = DateFormat('dd/MM/yyyy');
|
||||
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (context) => Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.surface,
|
||||
borderRadius: const BorderRadius.vertical(top: Radius.circular(16)),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -181,20 +187,20 @@ class PaymentsPage extends ConsumerWidget {
|
||||
// Header
|
||||
Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(color: AppColors.grey100),
|
||||
bottom: BorderSide(color: colorScheme.outlineVariant),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text(
|
||||
Text(
|
||||
'Chi tiết giao dịch',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
@@ -202,11 +208,11 @@ class PaymentsPage extends ConsumerWidget {
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColors.grey100,
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(Icons.close, size: 18),
|
||||
child: Icon(Icons.close, size: 18, color: colorScheme.onSurfaceVariant),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -220,48 +226,52 @@ class PaymentsPage extends ConsumerWidget {
|
||||
children: [
|
||||
_DetailRow(
|
||||
label: 'Mã giao dịch:',
|
||||
value: '#${invoice.invoiceNumber}',
|
||||
value: '#${payment.name}',
|
||||
),
|
||||
_DetailRow(
|
||||
label: 'Loại giao dịch:',
|
||||
value: _getTransactionType(invoice),
|
||||
value: 'Tiền ra (Thanh toán)',
|
||||
),
|
||||
_DetailRow(
|
||||
label: 'Thời gian:',
|
||||
value: dateTimeFormatter.format(invoice.issueDate),
|
||||
label: 'Ngày thanh toán:',
|
||||
value: dateTimeFormatter.format(payment.postingDate),
|
||||
),
|
||||
_DetailRow(
|
||||
label: 'Phương thức:',
|
||||
value: _getPaymentMethod(invoice),
|
||||
value: payment.displayPaymentMethod,
|
||||
),
|
||||
_DetailRow(
|
||||
label: 'Mô tả:',
|
||||
value: invoice.orderId != null
|
||||
? 'Thanh toán cho Đơn hàng #${invoice.orderId}'
|
||||
: 'Thanh toán hóa đơn',
|
||||
),
|
||||
_DetailRow(
|
||||
label: 'Mã tham chiếu:',
|
||||
value: invoice.erpnextInvoice ?? invoice.invoiceId,
|
||||
value: payment.description,
|
||||
),
|
||||
if (payment.invoiceId != null)
|
||||
_DetailRow(
|
||||
label: 'Mã hóa đơn:',
|
||||
value: payment.invoiceId!,
|
||||
),
|
||||
if (payment.orderId != null)
|
||||
_DetailRow(
|
||||
label: 'Mã đơn hàng:',
|
||||
value: payment.orderId!,
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text(
|
||||
Text(
|
||||
'Số tiền:',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
currencyFormatter.format(invoice.amountPaid),
|
||||
style: const TextStyle(
|
||||
currencyFormatter.format(payment.paidAmount),
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Color(0xFFdc2626),
|
||||
color: colorScheme.error,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -278,40 +288,29 @@ class PaymentsPage extends ConsumerWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _getTransactionType(InvoiceModel invoice) {
|
||||
if (invoice.status == InvoiceStatus.refunded) {
|
||||
return 'Tiền vào (Hoàn tiền)';
|
||||
}
|
||||
return 'Tiền ra (Thanh toán)';
|
||||
}
|
||||
|
||||
String _getPaymentMethod(InvoiceModel invoice) {
|
||||
// Default to bank transfer, can be enhanced based on actual payment data
|
||||
return 'Chuyển khoản';
|
||||
}
|
||||
}
|
||||
|
||||
/// Transaction Card Widget
|
||||
class _TransactionCard extends StatelessWidget {
|
||||
const _TransactionCard({
|
||||
required this.invoice,
|
||||
required this.payment,
|
||||
this.onTap,
|
||||
});
|
||||
|
||||
final InvoiceModel invoice;
|
||||
final Payment payment;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final dateTimeFormatter = DateFormat('dd/MM/yyyy - HH:mm');
|
||||
final isRefund = invoice.status == InvoiceStatus.refunded;
|
||||
final dateFormatter = DateFormat('dd/MM/yyyy');
|
||||
final colorScheme = context.colorScheme;
|
||||
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
elevation: 3,
|
||||
shadowColor: Colors.black.withValues(alpha: 0.08),
|
||||
elevation: 2,
|
||||
shadowColor: colorScheme.shadow,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
color: colorScheme.surface,
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
@@ -325,18 +324,18 @@ class _TransactionCard extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'#${invoice.invoiceNumber}',
|
||||
style: const TextStyle(
|
||||
'#${payment.name}',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
dateTimeFormatter.format(invoice.issueDate),
|
||||
dateFormatter.format(payment.postingDate),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppColors.grey500.withValues(alpha: 0.8),
|
||||
color: colorScheme.onSurfaceVariant.withValues(alpha: 0.8),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -346,12 +345,10 @@ class _TransactionCard extends StatelessWidget {
|
||||
|
||||
// Description
|
||||
Text(
|
||||
invoice.orderId != null
|
||||
? 'Thanh toán cho Đơn hàng #${invoice.orderId}'
|
||||
: 'Thanh toán hóa đơn #${invoice.invoiceNumber}',
|
||||
style: const TextStyle(
|
||||
payment.description,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -360,28 +357,28 @@ class _TransactionCard extends StatelessWidget {
|
||||
// Footer: method and amount
|
||||
Container(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(color: AppColors.grey100),
|
||||
top: BorderSide(color: colorScheme.outlineVariant),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Payment method
|
||||
const Row(
|
||||
Row(
|
||||
children: [
|
||||
FaIcon(
|
||||
FontAwesomeIcons.buildingColumns,
|
||||
size: 14,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'Chuyển khoản',
|
||||
payment.displayPaymentMethod,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -389,15 +386,11 @@ class _TransactionCard extends StatelessWidget {
|
||||
|
||||
// Amount
|
||||
Text(
|
||||
isRefund
|
||||
? '+${invoice.amountPaid.toVNCurrency}'
|
||||
: invoice.amountPaid.toVNCurrency,
|
||||
payment.paidAmount.toVNCurrency,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: isRefund
|
||||
? const Color(0xFF059669)
|
||||
: const Color(0xFFdc2626),
|
||||
color: colorScheme.error,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -423,11 +416,12 @@ class _DetailRow extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = context.colorScheme;
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(color: AppColors.grey100),
|
||||
bottom: BorderSide(color: colorScheme.outlineVariant),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
@@ -436,19 +430,19 @@ class _DetailRow extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColors.grey500,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Flexible(
|
||||
child: Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey900,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
textAlign: TextAlign.right,
|
||||
),
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/// Payments Provider
|
||||
///
|
||||
/// Riverpod providers for managing payments state.
|
||||
library;
|
||||
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:worker/core/network/dio_client.dart';
|
||||
import 'package:worker/features/orders/data/datasources/payment_remote_datasource.dart';
|
||||
import 'package:worker/features/orders/data/repositories/payment_repository_impl.dart';
|
||||
import 'package:worker/features/orders/domain/entities/payment.dart';
|
||||
import 'package:worker/features/orders/domain/repositories/payment_repository.dart';
|
||||
|
||||
part 'payments_provider.g.dart';
|
||||
|
||||
/// Payment Repository Provider
|
||||
@riverpod
|
||||
Future<PaymentRepository> paymentRepository(Ref ref) async {
|
||||
final dioClient = await ref.watch(dioClientProvider.future);
|
||||
final remoteDataSource = PaymentRemoteDataSource(dioClient);
|
||||
return PaymentRepositoryImpl(remoteDataSource);
|
||||
}
|
||||
|
||||
/// Payments Provider
|
||||
///
|
||||
/// Provides list of all payments from repository.
|
||||
@riverpod
|
||||
class Payments extends _$Payments {
|
||||
@override
|
||||
Future<List<Payment>> build() async {
|
||||
try {
|
||||
final repository = await ref.read(paymentRepositoryProvider.future);
|
||||
final payments = await repository.getPaymentsList(
|
||||
limitStart: 0,
|
||||
limitPageLength: 0, // 0 = get all
|
||||
);
|
||||
// Sort by posting date (newest first)
|
||||
payments.sort((a, b) => b.postingDate.compareTo(a.postingDate));
|
||||
return payments;
|
||||
} catch (e) {
|
||||
throw Exception('Failed to load payments: $e');
|
||||
}
|
||||
}
|
||||
|
||||
/// Refresh payments
|
||||
Future<void> refresh() async {
|
||||
state = const AsyncValue.loading();
|
||||
state = await AsyncValue.guard(() async {
|
||||
final repository = await ref.read(paymentRepositoryProvider.future);
|
||||
final payments = await repository.getPaymentsList(
|
||||
limitStart: 0,
|
||||
limitPageLength: 0,
|
||||
);
|
||||
// Sort by posting date (newest first)
|
||||
payments.sort((a, b) => b.postingDate.compareTo(a.postingDate));
|
||||
return payments;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Payment Detail Provider
|
||||
///
|
||||
/// Provides payment detail by ID.
|
||||
@riverpod
|
||||
Future<Payment> paymentDetail(Ref ref, String name) async {
|
||||
final repository = await ref.watch(paymentRepositoryProvider.future);
|
||||
return await repository.getPaymentDetail(name);
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'payments_provider.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint, type=warning
|
||||
/// Payment Repository Provider
|
||||
|
||||
@ProviderFor(paymentRepository)
|
||||
const paymentRepositoryProvider = PaymentRepositoryProvider._();
|
||||
|
||||
/// Payment Repository Provider
|
||||
|
||||
final class PaymentRepositoryProvider
|
||||
extends
|
||||
$FunctionalProvider<
|
||||
AsyncValue<PaymentRepository>,
|
||||
PaymentRepository,
|
||||
FutureOr<PaymentRepository>
|
||||
>
|
||||
with
|
||||
$FutureModifier<PaymentRepository>,
|
||||
$FutureProvider<PaymentRepository> {
|
||||
/// Payment Repository Provider
|
||||
const PaymentRepositoryProvider._()
|
||||
: super(
|
||||
from: null,
|
||||
argument: null,
|
||||
retry: null,
|
||||
name: r'paymentRepositoryProvider',
|
||||
isAutoDispose: true,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@override
|
||||
String debugGetCreateSourceHash() => _$paymentRepositoryHash();
|
||||
|
||||
@$internal
|
||||
@override
|
||||
$FutureProviderElement<PaymentRepository> $createElement(
|
||||
$ProviderPointer pointer,
|
||||
) => $FutureProviderElement(pointer);
|
||||
|
||||
@override
|
||||
FutureOr<PaymentRepository> create(Ref ref) {
|
||||
return paymentRepository(ref);
|
||||
}
|
||||
}
|
||||
|
||||
String _$paymentRepositoryHash() => r'974dad2e275b274b5dc7af5db883706706bda301';
|
||||
|
||||
/// Payments Provider
|
||||
///
|
||||
/// Provides list of all payments from repository.
|
||||
|
||||
@ProviderFor(Payments)
|
||||
const paymentsProvider = PaymentsProvider._();
|
||||
|
||||
/// Payments Provider
|
||||
///
|
||||
/// Provides list of all payments from repository.
|
||||
final class PaymentsProvider
|
||||
extends $AsyncNotifierProvider<Payments, List<Payment>> {
|
||||
/// Payments Provider
|
||||
///
|
||||
/// Provides list of all payments from repository.
|
||||
const PaymentsProvider._()
|
||||
: super(
|
||||
from: null,
|
||||
argument: null,
|
||||
retry: null,
|
||||
name: r'paymentsProvider',
|
||||
isAutoDispose: true,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@override
|
||||
String debugGetCreateSourceHash() => _$paymentsHash();
|
||||
|
||||
@$internal
|
||||
@override
|
||||
Payments create() => Payments();
|
||||
}
|
||||
|
||||
String _$paymentsHash() => r'510832e6d296f7b4b151e90beeec0ca28153597f';
|
||||
|
||||
/// Payments Provider
|
||||
///
|
||||
/// Provides list of all payments from repository.
|
||||
|
||||
abstract class _$Payments extends $AsyncNotifier<List<Payment>> {
|
||||
FutureOr<List<Payment>> build();
|
||||
@$mustCallSuper
|
||||
@override
|
||||
void runBuild() {
|
||||
final created = build();
|
||||
final ref = this.ref as $Ref<AsyncValue<List<Payment>>, List<Payment>>;
|
||||
final element =
|
||||
ref.element
|
||||
as $ClassProviderElement<
|
||||
AnyNotifier<AsyncValue<List<Payment>>, List<Payment>>,
|
||||
AsyncValue<List<Payment>>,
|
||||
Object?,
|
||||
Object?
|
||||
>;
|
||||
element.handleValue(ref, created);
|
||||
}
|
||||
}
|
||||
|
||||
/// Payment Detail Provider
|
||||
///
|
||||
/// Provides payment detail by ID.
|
||||
|
||||
@ProviderFor(paymentDetail)
|
||||
const paymentDetailProvider = PaymentDetailFamily._();
|
||||
|
||||
/// Payment Detail Provider
|
||||
///
|
||||
/// Provides payment detail by ID.
|
||||
|
||||
final class PaymentDetailProvider
|
||||
extends $FunctionalProvider<AsyncValue<Payment>, Payment, FutureOr<Payment>>
|
||||
with $FutureModifier<Payment>, $FutureProvider<Payment> {
|
||||
/// Payment Detail Provider
|
||||
///
|
||||
/// Provides payment detail by ID.
|
||||
const PaymentDetailProvider._({
|
||||
required PaymentDetailFamily super.from,
|
||||
required String super.argument,
|
||||
}) : super(
|
||||
retry: null,
|
||||
name: r'paymentDetailProvider',
|
||||
isAutoDispose: true,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@override
|
||||
String debugGetCreateSourceHash() => _$paymentDetailHash();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return r'paymentDetailProvider'
|
||||
''
|
||||
'($argument)';
|
||||
}
|
||||
|
||||
@$internal
|
||||
@override
|
||||
$FutureProviderElement<Payment> $createElement($ProviderPointer pointer) =>
|
||||
$FutureProviderElement(pointer);
|
||||
|
||||
@override
|
||||
FutureOr<Payment> create(Ref ref) {
|
||||
final argument = this.argument as String;
|
||||
return paymentDetail(ref, argument);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return other is PaymentDetailProvider && other.argument == argument;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return argument.hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
String _$paymentDetailHash() => r'b20c04bb5c7054cf5aec1da0da363c3a3c8635ba';
|
||||
|
||||
/// Payment Detail Provider
|
||||
///
|
||||
/// Provides payment detail by ID.
|
||||
|
||||
final class PaymentDetailFamily extends $Family
|
||||
with $FunctionalFamilyOverride<FutureOr<Payment>, String> {
|
||||
const PaymentDetailFamily._()
|
||||
: super(
|
||||
retry: null,
|
||||
name: r'paymentDetailProvider',
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
isAutoDispose: true,
|
||||
);
|
||||
|
||||
/// Payment Detail Provider
|
||||
///
|
||||
/// Provides payment detail by ID.
|
||||
|
||||
PaymentDetailProvider call(String name) =>
|
||||
PaymentDetailProvider._(argument: name, from: this);
|
||||
|
||||
@override
|
||||
String toString() => r'paymentDetailProvider';
|
||||
}
|
||||
Reference in New Issue
Block a user