Mzansi Wallet Display done

This commit is contained in:
yaso 2026-06-26 10:33:06 +02:00
parent 003c8b7c0d
commit f588e9f715
11 changed files with 246 additions and 39 deletions

View file

@ -1,17 +1,38 @@
import 'package:flutter/material.dart';
import 'package:ken_logger/ken_logger.dart';
import 'package:mzansi_innovation_hub/mih_hive/mzansi_wallet_hive_data.dart';
import 'package:mzansi_innovation_hub/mih_objects/loyalty_card.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
class MzansiWalletProvider extends ChangeNotifier {
final MzansiWalletHiveData _hiveData;
List<MIHLoyaltyCard> loyaltyCards;
List<MIHLoyaltyCard> favouriteCards;
int toolIndex;
MzansiWalletProvider({
MzansiWalletProvider(
this._hiveData, {
this.loyaltyCards = const [],
this.favouriteCards = const [],
this.toolIndex = 0,
});
void loadCachedWallet() {
loyaltyCards = _hiveData.getCachedLoyaltyCards();
favouriteCards = _hiveData.getCachedFavLoyaltyCards();
KenLogger.success("Mzansi Wallet Loaded from Cache");
notifyListeners();
}
Future<bool> syncWithMihServerData(
MzansiProfileProvider profileProvider) async {
bool success = await _hiveData.syncWalletWithServer(profileProvider);
loadCachedWallet();
return success;
}
void reset() {
toolIndex = 0;
loyaltyCards = [];