From 9d63e6e522a6808b1d831c71e7761893df22c775 Mon Sep 17 00:00:00 2001 From: poka Date: Wed, 15 Mar 2023 19:18:29 +0100 Subject: [PATCH] feat: information about contacts add/remove --- assets/translations/en.json | 11 ++++++----- assets/translations/es.json | 12 +++++++----- assets/translations/fr.json | 10 ++++++---- lib/providers/wallets_profiles.dart | 9 +++++++++ lib/screens/wallet_view.dart | 13 +++++++++++++ pubspec.lock | 8 ++++++++ pubspec.yaml | 1 + 7 files changed, 50 insertions(+), 14 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 8279bfb..ea378ec 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -152,7 +152,7 @@ "canRenewCertInX": "You can renew\nthis certification\nin {}", "executeATransfer": "Execute a transfer", "executeTheTransfer": "Execute the transfer", - "doATransfer" : "Execute a\ntransfer", + "doATransfer": "Execute a\ntransfer", "seconds": "{} seconds", "minutes": "{} minutes", "hours": "{} hours {}", @@ -199,13 +199,13 @@ "ud": "{}UD", "chooseATargetWallet": "Choose a target wallet", "thisMnemonicHasBeenCopiedToClipboard": "This mnemonic has been copied to clipboard", - "smithCantMigrateIdentity":"You can't migrate this identity while you're member of smith web", + "smithCantMigrateIdentity": "You can't migrate this identity while you're member of smith web", "received": "Received", "sent": "Sent", "createIdentity": "Create a new \nidentity", "memberAccountOf": "Account of {}", "pasteAddress": "Paste address from\nclipboard", - "historyStart" :"Beginning of history", + "historyStart": "Beginning of history", "blockchainStart": "Beginning of the ĞDev", "networkSettings": "Network Settings", "displaySettings": "Display Settings", @@ -215,6 +215,7 @@ "blockN": "block N°{}", "thisIsNotAGoodCode": "This is not a good code", "youHaveToBeConnectedToValidateChest": "You have to be connected\nto validate your chest", - "thisIdentityAlreadyExist": "This identity already exists" - + "thisIdentityAlreadyExist": "This identity already exists", + "removedFromcontacts": "Removed from contacts", + "addedToContacts": "Added to contacts" } \ No newline at end of file diff --git a/assets/translations/es.json b/assets/translations/es.json index 5279a92..ff6fc7b 100644 --- a/assets/translations/es.json +++ b/assets/translations/es.json @@ -153,7 +153,7 @@ "canRenewCertInX": "Podrás renovar\nla certificación\nen {}", "executeATransfer": "Ejecutar una transacción", "executeTheTransfer": "Ejecutar la transacción", - "doATransfer" : "Hacer una\ntransacción", + "doATransfer": "Hacer una\ntransacción", "seconds": "{} segundos", "minutes": "{} minutos", "hours": "{} horas {}", @@ -200,13 +200,13 @@ "ud": "{}DU", "chooseATargetWallet": "Elige un monedero de destino", "thisMnemonicHasBeenCopiedToClipboard": "This mnemonic has been copied to clipboard", - "smithCantMigrateIdentity":"You can't migrate this identity while you're member of smith web", + "smithCantMigrateIdentity": "You can't migrate this identity while you're member of smith web", "received": "Received", "sent": "Sent", "createIdentity": "Create a new \nidentity", "memberAccountOf": "Account of {}", "pasteAddress": "Paste address from\nclipboard", - "historyStart" :"Beginning of history", + "historyStart": "Beginning of history", "blockchainStart": "Comienzo de la ĞDev", "networkSettings": "Parametros de red", "displaySettings": "Parametros interficie", @@ -216,5 +216,7 @@ "blockN": "bloque N°{}", "thisIsNotAGoodCode": "Este codígo no es valido", "youHaveToBeConnectedToValidateChest": "Tienes que tener conneción\npara validar tu cofre", - "thisIdentityAlreadyExist": "Esta identidad ya existe" -} + "thisIdentityAlreadyExist": "Esta identidad ya existe", + "removedFromcontacts": "Removed from contacts", + "addedToContacts": "Added to contacts" +} \ No newline at end of file diff --git a/assets/translations/fr.json b/assets/translations/fr.json index cfd6814..d1f1837 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -199,13 +199,13 @@ "ud": "{}DU", "chooseATargetWallet": "Choisissez un portefeuille cible", "thisMnemonicHasBeenCopiedToClipboard": "Cette phrase secrète viens d'être copié dans votre presse-papier.", - "smithCantMigrateIdentity":"Vous ne pouvez pas migrer cette identité\ntant que vous êtes dans la toile forgerons", + "smithCantMigrateIdentity": "Vous ne pouvez pas migrer cette identité\ntant que vous êtes dans la toile forgerons", "received": "Reçus", "sent": "Envoyés", "createIdentity": "Créer sa nouvelle\nidentité", "memberAccountOf": "Compte de {}", "pasteAddress": "Coller l'adresse depuis\nle presse-papier", - "historyStart" :"Début de l'historique", + "historyStart": "Début de l'historique", "blockchainStart": "Début de la ĞDev", "networkSettings": "Connectivité réseau", "displaySettings": "Affichage", @@ -215,5 +215,7 @@ "blockN": "bloc N°{}", "thisIsNotAGoodCode": "Ce n'est pas le bon code", "youHaveToBeConnectedToValidateChest": "Vous devez vous connecter à internet\npour valider votre coffre", - "thisIdentityAlreadyExist": "Cette identité existe déjà" -} + "thisIdentityAlreadyExist": "Cette identité existe déjà", + "removedFromcontacts": "Retiré des contact", + "addedToContacts": "Ajouté au contacts" +} \ No newline at end of file diff --git a/lib/providers/wallets_profiles.dart b/lib/providers/wallets_profiles.dart index 12298ca..d66e533 100644 --- a/lib/providers/wallets_profiles.dart +++ b/lib/providers/wallets_profiles.dart @@ -1,3 +1,5 @@ +// ignore_for_file: use_build_context_synchronously + import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -8,6 +10,7 @@ import 'package:jdenticon_dart/jdenticon_dart.dart'; import 'package:permission_handler/permission_handler.dart'; // import 'package:qrscan/qrscan.dart' as scanner; import 'package:barcode_scan2/barcode_scan2.dart'; +import 'package:confetti/confetti.dart'; class WalletsProfilesProvider with ChangeNotifier { WalletsProfilesProvider(this.address); @@ -21,6 +24,8 @@ class WalletsProfilesProvider with ChangeNotifier { TextEditingController payAmount = TextEditingController(); TextEditingController payComment = TextEditingController(); num? _balance; + final centerController = + ConfettiController(duration: const Duration(milliseconds: 300)); Future scan(context) async { if (Platform.isAndroid || Platform.isIOS) { @@ -137,8 +142,12 @@ class WalletsProfilesProvider with ChangeNotifier { // log.d(profile.username); if (isContact(profile.address)) { await contactsBox.delete(profile.address); + snackMessage(homeContext, message: 'removedFromcontacts'.tr()); } else { + centerController.play(); await contactsBox.put(profile.address, profile); + // drawStar(Size(50, 50)); + snackMessage(homeContext, message: 'addedToContacts'.tr()); } notifyListeners(); } diff --git a/lib/screens/wallet_view.dart b/lib/screens/wallet_view.dart index 39451c8..bce0645 100644 --- a/lib/screens/wallet_view.dart +++ b/lib/screens/wallet_view.dart @@ -1,5 +1,8 @@ // ignore_for_file: use_build_context_synchronously +import 'dart:math'; + +import 'package:confetti/confetti.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/services.dart'; @@ -61,6 +64,16 @@ class WalletViewScreen extends StatelessWidget { actions: [ Row( children: [ + ConfettiWidget( + confettiController: walletProfile.centerController, + blastDirection: pi / 2, + maxBlastForce: 7, + minBlastForce: 3, + emissionFrequency: 0, + numberOfParticles: 7, + shouldLoop: false, + gravity: 0.001, + ), Consumer( builder: (context, walletProfile, _) { return IconButton( diff --git a/pubspec.lock b/pubspec.lock index 7660e8b..f5d5a8a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -265,6 +265,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.17.0" + confetti: + dependency: "direct main" + description: + name: confetti + sha256: "979aafde2428c53947892c95eb244466c109c129b7eee9011f0a66caaca52267" + url: "https://pub.dev" + source: hosted + version: "0.7.0" connectivity_plus: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index b6c025a..9cf471f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -65,6 +65,7 @@ dependencies: hive_generator: ^2.0.0 riverpod: ^2.1.1 tutorial_coach_mark: ^1.2.4 + confetti: ^0.7.0 dev_dependencies: # flutter_launcher_icons: ^0.9.2