updating UI inconsistency
This commit is contained in:
@@ -77,10 +77,10 @@ class BatchController extends ChangeNotifier {
|
||||
return query.substring(0, query.length - 1);
|
||||
}
|
||||
|
||||
Future<ApiResponse<List<BillProvider>>> loadProviders() async {
|
||||
Future<ApiResponse<List<BillProvider>>> loadProviders(String currency) async {
|
||||
try {
|
||||
final raw = await http.get(
|
||||
'/public/providers?currency=USD&sort=priority,asc',
|
||||
'/public/providers?currency=$currency&sort=priority,asc',
|
||||
);
|
||||
final response = _unwrap(raw);
|
||||
final List<dynamic> content;
|
||||
|
||||
@@ -784,7 +784,7 @@ class _BatchDetailScreenState extends State<BatchDetailScreen>
|
||||
|
||||
// Entering edit mode — ensure providers are loaded
|
||||
if (controller.model.providers.isEmpty) {
|
||||
await controller.loadProviders();
|
||||
await controller.loadProviders(_batch!.currency!);
|
||||
}
|
||||
if (!mounted) return;
|
||||
|
||||
@@ -890,7 +890,7 @@ class _BatchDetailScreenState extends State<BatchDetailScreen>
|
||||
Future<({BillProvider provider, BillProduct? product})?>
|
||||
_showBatchProviderSelectorBottomSheet() async {
|
||||
if (controller.model.providers.isEmpty) {
|
||||
await controller.loadProviders();
|
||||
await controller.loadProviders(_batch!.currency!);
|
||||
if (controller.model.providers.isEmpty) {
|
||||
_showError('No providers available.');
|
||||
return null;
|
||||
@@ -2025,8 +2025,8 @@ class _BatchDetailScreenState extends State<BatchDetailScreen>
|
||||
);
|
||||
} else if (canRequest) {
|
||||
buttons.add(
|
||||
_inlineActionButton(
|
||||
icon: Icons.send_rounded,
|
||||
_inlinePaymentButton(
|
||||
image: _batch!.paymentProcessorImage ?? '',
|
||||
label: 'Push Payment',
|
||||
color: const Color(0xFF10B981),
|
||||
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
|
||||
// ──────────────────────────────────────────────────────────────
|
||||
@@ -2521,6 +2579,7 @@ class _BatchDetailScreenState extends State<BatchDetailScreen>
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(item.billName ?? ''),
|
||||
Row(
|
||||
children: [
|
||||
if (item.billProductName != null &&
|
||||
|
||||
Reference in New Issue
Block a user