updating UI inconsistency
This commit is contained in:
@@ -77,10 +77,10 @@ class BatchController extends ChangeNotifier {
|
|||||||
return query.substring(0, query.length - 1);
|
return query.substring(0, query.length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<ApiResponse<List<BillProvider>>> loadProviders() async {
|
Future<ApiResponse<List<BillProvider>>> loadProviders(String currency) async {
|
||||||
try {
|
try {
|
||||||
final raw = await http.get(
|
final raw = await http.get(
|
||||||
'/public/providers?currency=USD&sort=priority,asc',
|
'/public/providers?currency=$currency&sort=priority,asc',
|
||||||
);
|
);
|
||||||
final response = _unwrap(raw);
|
final response = _unwrap(raw);
|
||||||
final List<dynamic> content;
|
final List<dynamic> content;
|
||||||
|
|||||||
@@ -784,7 +784,7 @@ class _BatchDetailScreenState extends State<BatchDetailScreen>
|
|||||||
|
|
||||||
// Entering edit mode — ensure providers are loaded
|
// Entering edit mode — ensure providers are loaded
|
||||||
if (controller.model.providers.isEmpty) {
|
if (controller.model.providers.isEmpty) {
|
||||||
await controller.loadProviders();
|
await controller.loadProviders(_batch!.currency!);
|
||||||
}
|
}
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
|
|
||||||
@@ -890,7 +890,7 @@ class _BatchDetailScreenState extends State<BatchDetailScreen>
|
|||||||
Future<({BillProvider provider, BillProduct? product})?>
|
Future<({BillProvider provider, BillProduct? product})?>
|
||||||
_showBatchProviderSelectorBottomSheet() async {
|
_showBatchProviderSelectorBottomSheet() async {
|
||||||
if (controller.model.providers.isEmpty) {
|
if (controller.model.providers.isEmpty) {
|
||||||
await controller.loadProviders();
|
await controller.loadProviders(_batch!.currency!);
|
||||||
if (controller.model.providers.isEmpty) {
|
if (controller.model.providers.isEmpty) {
|
||||||
_showError('No providers available.');
|
_showError('No providers available.');
|
||||||
return null;
|
return null;
|
||||||
@@ -2025,8 +2025,8 @@ class _BatchDetailScreenState extends State<BatchDetailScreen>
|
|||||||
);
|
);
|
||||||
} else if (canRequest) {
|
} else if (canRequest) {
|
||||||
buttons.add(
|
buttons.add(
|
||||||
_inlineActionButton(
|
_inlinePaymentButton(
|
||||||
icon: Icons.send_rounded,
|
image: _batch!.paymentProcessorImage ?? '',
|
||||||
label: 'Push Payment',
|
label: 'Push Payment',
|
||||||
color: const Color(0xFF10B981),
|
color: const Color(0xFF10B981),
|
||||||
isLoading: isActing,
|
isLoading: isActing,
|
||||||
@@ -2118,6 +2118,64 @@ class _BatchDetailScreenState extends State<BatchDetailScreen>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _inlinePaymentButton({
|
||||||
|
required String image,
|
||||||
|
required String label,
|
||||||
|
required Color color,
|
||||||
|
required bool isLoading,
|
||||||
|
required VoidCallback onPressed,
|
||||||
|
}) {
|
||||||
|
return Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: InkWell(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
onTap: isLoading ? null : onPressed,
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: color.withValues(alpha: 0.1),
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
border: Border.all(color: color.withValues(alpha: 0.3)),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
if (isLoading)
|
||||||
|
SizedBox(
|
||||||
|
width: 14,
|
||||||
|
height: 14,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 2,
|
||||||
|
valueColor: AlwaysStoppedAnimation<Color>(color),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Image.asset(
|
||||||
|
'assets/$image',
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
width: 30,
|
||||||
|
errorBuilder: (_, __, ___) => Icon(
|
||||||
|
Icons.monetization_on_outlined,
|
||||||
|
size: 12,
|
||||||
|
color: Colors.white.withValues(alpha: 0.8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: color,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// ──────────────────────────────────────────────────────────────
|
// ──────────────────────────────────────────────────────────────
|
||||||
// Action Bar — search, filter, edit, refresh
|
// Action Bar — search, filter, edit, refresh
|
||||||
// ──────────────────────────────────────────────────────────────
|
// ──────────────────────────────────────────────────────────────
|
||||||
@@ -2521,6 +2579,7 @@ class _BatchDetailScreenState extends State<BatchDetailScreen>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
|
Text(item.billName ?? ''),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
if (item.billProductName != null &&
|
if (item.billProductName != null &&
|
||||||
|
|||||||
Reference in New Issue
Block a user