completed velocity integration

This commit is contained in:
2026-05-27 19:01:24 +02:00
parent fec46fb6e9
commit 6fdd3183fb
29 changed files with 2760 additions and 2293 deletions

View File

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:qpay/http/http.dart';
import 'package:qpay/models/api_response.dart';
import 'package:qpay/screens/home/home_controller.dart' as hc;
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:qpay/screens/transaction_controller.dart';
@@ -46,19 +47,7 @@ class RecipientsController extends ChangeNotifier {
).model.selectedProvider;
}
void _showErrorSnackBar(String? message) {
WidgetsBinding.instance.addPostFrameCallback((_) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(message.toString()),
behavior: SnackBarBehavior.floating,
backgroundColor: Colors.deepOrange,
),
);
});
}
Future<void> getRecipients([Map<String, String>? params]) async {
Future<ApiResponse<List<Recipient>>> getRecipients([Map<String, String>? params]) async {
model.errorMessage = null;
model.isLoading = true;
model.recipients = getDummyRecipients();
@@ -71,18 +60,19 @@ class RecipientsController extends ChangeNotifier {
);
model.recipients.clear();
model.recipients.addAll(response.map((e) => Recipient.fromJson(e)));
model.isLoading = false;
notifyListeners();
return ApiResponse.success(List<Recipient>.from(model.recipients));
} catch (e) {
_showErrorSnackBar(
"Problem fetching recipients, are you connected to the internet?",
);
model.errorMessage = e.toString();
model.recipients = [];
logger.e(e);
model.isLoading = false;
notifyListeners();
return ApiResponse.failure(
"Problem fetching recipients, are you connected to the internet?",
);
}
model.isLoading = false;
notifyListeners();
}
String buildQueryParameters(Map<String, String> params) {