Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
poka | 68c8a61939 |
|
@ -47,6 +47,9 @@ android/key.properties
|
|||
# Rust things
|
||||
/target
|
||||
|
||||
# Linux builds
|
||||
linux/
|
||||
|
||||
# Custom
|
||||
scripts/private/
|
||||
AppDir/
|
||||
|
@ -56,4 +59,5 @@ android/app/build.gradle
|
|||
integration_test/duniter/data/chains/
|
||||
|
||||
# Ignore PC deps
|
||||
scripts/pushGecko
|
||||
macos/
|
||||
windows/
|
|
@ -7,7 +7,7 @@ stages:
|
|||
.env:
|
||||
image: axiomteam/gecko-ci:v0.0.11
|
||||
tags:
|
||||
- docker
|
||||
- redshift
|
||||
|
||||
format:
|
||||
extends: .env
|
||||
|
@ -28,10 +28,9 @@ build_and_test:
|
|||
- if: $CI_COMMIT_TAG || $CI_MERGE_REQUEST_ID
|
||||
- when: manual
|
||||
stage: build_and_test
|
||||
tags:
|
||||
- redshift
|
||||
script:
|
||||
- flutter clean
|
||||
- rm -rf /root/.pub-cache
|
||||
- flutter pub get
|
||||
- flutter analyze
|
||||
|
||||
releases:test:
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
android:label="Ğecko"
|
||||
android:usesCleartextTraffic="true">
|
||||
<!-- TODO: Remove usesCleartextTraffic for production mode ! kopa -->
|
||||
<!-- android:icon="@mipmap/launcher_icon"> -->
|
||||
<!-- android:icon="@mipmap/ic_launcher"> -->
|
||||
<activity
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:name=".MainActivity"
|
||||
android:icon="@mipmap/launcher_icon"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
|
@ -33,7 +33,7 @@
|
|||
<!-- <meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
android:icon="@mipmap/launcher_icon"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
/> -->
|
||||
|
||||
<intent-filter>
|
||||
|
|
Before Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 246 KiB |
Before Width: | Height: | Size: 192 KiB After Width: | Height: | Size: 166 KiB |
BIN
assets/party.png
Before Width: | Height: | Size: 21 KiB |
|
@ -71,8 +71,7 @@
|
|||
"areYouSureToDeleteWallet": "Are you sure you want to delete the chest \"{}\"?",
|
||||
"areYouSureForgetAllChests": "Are you sure you want to forget all your chests?",
|
||||
"areYouSureToForgetWallet": "Are you sure you wan to forget the wallet \"{}\"?",
|
||||
"areYouSureYouWantToCertify1": "Are you sure you want to certify the identity :",
|
||||
"areYouSureYouWantToCertify2": "having the address :",
|
||||
"areYouSureYouWantToCertify": "Are you sure you want to certify the address:\n\n{}",
|
||||
"yes": "Yes",
|
||||
"no": "No",
|
||||
"keepYourMnemonicSecret": "Try to keep this phrase a secret, as it allows anyone who knows it to access all your wallets.",
|
||||
|
@ -157,7 +156,7 @@
|
|||
"hours": "{} hours {}",
|
||||
"days": "{} days",
|
||||
"months": "{} months",
|
||||
"certify": "Certify this\nidentity",
|
||||
"certify": "Certify",
|
||||
"from": "From:",
|
||||
"to": "To:",
|
||||
"amount": "Amount:",
|
||||
|
@ -169,7 +168,7 @@
|
|||
"deleteThisWallet": "Delete this wallet",
|
||||
"cancel": "Cancel",
|
||||
"inBlockchainResult": "In {} blockchain",
|
||||
"search": "Search an identity\nor an address",
|
||||
"search": "Search",
|
||||
"currencyNode": "{} node :",
|
||||
"contactsManagementWithNbr": "My contacts ({})",
|
||||
"contactsManagement": "My contacts",
|
||||
|
@ -196,14 +195,5 @@
|
|||
"youCannotRevokeThisIdentity": "You cannot revoke this identity while\nit is member of the blacksmiths web",
|
||||
"showUdAmounts": "Show amounts in UD",
|
||||
"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",
|
||||
"received": "Received",
|
||||
"sent": "Sent",
|
||||
"createIdentity": "Create a new \nidentity",
|
||||
"memberAccountOf": "Account of {}",
|
||||
"pasteAddress": "Paste address from\nclipboard",
|
||||
"historyStart" :"Beginning of history",
|
||||
"blockchainStart": "Beginning of the ĞDev"
|
||||
"chooseATargetWallet": "Choose a target wallet"
|
||||
}
|
|
@ -1,92 +1,90 @@
|
|||
{
|
||||
"searchWallet": "Buscar\nmonedero",
|
||||
"manageWallets": "Gestionar\nmonederos",
|
||||
"searchWallet": "Buscar\nbilletera",
|
||||
"manageWallets": "Gestionar\nbilleteras",
|
||||
"scanQRCode": "Escanear un\ncódigo QR",
|
||||
"wellConnectedToNode": "Estás bien conectado al nodo\n{}",
|
||||
"wellConnectedToNode": "Estas bien conectada al nodo\n{}",
|
||||
"networkLost": "Se ha perdido la red...",
|
||||
"noDuniterEndointAvailable": "No hay servidor disponible...",
|
||||
"connectionPending": "Conexión pendiente...",
|
||||
"noLizard": "no hay lagarto ;-)",
|
||||
"loading": "Cargando...",
|
||||
"forgot_password.png": "forgot_password_es.png",
|
||||
"warningForgotPassword": "En una cadena de bloques o blockchain, no hay procedimiento de recuperación mediante correo electrónico. Sólo tu frase de recuperación puede permitirte recuperar tus Ğ1 en cualquier momento.",
|
||||
"forgot_password.png": "forgot_password_en.png",
|
||||
"warningForgotPassword": "In a blockchain, there is no email recovery procedure. Only your recovery phrase can allow you to recover your Ğ1 at any time.",
|
||||
"fastAppDescription": "La aplicación de pago {}\nmás rápida que un reptil de Vietnam",
|
||||
"createWallet": "Crear un monedero",
|
||||
"restoreWallet": "Restaurar mis monederos",
|
||||
"createWallet": "Crear una billetera",
|
||||
"restoreWallet": "Restaurar mis billeteras",
|
||||
"parameters": "Parámetros",
|
||||
"chooseAnotherMnemonic": "Elige otra frase de restauración",
|
||||
"iNotedMyMnemonic": "He anotado mi frase de restauración",
|
||||
"printMyMnemonic": "Imprimir mi frase de restauración",
|
||||
"manageChest": "Configurar este cofre",
|
||||
"changeChest": "Cambiar de cofre",
|
||||
"GeckoChest": "Cofre de Ğecko",
|
||||
"toUnlockEnterPassword": "Para desbloquear tu cofre, introduce tu contraseña, lejos de lagartijas curiosas:",
|
||||
"rememberPassword": "Mantener en memoria mi contraseña durante 15 minutos",
|
||||
"myRootWallet": "Mi monedero principal",
|
||||
"currentWallet": "Mi cofre actual",
|
||||
"wallet": "monedero",
|
||||
"displayMnemonic": "Mostrar mi frase de restauración",
|
||||
"chooseAnotherMnemonic": "Choose an other\nmnemonic sentence",
|
||||
"iNotedMyMnemonic": "He escrito mi frase",
|
||||
"printMyMnemonic": "Print my mnemonic sentence",
|
||||
"manageChest": "Configure this chest",
|
||||
"changeChest": "Change chest",
|
||||
"geckoChest": "Ğecko chest",
|
||||
"toUnlockEnterPassword": "To unlock your safe, enter your secret code, away from prying lizards:",
|
||||
"rememberPassword": "Keep this code in memory for 15 minutes",
|
||||
"myRootWallet": "Mi billetera principal",
|
||||
"currentWallet": "My current chest",
|
||||
"wallet": "Billetera",
|
||||
"displayMnemonic": "Display my mnemonic sentence",
|
||||
"changePassword": "Cambiar mi contraseña",
|
||||
"createDerivation": "Crear una nueva derivación",
|
||||
"createCustomDerivation": "Crear una nueva derivación personalizada",
|
||||
"deleteChest": "Borrar este cofre",
|
||||
"openThisChest": "Abrir este cofre",
|
||||
"createChest": "Crear un nuevo cofre",
|
||||
"importChest": "Importar un cofre",
|
||||
"selectMyChest": "Seleccionar mi cofre",
|
||||
"accessMyChest": "Acceder a mi cofre",
|
||||
"manageMembership": "Administrar mi afiliación",
|
||||
"chooseThisWallet": "Elegir este monedero",
|
||||
"thisWalletIsDefault": "Monedero definido por defecto",
|
||||
"defineWalletAsDefault": "Definir este monedero como por defecto",
|
||||
"displayActivity": "Visualizar actividad",
|
||||
"displayNActivity": "Visualizar\nactividad",
|
||||
"createDerivation": "Create a new derivation",
|
||||
"createCustomDerivation": "Create a new custom derivation",
|
||||
"deleteChest": "Delete this chest",
|
||||
"openThisChest": "Open this chest",
|
||||
"createChest": "Create a new chest",
|
||||
"importChest": "Import a chest",
|
||||
"selectMyChest": "Select my chest",
|
||||
"accessMyChest": "Access my chest",
|
||||
"manageMembership": "Manage my membership",
|
||||
"chooseThisWallet": "Elegir esta billetera",
|
||||
"thisWalletIsDefault": "This wallet is the default one",
|
||||
"defineWalletAsDefault": "Define this as the default one",
|
||||
"displayActivity": "Display activity",
|
||||
"displayNActivity": "Display\nactivity",
|
||||
"memberValidated": "Miembro validado!",
|
||||
"copyAddress": "Copiar\nla dirección",
|
||||
"copyAddress": "Copiar\ndirección",
|
||||
"copy": "Copiar",
|
||||
"thisAddressHasBeenCopiedToClipboard": "Esta dirección se ha copiado al portapapeles",
|
||||
"chooseWalletName": "Elige un nuevo nombre\npara tu monedero:",
|
||||
"choosePassword": "Elige una contraseña aleatoria:",
|
||||
"chooseDerivation": "Elige una derivación:",
|
||||
"thisAddressHasBeenCopiedToClipboard": "Esta dirección se ha copiado al cortapapeles",
|
||||
"chooseWalletName": "Choose a new name\nfor your wallet:",
|
||||
"choosePassword": "Choose a random password:",
|
||||
"chooseDerivation": "Choose a derivation:",
|
||||
"validate": "Validar",
|
||||
"confirm": "Confirmar",
|
||||
"confirmPayment": "Confirmar pago",
|
||||
"GeckoGenerateYourWalletFromMnemonic": "Ğecko construye tu monedero a partir de una **frase de restauración**. Es como unos planos que permiten restaurar tu monedero.",
|
||||
"keepThisMnemonicSecure": "Guarda esta frase con cuidado, porque sin ella Ğecko no podrá restaurar tus monederos el día que cambies de dispositivo.",
|
||||
"GeckoGeneratedYourMnemonicKeepItSecret": "¡Ğecko generó tu frase de restauración con éxito! Mantenla en secreto, porque cualquiera que la sepa puede acceder a todos tus monederos.",
|
||||
"newWallet": "Nuevo monedero",
|
||||
"itsTimeToUseAPenAndPaper": "Es el momento de coger un **papel y un bolígrafo** para anotar tu frase de restauración.",
|
||||
"yourMnemonic": "tu frase de restauración",
|
||||
"gecko_also_can_forget.png": "gecko_also_can_forget_es.png",
|
||||
"didYouNoteMnemonicToBeSureTypeWord": "¿Anotaste bien tu frase de restauración? Para asegurarnos, escriba la **palabra #{}** de tu frase de restauración en el cuadro de abajo:",
|
||||
"GeckoWillGenerateAPassword": "Ahora Ğecko te generará una contraseña corta que te permitirá acceder rápidamente a tus monederos, sin tener que escribir cada vez tu frase de recuperación.",
|
||||
"myPassword": "Mi contraseña",
|
||||
"thisPasswordProtectsYourWalletsInASecureChest": "Esta contraseña protege tus monederos en un cofre **del que sólo tú tienes acceso**, para que tus monederos no puedan ser utilizados por otros.",
|
||||
"hereIsThePasswordKeepIt": "¡Y aquí está tu contraseña!\n\nMemorízala o anótala, porque Ğecko te la pedirá **cada vez** que quieras hacer un pago en este dispositivo.",
|
||||
"geckoGenerateYourWalletFromMnemonic": "Ğecko builds your wallet from a **restoration sentence**. It is a bit like the blueprint that builds your wallet.",
|
||||
"keepThisMnemonicSecure": "Keep this sentence carefully, because without it Ğecko will not be able to rebuild your wallets the day you change your phone.",
|
||||
"geckoGeneratedYourMnemonicKeepItSecret": "Ğecko generated your mnemonic successfully! Keep it secret, because anyone who knows it can access all your wallets.",
|
||||
"newWallet": "New Wallet",
|
||||
"itsTimeToUseAPenAndPaper": "It's time to take a **pen and paper** in order to write down your mnemonic.",
|
||||
"yourMnemonic": "Your mnemonic",
|
||||
"gecko_also_can_forget.png": "gecko_also_can_forget_en.png",
|
||||
"didYouNoteMnemonicToBeSureTypeWord": "Did you write down your menmonic?\n\n To be sure, please type the **{}th word** of your restoration phrase in the field below:",
|
||||
"geckoWillGenerateAPassword": "Gecko will now generate for you a short password that will allow you to quickly access your wallets, without having to type your recovery sentence every time.",
|
||||
"myPassword": "My password",
|
||||
"thisPasswordProtectsYourWalletsInASecureChest": "This secret code protects your wallets in a safe **which only you have the code for**, so that your wallets cannot be used by others.",
|
||||
"hereIsThePasswordKeepIt": "And here is your password!\n\nMemorize it or write it down, because you will be asked **every time** you want to make a payment on this device.",
|
||||
"chooseAnotherPassword": "Elige otra contraseña",
|
||||
"iNotedMyPassword": "He anotado mi contraseña",
|
||||
"GeckoWillCheckPassword": "Ğecko comprobará contigo si has recordado tu contraseña. Escribe tu contraseña en el cuadro de abajo para comprobar que lo has apuntado correctamente.",
|
||||
"yourChestAndWalletWereCreatedSuccessfully": "¡Genial!\n\nTu cofre y tu primer monedero han sido creados con éxito.\n\n¡Felicidades!",
|
||||
"allGood": "¡Todo bien!",
|
||||
"areYouSureToDeleteWallet": "¿Seguro de que quieres eliminar el cofre \"{}\"?",
|
||||
"areYouSureForgetAllChests": "¿Seguro de que quieres olvidar todos tus cofres?",
|
||||
"areYouSureToForgetWallet": "¿Seguro de que quieres olvidar el monedero \"{}\"?",
|
||||
"areYouSureYouWantToCertify": "¿Seguro de que quiere certificar a la dirección\n\n{}?",
|
||||
"areYouSureYouWantToCertify1": "¿Seguro de que quiere certificar a la identidad :",
|
||||
"areYouSureYouWantToCertify2": " a la dirección :",
|
||||
"yes": "Sí",
|
||||
"iNotedMyPassword": "I noted my password",
|
||||
"geckoWillCheckPassword": "Gecko will check with you if you have remembered your secret code.\n\n Type your secret code in the field below to check that you have written it down correctly.",
|
||||
"yourChestAndWalletWereCreatedSuccessfully": "Super!\n\nYour chest and your first portfolio have been created with great success.\n\nCongratulations!",
|
||||
"allGood": "That's all good!",
|
||||
"areYouSureToDeleteWallet": "Are you sure you want to delete the chest \"{}\"?",
|
||||
"areYouSureForgetAllChests": "Are you sure you want to forget all your chests?",
|
||||
"areYouSureToForgetWallet": "Are you sure you wan to forget the wallet \"{}\"?",
|
||||
"areYouSureYouWantToCertify": "Are you sure you want to certify the address:\n\n{}",
|
||||
"yes": "Si",
|
||||
"no": "No",
|
||||
"keepYourMnemonicSecret": "Intenta mantener esta frase de restauración en secreto, ya que permite a cualquiera que la conozca acceder a todas tus monederos.",
|
||||
"iGeneratedYourMnemonicKeepItSecret": "¡He generado tu frase de restauración!\nIntenta mantenerla en secreto, ya que permite a cualquiera que la conozca acceder a todos tus monederos.",
|
||||
"myMnemonic": "Mi frase de restauración",
|
||||
"close": "Cerrar",
|
||||
"toRestoreEnterMnemonic": "Para restaurar tus monederos Ğecko, introduce las 12 palabras que componen tu frase de restauración en los cuadros de abajo:",
|
||||
"pasteFromClipboard": "Pegar del\nportapapeles",
|
||||
"restoreAChest": "Restaurar un cofre",
|
||||
"restoreThisChest": "Restaurar este cofre",
|
||||
"keepYourMnemonicSecret": "Try to keep this phrase a secret, as it allows anyone who knows it to access all your wallets.",
|
||||
"iGeneratedYourMnemonicKeepItSecret": "I've generated your restoration phrase!\n Try to keep it a secret, as it allows anyone who knows it to access all your portfolios.",
|
||||
"myMnemonic": "My mnemonic",
|
||||
"close": "Close",
|
||||
"toRestoreEnterMnemonic": "To restore your Gecko wallets, enter in the fields below the 12 words that constitute your restoration phrase:",
|
||||
"pasteFromClipboard": "Paste from\nclipboard",
|
||||
"restoreAChest": "Restore a chest",
|
||||
"restoreThisChest": "Restore this chest",
|
||||
"continue": "Continuar",
|
||||
"itsTheGoodWord": "¡Es la palabra correcta!",
|
||||
"nthMnemonicWord": "palabra de tu mnemotecnia",
|
||||
"itsTheGoodWord": "It's the good word!",
|
||||
"nthMnemonicWord": "word of your mnemonic",
|
||||
"1th": "Primera",
|
||||
"2th": "Segunda",
|
||||
"3th": "Tercera",
|
||||
|
@ -100,17 +98,17 @@
|
|||
"11th": "Undécima",
|
||||
"12th": "Duodécima",
|
||||
"yourPasswordLengthIsX": "La longitud de tu contraseña es {}",
|
||||
"noIdentity": "Ninguna identidad",
|
||||
"noIdentity": "No identity",
|
||||
"identityCreated": "Identidad creada",
|
||||
"identityConfirmed": "Identidad confirmada",
|
||||
"identityExpired": "Identidad caducada",
|
||||
"identityExpired": "Identitdad caducada",
|
||||
"confirmYourIdentity": "Confirma tu identidad",
|
||||
"noDuniterNodeAvailableTryLater": "No hay ningún nodo Duniter disponible, por favor, inténtalo más tarde",
|
||||
"youAreConnectedToNode": "Estás conectado al nodo",
|
||||
"noDuniterNodeAvailableTryLater": "No Duniter node available, please try again later",
|
||||
"youAreConnectedToNode": "You are connected to node",
|
||||
"accountActivity": "Actividad de la cuenta",
|
||||
"noNetworkNoHistory": "El estado de la red no permite\nmostrar el historial de la cuenta",
|
||||
"noDataToDisplay": "No hay datos que mostrar.",
|
||||
"noTransactionToDisplay": "No hay transacciónes a mostrar",
|
||||
"noNetworkNoHistory": "Network state does not allow\nto display account history",
|
||||
"noDataToDisplay": "No data to be displayed.",
|
||||
"noTransactionToDisplay": "No transaction to display",
|
||||
"month1": "Enero",
|
||||
"month2": "Febrero",
|
||||
"month3": "Marzo",
|
||||
|
@ -126,85 +124,76 @@
|
|||
"today": "Hoy",
|
||||
"yesterday": "Ayer",
|
||||
"thisWeek": "Esta semana",
|
||||
"chestNotCompatibleMustReinstallGecko": "La versión de tus cofres no es compatible con esta versión de Ğecko.\nTodos tus cofres serán olvidados, debes importarlos de nuevo.",
|
||||
"notConnectedToInternet": "No estás conectado a Internet",
|
||||
"researchResults": "Resultados de tu búsqueda",
|
||||
"resultsFor": "Resultados para ",
|
||||
"forgetAllMyChests": "Olvida todos mis cofres",
|
||||
"transaction": "Transacción",
|
||||
"certification": "Certificación",
|
||||
"identityConfirm": "Confirmación de la identidad",
|
||||
"revokeAdhesion": "Revocación de adhesión",
|
||||
"strangeTransaction": "Transacción extraña",
|
||||
"chestNotCompatibleMustReinstallGecko": "The version of your safes is no longer compatible with this version of Ğecko.\nAll your safes will be forgotten, you must import them again.",
|
||||
"notConnectedToInternet": "No estas conectado a internet",
|
||||
"researchResults": "Results of your research",
|
||||
"resultsFor": "Results for ",
|
||||
"forgetAllMyChests": "Forget all my chests",
|
||||
"transaction": "Transaccion",
|
||||
"certification": "Certificacion",
|
||||
"identityConfirm": "Identity confirmation",
|
||||
"revokeAdhesion": "Adhesion revocation",
|
||||
"strangeTransaction": "Strange transaction",
|
||||
"sending": "Enviando...",
|
||||
"propagating": "Propagando...",
|
||||
"validating": "Validando...",
|
||||
"anErrorOccured": "Ocurrió un error",
|
||||
"24hbetweenCerts": "Hay que esperar 24 horas entre certificaciones",
|
||||
"canNotCertifySelf": "No puedes certificarte a ti mismo",
|
||||
"nameAlreadyExist": "Este nombre ya está ocupado",
|
||||
"2GDtoKeepAlive": "Tienes que mantener al menos 2ĞD para mantener tu cuenta viva",
|
||||
"youHaveToFeedThisAccountBeforeUsing": "Tienes que nutrir el balance\nde esta cuenta antes de usarla.",
|
||||
"execTimeoutOver": "Se ha agotado el tiempo de ejecución",
|
||||
"seeAWallet": "Ver un monedero",
|
||||
"anErrorOccurred": "Ocurrió un error",
|
||||
"24hbetweenCerts": "You have to wait 24h between certs",
|
||||
"canNotCertifySelf": "You can not certify yourself",
|
||||
"nameAlreadyExist": "This name is already taken",
|
||||
"2GDtoKeepAlive": "You have to keep at least 2ĞD to keep your account alive",
|
||||
"youHaveToFeedThisAccountBeforeUsing": "You have to feed this account\nbefore using it.",
|
||||
"execTimeoutOver": "Execution timeout is over",
|
||||
"seeAWallet": "Ver una billetera",
|
||||
"mustWaitXBeforeCertify": "Tienes que esperar\n{} antes de\nvolver a certificar",
|
||||
"mustConfirmHisIdentity": "Esta persona debe confirmar\nsu identidad antes de poder ser certificada",
|
||||
"canRenewCertInX": "Podrás renovar\nla certificación\nen {}",
|
||||
"executeATransfer": "Ejecutar una transacción",
|
||||
"executeTheTransfer": "Ejecutar la transacción",
|
||||
"doATransfer" : "Hacer una\ntransacción",
|
||||
"mustConfirmHisIdentity": "This person must confirm\nhis identity before can be\ncertified",
|
||||
"canRenewCertInX": "You can renew\nthis certification\nin {}",
|
||||
"executeATransfer": "Execute a transfer",
|
||||
"executeTheTransfer": "Execute the transfer",
|
||||
"doATransfer" : "Execute a\ntransfer",
|
||||
"seconds": "{} segundos",
|
||||
"minutes": "{} minutos",
|
||||
"hours": "{} horas {}",
|
||||
"days": "{} dias",
|
||||
"months": "{} meses",
|
||||
"certify": "Certificar esta\nidentidad",
|
||||
"certify": "Certify",
|
||||
"from": "De:",
|
||||
"to": "A:",
|
||||
"amount": "Importe:",
|
||||
"choiceOfSourceWallet": "Elige un monedero de origen",
|
||||
"choiceOfSourceWallet": "Choose a source wallet",
|
||||
"extrinsicInProgress": "{} en progreso",
|
||||
"extrinsicValidated": "¡ {} validado !",
|
||||
"extrinsicValidated": "{} validado !",
|
||||
"fromMinus": "de",
|
||||
"toMinus": "a",
|
||||
"deleteThisWallet": "Borrar este monedero",
|
||||
"deleteThisWallet": "Delete this wallet",
|
||||
"cancel": "Cancelar",
|
||||
"inBlockchainResult": "En la blockchain {}",
|
||||
"search": "Buscar una identidad\no una dirección",
|
||||
"currencyNode": "Nodo {} :",
|
||||
"inBlockchainResult": "In {} blockchain",
|
||||
"search": "Buscar",
|
||||
"currencyNode": "{} nodo :",
|
||||
"contactsManagementWithNbr": "Mis contactos ({})",
|
||||
"contactsManagement": "Mis contactos",
|
||||
"noContacts": "No tienes ningún contacto",
|
||||
"addContact": "Añadir\na contactos",
|
||||
"removeContact": "Eliminar\neste contacto",
|
||||
"derivationsScanProgress": "Escaneado de la dirección {}/{}",
|
||||
"youAreOffline": "Estás desconectado...",
|
||||
"importG1v1": "Importar la cuenta antigua de G1v1",
|
||||
"selectDestWallet": "Selecciona un monedero destino:",
|
||||
"youMustWaitBeforeCashoutThisAccount": "Tienes que esperar unos minutos antes de migrar esta cuenta",
|
||||
"thisAccountIsEmpty": "Esta cuenta está vacía",
|
||||
"youCannotMigrateIdentityToExistingIdentity": "No se puede migrar una identidad\na una cuenta que ya tiene una identidad",
|
||||
"importOldAccount": "Importar antigua cuenta",
|
||||
"enterCesiumId": "Ingresa tu frase secreta de Cesium",
|
||||
"enterCesiumPassword": "Ingresa tu contraseña de Cesium",
|
||||
"migrateAccount": "Migrar cuenta",
|
||||
"migrateIdentity": "Migrar identidad",
|
||||
"identityMigration": "Migración de la identidad",
|
||||
"areYouSureMigrateIdentity": "¿Estás seguro de que quieres migrar permanentemente la identidad **{}** con saldo de **{}**?",
|
||||
"someoneCreatedYourIdentity": "¡ Alguien ha creado tu {} identidad !",
|
||||
"noContacts": "You don't have any contact",
|
||||
"addContact": "Add\nto contacts",
|
||||
"removeContact": "Remove\nthis contact",
|
||||
"derivationsScanProgress": "Scan address {}/{}",
|
||||
"youAreOffline": "You are offline...",
|
||||
"importG1v1": "Import old G1v1 account",
|
||||
"selectDestWallet": "Select a target wallet:",
|
||||
"youMustWaitBeforeCashoutThisAccount": "You have to wait a few moment before migrate this account",
|
||||
"thisAccountIsEmpty": "This account is empty",
|
||||
"youCannotMigrateIdentityToExistingIdentity": "You cannot migrate an identity\nto an account that already has an identity",
|
||||
"importOldAccount": "Import your old account",
|
||||
"enterCesiumId": "Ingrese su ID de Cesium",
|
||||
"enterCesiumPassword": "Ingrese su contraseña de Cesium",
|
||||
"migrateAccount": "Migrate account",
|
||||
"migrateIdentity": "Migrate identity",
|
||||
"identityMigration": "Identity migration",
|
||||
"areYouSureMigrateIdentity": "Are you sure you want to permanently migrate identity **{}** with balance of **{}** ?",
|
||||
"someoneCreatedYourIdentity": "Someone created your {} identity !",
|
||||
"confirmMyIdentity": "Confirmar mi identidad",
|
||||
"revokeMyIdentity": "Revocar mi identidad",
|
||||
"youCannotRevokeThisIdentity": "No puedes revocar esta identidad mientras\nseas miembro de la red de forjadores",
|
||||
"showUdAmounts": "Mostrar importes en DU",
|
||||
"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",
|
||||
"received": "Received",
|
||||
"sent": "Sent",
|
||||
"createIdentity": "Create a new \nidentity",
|
||||
"memberAccountOf": "Account of {}",
|
||||
"pasteAddress": "Paste address from\nclipboard",
|
||||
"historyStart" :"Beginning of history",
|
||||
"blockchainStart": "Comienzo de la ĞDev"
|
||||
"youCannotRevokeThisIdentity": "You cannot revoke this identity while\nit is member of the blacksmiths web",
|
||||
"showUdAmounts": "Show amounts in UD",
|
||||
"ud": "{}UD",
|
||||
"chooseATargetWallet": "Elija una billetera de destino"
|
||||
}
|
||||
|
|
|
@ -66,13 +66,12 @@
|
|||
"chooseAnotherPassword": "Choisir un autre code secret",
|
||||
"iNotedMyPassword": "J'ai noté mon code secret",
|
||||
"geckoWillCheckPassword": "Gecko va vérifier avec vous si vous avez bien mémorisé votre code secret.\n\nTapez votre code secret dans le champ ci-dessous pour vérifier que vous l’avez bien noté.",
|
||||
"yourChestAndWalletWereCreatedSuccessfully": "Top !\n\nVotre coffre et votre premier portefeuille ont été créés avec un immense succès.\n\nFélicitations !",
|
||||
"yourChestAndWalletWereCreatedSuccessfully": "Top !\n\nVotre coffre votre premier portefeuille ont été créés avec un immense succès.\n\nFélicitations !",
|
||||
"allGood": "C’est tout bon !",
|
||||
"areYouSureToDeleteWallet": "Êtes-vous sûr de vouloir supprimer le coffre \"{}\" ?",
|
||||
"areYouSureForgetAllChests": "Êtes-vous sûr de vouloir oublier tous vos coffres ?",
|
||||
"areYouSureToForgetWallet": "Êtes-vous sûr de vouloir oublier le portefeuille \"{}\" ?",
|
||||
"areYouSureYouWantToCertify1": "Êtes-vous certain de vouloir certifier l'identité :",
|
||||
"areYouSureYouWantToCertify2": "ayant pour adresse :",
|
||||
"areYouSureYouWantToCertify": "Êtes-vous certain de vouloir certifier l'adresse:\n\n{}",
|
||||
"yes": "Oui",
|
||||
"no": "Non",
|
||||
"keepYourMnemonicSecret": "Tâchez de garder cette phrase bien secrète, car elle permet à quiconque la connaît d’accéder à tous vos portefeuilles.",
|
||||
|
@ -158,7 +157,7 @@
|
|||
"hours": "{} heures {}",
|
||||
"days": "{} jours",
|
||||
"months": "{} mois",
|
||||
"certify": "Certifier cette\nidentité",
|
||||
"certify": "Certifier",
|
||||
"from": "Depuis:",
|
||||
"to": "Vers:",
|
||||
"amount": "Montant:",
|
||||
|
@ -170,7 +169,7 @@
|
|||
"deleteThisWallet": "Supprimer ce portefeuille",
|
||||
"cancel": "Annuler",
|
||||
"inBlockchainResult": "Dans la blockchain {}",
|
||||
"search": "Rechercher une identité\nou une adresse",
|
||||
"search": "Rechercher",
|
||||
"currencyNode": "Noeud {} :",
|
||||
"contactsManagementWithNbr": "Mes contacts ({})",
|
||||
"contactsManagement": "Mes contacts",
|
||||
|
@ -181,7 +180,7 @@
|
|||
"youAreOffline": "Vous êtes hors ligne...",
|
||||
"importG1v1": "Importer un ancien compte G1v1",
|
||||
"selectDestWallet": "Sélectionnez un portefeuille cible:",
|
||||
"youMustWaitBeforeCashoutThisAccount": "Vous devez attendre quelques minutes\navant de pouvoir migrer ce compte",
|
||||
"youMustWaitBeforeCashoutThisAccount": "Vous devez attendre quelques minutes avant de pouvoir migrer ce compte",
|
||||
"thisAccountIsEmpty": "Ce compte est vide",
|
||||
"youCannotMigrateIdentityToExistingIdentity": "Vous ne pouvez pas migrer une identité\nvers un compte disposant déjà d'une identité",
|
||||
"importOldAccount": "Importer son ancien compte",
|
||||
|
@ -197,14 +196,5 @@
|
|||
"youCannotRevokeThisIdentity": "Vous ne pouvez pas révoquer cette identité tant\nqu'elle fait partie de la toile forgerons",
|
||||
"showUdAmounts": "Afficher les montants en DU",
|
||||
"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",
|
||||
"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",
|
||||
"blockchainStart": "Début de la ĞDev"
|
||||
}
|
||||
"chooseATargetWallet": "Choisissez un portefeuille cible"
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
[
|
||||
"wss://gdev.p2p.legal/ws",
|
||||
"wss://gdev.trentesaux.fr/ws"
|
||||
"wss://gdev.librelois.fr/ws"
|
||||
]
|
||||
|
|
|
@ -26,7 +26,7 @@ void main() async {
|
|||
await tapKey(keyImportG1v1);
|
||||
await enterText(keyCesiumId, 'test');
|
||||
await enterText(keyCesiumPassword, 'test');
|
||||
await waitFor('DCovzCEnQm9GUWe6mr8u42JR1JAuoj3HbQUGdCkfTzSr');
|
||||
await waitFor(cesiumTest1.shortAddress());
|
||||
await waitFor('100.0');
|
||||
await waitFor('3', exactMatch: true);
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
|
@ -136,7 +135,7 @@ Future<void> waitFor(String text,
|
|||
Finder finder = exactMatch ? find.text(text) : find.textContaining(text);
|
||||
log.d('INTEGRATION TEST: Wait for: $text');
|
||||
|
||||
final searchType = reverse ? 'reversed text' : 'text';
|
||||
final String searchType = reverse ? 'reversed text' : 'text';
|
||||
|
||||
do {
|
||||
if (DateTime.now().isAfter(end)) {
|
||||
|
@ -259,14 +258,14 @@ Future<WalletData> _addImportAccount(
|
|||
final address = await sub.importAccount(
|
||||
mnemonic: mnemonic, derivePath: '//$derivation', password: 'AAAAA');
|
||||
final myWallet = WalletData(
|
||||
version: dataVersion,
|
||||
chest: chest,
|
||||
address: address,
|
||||
number: number,
|
||||
name: name,
|
||||
derivation: derivation,
|
||||
imageDefaultPath: '${number % 4}.png',
|
||||
isOwned: true);
|
||||
await walletBox.put(myWallet.address, myWallet);
|
||||
imageDefaultPath: '${number % 4}.png');
|
||||
await walletBox.add(myWallet);
|
||||
|
||||
return myWallet;
|
||||
}
|
||||
|
|
|
@ -1,122 +1,122 @@
|
|||
{
|
||||
"images": [
|
||||
"images" : [
|
||||
{
|
||||
"filename": "Icon-App-20x20@2x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "2x",
|
||||
"size": "20x20"
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-20x20@3x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "3x",
|
||||
"size": "20x20"
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-29x29@1x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "1x",
|
||||
"size": "29x29"
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-29x29@2x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "2x",
|
||||
"size": "29x29"
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-29x29@3x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "3x",
|
||||
"size": "29x29"
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-40x40@2x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "2x",
|
||||
"size": "40x40"
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-40x40@3x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "3x",
|
||||
"size": "40x40"
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-60x60@2x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "2x",
|
||||
"size": "60x60"
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-60x60@3x.png",
|
||||
"idiom": "iphone",
|
||||
"scale": "3x",
|
||||
"size": "60x60"
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-20x20@1x.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "1x",
|
||||
"size": "20x20"
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-20x20@2x.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "2x",
|
||||
"size": "20x20"
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-29x29@1x.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "1x",
|
||||
"size": "29x29"
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-29x29@2x.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "2x",
|
||||
"size": "29x29"
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-40x40@1x.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "1x",
|
||||
"size": "40x40"
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-40x40@2x.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "2x",
|
||||
"size": "40x40"
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-76x76@1x.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "1x",
|
||||
"size": "76x76"
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-76x76@2x.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "2x",
|
||||
"size": "76x76"
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-83.5x83.5@2x.png",
|
||||
"idiom": "ipad",
|
||||
"scale": "2x",
|
||||
"size": "83.5x83.5"
|
||||
"size" : "83.5x83.5",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-83.5x83.5@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename": "Icon-App-1024x1024@1x.png",
|
||||
"idiom": "ios-marketing",
|
||||
"scale": "1x",
|
||||
"size": "1024x1024"
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "ios-marketing",
|
||||
"filename" : "Icon-App-1024x1024@1x.png",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info": {
|
||||
"author": "icons_launcher",
|
||||
"version": 1
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'dart:io';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/models/chest_data.dart';
|
||||
import 'package:gecko/models/g1_wallets_list.dart';
|
||||
|
@ -8,7 +7,7 @@ import 'package:hive_flutter/hive_flutter.dart';
|
|||
import 'package:logger/logger.dart';
|
||||
|
||||
// Version of box data
|
||||
const int dataVersion = 6;
|
||||
const int dataVersion = 4;
|
||||
|
||||
late String appVersion;
|
||||
const int pinLength = 5;
|
||||
|
@ -51,23 +50,3 @@ const debugPin = true;
|
|||
String indexerEndpoint = '';
|
||||
late double balanceRatio;
|
||||
late int udValue;
|
||||
|
||||
// Indexer
|
||||
late DateTime startBlockchainTime;
|
||||
|
||||
late int currentUdIndex;
|
||||
|
||||
final Map<int, String> monthsInYear = {
|
||||
1: "month1".tr(),
|
||||
2: "month2".tr(),
|
||||
3: "month3".tr(),
|
||||
4: "month4".tr(),
|
||||
5: "month5".tr(),
|
||||
6: "month6".tr(),
|
||||
7: "month7".tr(),
|
||||
8: "month8".tr(),
|
||||
9: "month9".tr(),
|
||||
10: "month10".tr(),
|
||||
11: "month11".tr(),
|
||||
12: "month12".tr()
|
||||
};
|
||||
|
|
|
@ -15,15 +15,13 @@
|
|||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/chest_data.dart';
|
||||
import 'package:gecko/models/g1_wallets_list.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/providers/cesium_plus.dart';
|
||||
import 'package:gecko/models/chest_data.dart';
|
||||
import 'package:gecko/providers/chest_provider.dart';
|
||||
import 'package:gecko/models/g1_wallets_list.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/providers/generate_wallets.dart';
|
||||
import 'package:gecko/providers/settings_provider.dart';
|
||||
|
@ -32,6 +30,7 @@ import 'package:gecko/providers/wallets_profiles.dart';
|
|||
import 'package:gecko/providers/home.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/providers/search.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/screens/home.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -58,24 +57,33 @@ Future<void> main() async {
|
|||
|
||||
HomeProvider homeProvider = HomeProvider();
|
||||
// DuniterIndexer _duniterIndexer = DuniterIndexer();
|
||||
|
||||
await initHiveForFlutter();
|
||||
await homeProvider.initHive();
|
||||
configBox = await Hive.openBox("configBox");
|
||||
|
||||
appVersion = await homeProvider.getAppVersion();
|
||||
|
||||
// Reset GraphQL cache
|
||||
// final cache = HiveStore();
|
||||
// cache.reset();
|
||||
|
||||
// Configure Hive and open boxes
|
||||
Hive.registerAdapter(WalletDataAdapter());
|
||||
Hive.registerAdapter(ChestDataAdapter());
|
||||
Hive.registerAdapter(G1WalletsListAdapter());
|
||||
Hive.registerAdapter(IdAdapter());
|
||||
|
||||
walletBox = await Hive.openBox<WalletData>("walletBox");
|
||||
chestBox = await Hive.openBox<ChestData>("chestBox");
|
||||
configBox = await Hive.openBox("configBox");
|
||||
await Hive.deleteBoxFromDisk('g1WalletsBox');
|
||||
g1WalletsBox = await Hive.openBox<G1WalletsList>("g1WalletsBox");
|
||||
contactsBox = await Hive.openBox<G1WalletsList>("contactsBox");
|
||||
|
||||
// Reset GraphQL cache
|
||||
// final cache = HiveStore();
|
||||
// cache.reset();
|
||||
await homeProvider.getValidEndpoints();
|
||||
// await configBox.delete('isCacheChecked');
|
||||
if (configBox.get('isCacheChecked') == null) {
|
||||
configBox.put('isCacheChecked', false);
|
||||
}
|
||||
// log.d(await configBox.get('endpoint'));
|
||||
|
||||
HttpOverrides.global = MyHttpOverrides();
|
||||
|
||||
|
@ -90,35 +98,31 @@ Future<void> main() async {
|
|||
// // ]);
|
||||
// Catcher(rootWidget: Gecko(endPointGVA, _store), debugConfig: debugOptions);
|
||||
|
||||
await SentryFlutter.init((options) {
|
||||
options.dsn =
|
||||
'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110';
|
||||
},
|
||||
appRunner: () => SystemChrome.setPreferredOrientations(
|
||||
[DeviceOrientation.portraitUp]).then((_) {
|
||||
runApp(EasyLocalization(
|
||||
supportedLocales: const [
|
||||
Locale('en'),
|
||||
Locale('fr'),
|
||||
Locale('es')
|
||||
],
|
||||
path: 'assets/translations',
|
||||
fallbackLocale: const Locale('en'),
|
||||
child: const Gecko(),
|
||||
));
|
||||
}));
|
||||
await SentryFlutter.init(
|
||||
(options) {
|
||||
options.dsn =
|
||||
'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110';
|
||||
},
|
||||
appRunner: () => runApp(
|
||||
EasyLocalization(
|
||||
supportedLocales: const [Locale('en'), Locale('fr'), Locale('es')],
|
||||
path: 'assets/translations',
|
||||
fallbackLocale: const Locale('en'),
|
||||
child: const Gecko(),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
log.i('Debug mode enabled: No sentry alerte');
|
||||
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
|
||||
.then((_) {
|
||||
runApp(EasyLocalization(
|
||||
runApp(
|
||||
EasyLocalization(
|
||||
supportedLocales: const [Locale('en'), Locale('fr'), Locale('es')],
|
||||
path: 'assets/translations',
|
||||
fallbackLocale: const Locale('en'),
|
||||
child: const Gecko(),
|
||||
));
|
||||
});
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,6 +131,8 @@ class Gecko extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
|
||||
// To configure multi_endpoints GraphQLProvider: https://stackoverflow.com/q/70656513/8301867
|
||||
|
||||
return MultiProvider(
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
|
||||
part 'chest_data.g.dart';
|
||||
|
||||
@HiveType(typeId: 1)
|
||||
|
|
|
@ -56,43 +56,5 @@ query ($address: String!, $number: Int!, $cursor: String) {
|
|||
}
|
||||
''';
|
||||
|
||||
const String getCertsReceived = r'''
|
||||
query ($address: String!) {
|
||||
certification(where: {receiver: {pubkey: {_eq: $address}}}) {
|
||||
issuer {
|
||||
pubkey
|
||||
name
|
||||
}
|
||||
created_at
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String getCertsSent = r'''
|
||||
query ($address: String!) {
|
||||
certification(where: {issuer: {pubkey: {_eq: $address}}}) {
|
||||
receiver {
|
||||
pubkey
|
||||
name
|
||||
}
|
||||
created_at
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String isIdtyExistQ = r'''
|
||||
query ($name: String!) {
|
||||
identity(where: {name: {_eq: $name}}) {
|
||||
name
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
const String getBlockchainStartQ = r'''
|
||||
query {
|
||||
block(limit: 1) {
|
||||
created_at
|
||||
number
|
||||
}
|
||||
}
|
||||
''';
|
||||
// To parse indexer date format
|
||||
// log.d(DateTime.parse("2022-06-13T16:51:24.001+00:00").toString());
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class StatefulWrapper extends StatefulWidget {
|
||||
final Function onInit;
|
||||
final Widget child;
|
||||
const StatefulWrapper({Key? key, required this.onInit, required this.child})
|
||||
: super(key: key);
|
||||
@override
|
||||
StatefulWrapperState createState() => StatefulWrapperState();
|
||||
}
|
||||
|
||||
class StatefulWrapperState extends State<StatefulWrapper> {
|
||||
@override
|
||||
void initState() {
|
||||
widget.onInit();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return widget.child;
|
||||
}
|
||||
}
|
|
@ -4,42 +4,38 @@ part 'wallet_data.g.dart';
|
|||
@HiveType(typeId: 0)
|
||||
class WalletData extends HiveObject {
|
||||
@HiveField(0)
|
||||
String address;
|
||||
int? version;
|
||||
|
||||
@HiveField(1)
|
||||
int? chest;
|
||||
|
||||
@HiveField(2)
|
||||
int? number;
|
||||
String? address;
|
||||
|
||||
@HiveField(3)
|
||||
String? name;
|
||||
int? number;
|
||||
|
||||
@HiveField(4)
|
||||
int? derivation;
|
||||
String? name;
|
||||
|
||||
@HiveField(5)
|
||||
String? imageDefaultPath;
|
||||
int? derivation;
|
||||
|
||||
@HiveField(6)
|
||||
String? imageCustomPath;
|
||||
String? imageDefaultPath;
|
||||
|
||||
@HiveField(7)
|
||||
bool isOwned;
|
||||
|
||||
@HiveField(8)
|
||||
bool isMember;
|
||||
String? imageCustomPath;
|
||||
|
||||
WalletData(
|
||||
{required this.address,
|
||||
{this.version,
|
||||
this.chest,
|
||||
this.address,
|
||||
this.number,
|
||||
this.name,
|
||||
this.derivation,
|
||||
this.imageDefaultPath,
|
||||
this.imageCustomPath,
|
||||
this.isOwned = false,
|
||||
this.isMember = false});
|
||||
this.imageCustomPath});
|
||||
|
||||
// representation of WalletData when debugging
|
||||
@override
|
||||
|
|
|
@ -17,40 +17,37 @@ class WalletDataAdapter extends TypeAdapter<WalletData> {
|
|||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return WalletData(
|
||||
address: fields[0] as String,
|
||||
version: fields[0] as int?,
|
||||
chest: fields[1] as int?,
|
||||
number: fields[2] as int?,
|
||||
name: fields[3] as String?,
|
||||
derivation: fields[4] as int?,
|
||||
imageDefaultPath: fields[5] as String?,
|
||||
imageCustomPath: fields[6] as String?,
|
||||
isOwned: fields[7] as bool,
|
||||
isMember: fields[8] as bool,
|
||||
address: fields[2] as String?,
|
||||
number: fields[3] as int?,
|
||||
name: fields[4] as String?,
|
||||
derivation: fields[5] as int?,
|
||||
imageDefaultPath: fields[6] as String?,
|
||||
imageCustomPath: fields[7] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, WalletData obj) {
|
||||
writer
|
||||
..writeByte(9)
|
||||
..writeByte(8)
|
||||
..writeByte(0)
|
||||
..write(obj.address)
|
||||
..write(obj.version)
|
||||
..writeByte(1)
|
||||
..write(obj.chest)
|
||||
..writeByte(2)
|
||||
..write(obj.number)
|
||||
..write(obj.address)
|
||||
..writeByte(3)
|
||||
..write(obj.name)
|
||||
..write(obj.number)
|
||||
..writeByte(4)
|
||||
..write(obj.derivation)
|
||||
..write(obj.name)
|
||||
..writeByte(5)
|
||||
..write(obj.imageDefaultPath)
|
||||
..write(obj.derivation)
|
||||
..writeByte(6)
|
||||
..write(obj.imageCustomPath)
|
||||
..write(obj.imageDefaultPath)
|
||||
..writeByte(7)
|
||||
..write(obj.isOwned)
|
||||
..writeByte(8)
|
||||
..write(obj.isMember);
|
||||
..write(obj.imageCustomPath);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -61,9 +61,6 @@ const keyCloseTransactionScreen = Key('keyCloseTransactionScreen');
|
|||
const keyListTransactions = Key('keyListTransactions');
|
||||
const keyActivityScreen = Key('keyActivityScreen');
|
||||
|
||||
// Certification view
|
||||
const keyCertsReceived = Key('keyCertsReceived');
|
||||
|
||||
// Unlock wallet
|
||||
const keyUnlockWallet = Key('keyUnlockWallet');
|
||||
const keyPinForm = Key('keyPinForm');
|
||||
|
|
|
@ -8,6 +8,8 @@ import 'package:path_provider/path_provider.dart';
|
|||
|
||||
class CesiumPlusProvider with ChangeNotifier {
|
||||
TextEditingController cesiumName = TextEditingController();
|
||||
Image defaultAvatar(double size) =>
|
||||
Image.asset(('assets/icon_user.png'), height: size);
|
||||
|
||||
CancelToken avatarCancelToken = CancelToken();
|
||||
|
||||
|
@ -154,6 +156,3 @@ class CesiumPlusProvider with ChangeNotifier {
|
|||
return finalAvatar;
|
||||
}
|
||||
}
|
||||
|
||||
Image defaultAvatar(double size) =>
|
||||
Image.asset(('assets/icon_user.png'), height: size);
|
||||
|
|
|
@ -16,11 +16,11 @@ class ChestProvider with ChangeNotifier {
|
|||
|
||||
Future deleteChest(context, ChestData chest) async {
|
||||
final bool? answer = await (_confirmDeletingChest(context, chest.name));
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
if (answer ?? false) {
|
||||
await sub.deleteAccounts(getChestWallets(chest));
|
||||
await chestBox.delete(chest.key);
|
||||
final myWalletProvider =
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
|
||||
myWalletProvider.pinCode = '';
|
||||
|
@ -45,7 +45,7 @@ class ChestProvider with ChangeNotifier {
|
|||
log.d(chest.key);
|
||||
walletBox.toMap().forEach((key, WalletData value) {
|
||||
if (value.chest == chest.key) {
|
||||
toDelete.add(value.address);
|
||||
toDelete.add(value.address!);
|
||||
}
|
||||
});
|
||||
return toDelete;
|
||||
|
|
|
@ -5,18 +5,28 @@ import 'package:easy_localization/easy_localization.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/g1_wallets_list.dart';
|
||||
import 'package:gecko/models/queries_indexer.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/cesium_plus.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:gecko/screens/wallet_view.dart';
|
||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:truncate/truncate.dart';
|
||||
|
||||
class DuniterIndexer with ChangeNotifier {
|
||||
Map<String, String?> walletNameIndexer = {};
|
||||
String? fetchMoreCursor;
|
||||
Map? pageInfo;
|
||||
int nPage = 1;
|
||||
int nRepositories = 20;
|
||||
List? transBC;
|
||||
List listIndexerEndpoints = [];
|
||||
bool isLoadingIndexer = false;
|
||||
Map<String, String> idtyStatusCache = {};
|
||||
|
||||
void reload() {
|
||||
notifyListeners();
|
||||
|
@ -83,6 +93,7 @@ class DuniterIndexer with ChangeNotifier {
|
|||
|
||||
if (configBox.containsKey('customIndexer')) {
|
||||
return configBox.get('customIndexer');
|
||||
// listIndexerEndpoints.insert(0, configBox.get('customIndexer'));
|
||||
}
|
||||
|
||||
if (configBox.containsKey('indexerEndpoint')) {
|
||||
|
@ -144,8 +155,210 @@ class DuniterIndexer with ChangeNotifier {
|
|||
return indexerEndpoint;
|
||||
}
|
||||
|
||||
Widget getNameByAddress(BuildContext context, String address,
|
||||
[WalletData? wallet,
|
||||
double size = 20,
|
||||
bool canEdit = false,
|
||||
Color color = Colors.black,
|
||||
FontWeight fontWeight = FontWeight.w400,
|
||||
FontStyle fontStyle = FontStyle.italic]) {
|
||||
WalletOptionsProvider walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
if (indexerEndpoint == '') {
|
||||
if (wallet == null) {
|
||||
return const SizedBox();
|
||||
} else {
|
||||
if (canEdit) {
|
||||
return walletOptions.walletName(context, wallet, size, color);
|
||||
} else {
|
||||
return walletOptions.walletNameController(context, wallet, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
final httpLink = HttpLink(
|
||||
'$indexerEndpoint/v1/graphql',
|
||||
);
|
||||
|
||||
final client = ValueNotifier(
|
||||
GraphQLClient(
|
||||
cache: GraphQLCache(store: HiveStore()),
|
||||
link: httpLink,
|
||||
),
|
||||
);
|
||||
return GraphQLProvider(
|
||||
client: client,
|
||||
child: Query(
|
||||
options: QueryOptions(
|
||||
document: gql(
|
||||
getNameByAddressQ), // this is the query string you just created
|
||||
variables: {
|
||||
'address': address,
|
||||
},
|
||||
// pollInterval: const Duration(seconds: 10),
|
||||
),
|
||||
builder: (QueryResult result,
|
||||
{VoidCallback? refetch, FetchMore? fetchMore}) {
|
||||
if (result.hasException) {
|
||||
return Text(result.exception.toString());
|
||||
}
|
||||
|
||||
if (result.isLoading) {
|
||||
return const Text('Loading');
|
||||
}
|
||||
|
||||
walletNameIndexer[address] =
|
||||
result.data?['account_by_pk']?['identity']?['name'];
|
||||
|
||||
g1WalletsBox.put(
|
||||
address,
|
||||
G1WalletsList(
|
||||
address: address, username: walletNameIndexer[address]));
|
||||
|
||||
// log.d(g1WalletsBox.toMap().values.first.username);
|
||||
|
||||
if (walletNameIndexer[address] == null) {
|
||||
if (wallet == null) {
|
||||
return const SizedBox();
|
||||
} else {
|
||||
if (canEdit) {
|
||||
return walletOptions.walletName(context, wallet, size, color);
|
||||
} else {
|
||||
return walletOptions.walletNameController(
|
||||
context, wallet, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Text(
|
||||
color == Colors.grey[700]!
|
||||
? '(${walletNameIndexer[address]!})'
|
||||
: truncate(walletNameIndexer[address]!, 20),
|
||||
style: TextStyle(
|
||||
fontSize: size,
|
||||
color: color,
|
||||
fontWeight: fontWeight,
|
||||
fontStyle: fontStyle,
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Widget searchIdentity(BuildContext context, String name) {
|
||||
// WalletOptionsProvider _walletOptions =
|
||||
// Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
CesiumPlusProvider cesiumPlusProvider =
|
||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||
WalletsProfilesProvider walletsProfiles =
|
||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
if (indexerEndpoint == '') {
|
||||
return const Text('Aucun résultat');
|
||||
}
|
||||
|
||||
log.d(indexerEndpoint);
|
||||
final httpLink = HttpLink(
|
||||
'$indexerEndpoint/v1/graphql',
|
||||
);
|
||||
|
||||
final client = ValueNotifier(
|
||||
GraphQLClient(
|
||||
cache: GraphQLCache(
|
||||
store: HiveStore()), // GraphQLCache(store: HiveStore())
|
||||
link: httpLink,
|
||||
),
|
||||
);
|
||||
return GraphQLProvider(
|
||||
client: client,
|
||||
child: Query(
|
||||
options: QueryOptions(
|
||||
document: gql(
|
||||
searchAddressByNameQ), // this is the query string you just created
|
||||
variables: {
|
||||
'name': name,
|
||||
},
|
||||
// pollInterval: const Duration(seconds: 10),
|
||||
),
|
||||
builder: (QueryResult result,
|
||||
{VoidCallback? refetch, FetchMore? fetchMore}) {
|
||||
if (result.hasException) {
|
||||
return Text(result.exception.toString());
|
||||
}
|
||||
|
||||
if (result.isLoading) {
|
||||
return Text('loading'.tr());
|
||||
}
|
||||
|
||||
final List identities = result.data?['search_identity'] ?? [];
|
||||
|
||||
if (identities.isEmpty) {
|
||||
return Text('noResult'.tr());
|
||||
}
|
||||
|
||||
double avatarSize = 55;
|
||||
return Expanded(
|
||||
child: ListView(children: <Widget>[
|
||||
for (Map profile in identities)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5),
|
||||
child: ListTile(
|
||||
key: keySearchResult(profile['pubkey']),
|
||||
horizontalTitleGap: 40,
|
||||
contentPadding: const EdgeInsets.all(5),
|
||||
leading: cesiumPlusProvider.defaultAvatar(avatarSize),
|
||||
title: Row(children: <Widget>[
|
||||
Text(getShortPubkey(profile['pubkey']),
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Monospace',
|
||||
fontWeight: FontWeight.w500),
|
||||
textAlign: TextAlign.center),
|
||||
]),
|
||||
trailing: SizedBox(
|
||||
width: 110,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
balance(context, profile['pubkey'], 16),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
subtitle: Row(children: <Widget>[
|
||||
Text(profile['name'] ?? '',
|
||||
style: const TextStyle(
|
||||
fontSize: 18, fontWeight: FontWeight.w500),
|
||||
textAlign: TextAlign.center),
|
||||
]),
|
||||
dense: false,
|
||||
isThreeLine: false,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
walletsProfiles.address = profile['pubkey'];
|
||||
return WalletViewScreen(
|
||||
address: profile['pubkey'],
|
||||
username: g1WalletsBox
|
||||
.get(profile['pubkey'])
|
||||
?.id
|
||||
?.username,
|
||||
avatar:
|
||||
g1WalletsBox.get(profile['pubkey'])?.avatar,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
List parseHistory(blockchainTX, pubkey) {
|
||||
List transBC = [];
|
||||
var transBC = [];
|
||||
int i = 0;
|
||||
|
||||
for (final trans in blockchainTX) {
|
||||
|
@ -156,8 +369,8 @@ class DuniterIndexer with ChangeNotifier {
|
|||
transBC.add(i);
|
||||
transBC[i] = [];
|
||||
transBC[i].add(DateTime.parse(transaction['created_at']));
|
||||
final amountBrut = transaction['amount'];
|
||||
final amount = removeDecimalZero(amountBrut / 100);
|
||||
final int amountBrut = transaction['amount'];
|
||||
final double amount = removeDecimalZero(amountBrut / 100);
|
||||
if (direction == "RECEIVED") {
|
||||
transBC[i].add(transaction['issuer_pubkey']);
|
||||
transBC[i].add(transaction['issuer']['identity']?['name'] ?? '');
|
||||
|
@ -167,21 +380,32 @@ class DuniterIndexer with ChangeNotifier {
|
|||
}
|
||||
transBC[i].add(amount);
|
||||
transBC[i].add(direction);
|
||||
// transBC[i].add(''); //transaction comment
|
||||
|
||||
i++;
|
||||
}
|
||||
return transBC;
|
||||
}
|
||||
|
||||
FetchMoreOptions? mergeQueryResult(result, opts, pubkey, nRepositories) {
|
||||
FetchMoreOptions? checkQueryResult(result, opts, pubkey) {
|
||||
final List<dynamic>? blockchainTX =
|
||||
(result.data['transaction_connection']['edges'] as List<dynamic>?);
|
||||
// final List<dynamic> mempoolTX =
|
||||
// (result.data['txsHistoryMp']['receiving'] as List<dynamic>);
|
||||
|
||||
pageInfo = result.data['transaction_connection']['pageInfo'];
|
||||
fetchMoreCursor = pageInfo!['endCursor'];
|
||||
final hasNextPage = pageInfo!['hasNextPage'];
|
||||
final hasPreviousPage = pageInfo!['hasPreviousPage'];
|
||||
log.d('endCursor: $fetchMoreCursor $hasNextPage $hasPreviousPage');
|
||||
if (fetchMoreCursor == null) nPage = 1;
|
||||
|
||||
log.d(fetchMoreCursor);
|
||||
|
||||
if (nPage == 1) {
|
||||
nRepositories = 40;
|
||||
} else if (nPage == 2) {
|
||||
nRepositories = 100;
|
||||
}
|
||||
// nRepositories = 10;
|
||||
nPage++;
|
||||
|
||||
if (fetchMoreCursor != null) {
|
||||
opts = FetchMoreOptions(
|
||||
|
@ -194,12 +418,18 @@ class DuniterIndexer with ChangeNotifier {
|
|||
as List<dynamic>
|
||||
];
|
||||
|
||||
log.d('repos: $previousResultData');
|
||||
log.d('repos: $fetchMoreResultData');
|
||||
log.d('repos: $repos');
|
||||
|
||||
fetchMoreResultData['transaction_connection']['edges'] = repos;
|
||||
return fetchMoreResultData;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
log.d(
|
||||
"###### DEBUG H Parse blockchainTX list. Cursor: $fetchMoreCursor ######");
|
||||
if (fetchMoreCursor != null) {
|
||||
transBC = parseHistory(blockchainTX, pubkey);
|
||||
} else {
|
||||
|
@ -213,120 +443,7 @@ class DuniterIndexer with ChangeNotifier {
|
|||
String result = n.toStringAsFixed(n.truncateToDouble() == n ? 0 : 2);
|
||||
return double.parse(result);
|
||||
}
|
||||
}
|
||||
|
||||
//// Manuals queries
|
||||
|
||||
Future<bool> isIdtyExist(String name) async {
|
||||
final variables = <String, dynamic>{
|
||||
'name': name,
|
||||
};
|
||||
final result = await _execQuery(isIdtyExistQ, variables);
|
||||
return result.data!['identity']?.isEmpty ?? false ? false : true;
|
||||
}
|
||||
|
||||
Future<DateTime> getBlockStart() async {
|
||||
final result = await _execQuery(getBlockchainStartQ, {});
|
||||
startBlockchainTime = DateTime.parse(result.data!['block'][0]['created_at']);
|
||||
return startBlockchainTime;
|
||||
}
|
||||
|
||||
Future<QueryResult> _execQuery(
|
||||
String query, Map<String, dynamic> variables) async {
|
||||
final httpLink = HttpLink(
|
||||
'$indexerEndpoint/v1/graphql',
|
||||
);
|
||||
|
||||
final GraphQLClient client = GraphQLClient(
|
||||
cache: GraphQLCache(),
|
||||
link: httpLink,
|
||||
);
|
||||
|
||||
final QueryOptions options =
|
||||
QueryOptions(document: gql(query), variables: variables);
|
||||
|
||||
return await client.query(options);
|
||||
}
|
||||
|
||||
Map computeHistoryView(repository, lastDateDelimiter, isDouble) {
|
||||
bool isTody = false;
|
||||
bool isYesterday = false;
|
||||
bool isThisWeek = false;
|
||||
bool isMigrationTime = false;
|
||||
String? dateDelimiter;
|
||||
DateTime now = DateTime.now();
|
||||
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||
|
||||
late double amount;
|
||||
late String finalAmount;
|
||||
DateTime date = repository[0];
|
||||
String dateForm;
|
||||
bool isDelimiter = true;
|
||||
|
||||
if ({4, 10, 11, 12}.contains(date.month)) {
|
||||
dateForm = "${date.day} ${monthsInYear[date.month]!.substring(0, 3)}";
|
||||
} else if ({1, 2, 7, 9}.contains(date.month)) {
|
||||
dateForm = "${date.day} ${monthsInYear[date.month]!.substring(0, 4)}";
|
||||
} else {
|
||||
dateForm = "${date.day} ${monthsInYear[date.month]}";
|
||||
}
|
||||
|
||||
final transactionDate = DateTime(date.year, date.month, date.day);
|
||||
final todayDate = DateTime(now.year, now.month, now.day);
|
||||
final yesterdayDate = DateTime(now.year, now.month, now.day - 1);
|
||||
|
||||
if (transactionDate == todayDate && !isTody) {
|
||||
dateDelimiter = lastDateDelimiter = "today".tr();
|
||||
isTody = true;
|
||||
} else if (transactionDate == yesterdayDate && !isYesterday) {
|
||||
dateDelimiter = lastDateDelimiter = "yesterday".tr();
|
||||
isYesterday = true;
|
||||
} else if (weekNumber(date) == weekNumber(now) &&
|
||||
date.year == now.year &&
|
||||
transactionDate != yesterdayDate &&
|
||||
transactionDate != todayDate &&
|
||||
!isThisWeek) {
|
||||
dateDelimiter = lastDateDelimiter = "thisWeek".tr();
|
||||
isThisWeek = true;
|
||||
} else if (lastDateDelimiter != "${monthsInYear[date.month]} ${date.year}" &&
|
||||
transactionDate != todayDate &&
|
||||
transactionDate != yesterdayDate &&
|
||||
!(weekNumber(date) == weekNumber(now) && date.year == now.year)) {
|
||||
if (date.year == now.year) {
|
||||
dateDelimiter = lastDateDelimiter = monthsInYear[date.month];
|
||||
} else {
|
||||
dateDelimiter =
|
||||
lastDateDelimiter = "${monthsInYear[date.month]} ${date.year}";
|
||||
}
|
||||
} else {
|
||||
isDelimiter = false;
|
||||
}
|
||||
|
||||
amount = repository[4] == 'RECEIVED' ? repository[3] : repository[3] * -1;
|
||||
|
||||
if (isUdUnit) {
|
||||
amount = round(amount / balanceRatio);
|
||||
finalAmount = 'ud'.tr(args: ['$amount ']);
|
||||
} else {
|
||||
finalAmount = '$amount $currencyName';
|
||||
}
|
||||
|
||||
if (date.compareTo(startBlockchainTime) < 0) {
|
||||
isMigrationTime = true;
|
||||
} else {
|
||||
isMigrationTime = false;
|
||||
}
|
||||
|
||||
return {
|
||||
'finalAmount': finalAmount,
|
||||
'isMigrationTime': isMigrationTime,
|
||||
'dateDelimiter': dateDelimiter ?? '',
|
||||
'isDelimiter': isDelimiter,
|
||||
'dateForm': dateForm,
|
||||
};
|
||||
}
|
||||
|
||||
int weekNumber(DateTime date) {
|
||||
int dayOfYear = int.parse(DateFormat("D").format(date));
|
||||
return ((dayOfYear - date.weekday + 10) / 7).floor();
|
||||
|
||||
// checkHistoryResult(
|
||||
// QueryResult<Object?> result, FetchMoreOptions options, String address) {}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'dart:math';
|
||||
import 'package:durt/durt.dart' as durt;
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
|
@ -89,7 +88,8 @@ class GenerateWalletsProvider with ChangeNotifier {
|
|||
|
||||
log.i("Is $expectedWord equal to input $normInputWord ?");
|
||||
if (expectedWord == normInputWord ||
|
||||
(kDebugMode && inputWord == 'triche')) {
|
||||
inputWord == 'triche' ||
|
||||
inputWord == '3.14') {
|
||||
log.d('Word is OK');
|
||||
isAskedWordValid = true;
|
||||
askedWordColor = Colors.green[600];
|
||||
|
@ -249,7 +249,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
|||
}
|
||||
|
||||
Future<List<String>> generateWordList(BuildContext context) async {
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
generatedMnemonic = await sub.generateMnemonic(lang: appLang);
|
||||
List<String> wordsList = [];
|
||||
|
@ -369,7 +369,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
|||
}
|
||||
|
||||
Future<bool> scanDerivations(BuildContext context) async {
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final currentChestNumber = configBox.get('currentChest');
|
||||
bool isAlive = false;
|
||||
scanedValidWalletNumber = 0;
|
||||
|
@ -414,14 +414,14 @@ class GenerateWalletsProvider with ChangeNotifier {
|
|||
password: pin.text);
|
||||
|
||||
WalletData myWallet = WalletData(
|
||||
version: dataVersion,
|
||||
chest: currentChestNumber,
|
||||
address: addressData.address!,
|
||||
number: scanedValidWalletNumber,
|
||||
name: walletName,
|
||||
derivation: derivationNbr,
|
||||
imageDefaultPath: '${scanedValidWalletNumber % 4}.png',
|
||||
isOwned: true);
|
||||
await walletBox.put(myWallet.address, myWallet);
|
||||
imageDefaultPath: '${scanedValidWalletNumber % 4}.png');
|
||||
await walletBox.add(myWallet);
|
||||
scanedValidWalletNumber = scanedValidWalletNumber + 1;
|
||||
}
|
||||
scanedWalletNumber = scanedWalletNumber + 1;
|
||||
|
@ -445,8 +445,6 @@ class GenerateWalletsProvider with ChangeNotifier {
|
|||
onTimeout: () => {},
|
||||
);
|
||||
|
||||
log.d(balance);
|
||||
|
||||
log.d(
|
||||
"${addressData.address!}: ${balance['transferableBalance']} $currencyName");
|
||||
if (balance['transferableBalance'] != 0) {
|
||||
|
@ -454,14 +452,14 @@ class GenerateWalletsProvider with ChangeNotifier {
|
|||
await sub.importAccount(mnemonic: generatedMnemonic!, password: pin.text);
|
||||
|
||||
WalletData myWallet = WalletData(
|
||||
version: dataVersion,
|
||||
chest: currentChestNumber,
|
||||
address: addressData.address!,
|
||||
number: 0,
|
||||
name: walletName,
|
||||
derivation: -1,
|
||||
imageDefaultPath: '0.png',
|
||||
isOwned: true);
|
||||
await walletBox.put(myWallet.address, myWallet);
|
||||
imageDefaultPath: '0.png');
|
||||
await walletBox.add(myWallet);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -8,11 +8,17 @@ import 'dart:math';
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'dart:async';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||
import 'package:gecko/screens/myWallets/wallets_home.dart';
|
||||
import 'package:gecko/screens/search.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode, kIsWeb;
|
||||
import 'package:path_provider/path_provider.dart' as pp;
|
||||
|
@ -27,7 +33,6 @@ class HomeProvider with ChangeNotifier {
|
|||
Widget appBarTitle = Text('Ğecko', style: TextStyle(color: Colors.grey[850]));
|
||||
String homeMessage = "loading".tr();
|
||||
String defaultMessage = "noLizard".tr();
|
||||
bool isWalletBoxInit = false;
|
||||
|
||||
Future<void> initHive() async {
|
||||
late Directory hivePath;
|
||||
|
@ -62,11 +67,9 @@ class HomeProvider with ChangeNotifier {
|
|||
|
||||
Future changeCurrencyUnit(BuildContext context) async {
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||
await configBox.put('isUdUnit', !isUdUnit);
|
||||
walletOptions.balanceCache = {};
|
||||
balanceCache = {};
|
||||
sub.getBalanceRatio();
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -119,11 +122,114 @@ class HomeProvider with ChangeNotifier {
|
|||
return list[i];
|
||||
}
|
||||
|
||||
void handleSearchStart() {
|
||||
isSearching = true;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
// void playSound(String customSound, double volume) async {
|
||||
// await player.play('$customSound.wav',
|
||||
// volume: volume, mode: PlayerMode.LOW_LATENCY, stayAwake: false);
|
||||
// }
|
||||
|
||||
Widget bottomAppBar(BuildContext context) {
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
WalletsProfilesProvider historyProvider =
|
||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
|
||||
final size = MediaQuery.of(context).size;
|
||||
|
||||
const bool showBottomBar = true;
|
||||
|
||||
return Visibility(
|
||||
visible: showBottomBar,
|
||||
child: Container(
|
||||
color: yellowC,
|
||||
width: size.width,
|
||||
height: 80,
|
||||
child:
|
||||
// Stack(
|
||||
// children: [
|
||||
// // CustomPaint(
|
||||
// // size: Size(size.width, 110),
|
||||
// // painter: CustomRoundedButton(),
|
||||
// // ),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.start, children: [
|
||||
// SizedBox(width: 0),
|
||||
const Spacer(),
|
||||
const SizedBox(width: 11),
|
||||
IconButton(
|
||||
key: keyAppBarSearch,
|
||||
iconSize: 40,
|
||||
icon: const Image(image: AssetImage('assets/loupe-noire.png')),
|
||||
onPressed: () {
|
||||
Navigator.popUntil(
|
||||
context,
|
||||
ModalRoute.withName('/'),
|
||||
);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (homeContext) {
|
||||
return const SearchScreen();
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 22),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
key: keyAppBarQrcode,
|
||||
iconSize: 70,
|
||||
icon: const Image(image: AssetImage('assets/qrcode-scan.png')),
|
||||
onPressed: () async {
|
||||
Navigator.popUntil(
|
||||
context,
|
||||
ModalRoute.withName('/'),
|
||||
);
|
||||
historyProvider.scan(homeContext);
|
||||
},
|
||||
),
|
||||
const Spacer(),
|
||||
const SizedBox(width: 15),
|
||||
IconButton(
|
||||
key: keyAppBarChest,
|
||||
iconSize: 60,
|
||||
icon: const Image(image: AssetImage('assets/wallet.png')),
|
||||
onPressed: () async {
|
||||
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
String? pin;
|
||||
if (myWalletProvider.pinCode == '') {
|
||||
pin = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (homeContext) {
|
||||
return UnlockingWallet(wallet: defaultWallet);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (pin != null || myWalletProvider.pinCode != '') {
|
||||
Navigator.popUntil(
|
||||
context,
|
||||
ModalRoute.withName('/'),
|
||||
);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const WalletsHome();
|
||||
}),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
const Spacer(),
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void reload() {
|
||||
notifyListeners();
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import 'dart:async';
|
|||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/widgets/commons/common_elements.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class MyWalletsProvider with ChangeNotifier {
|
||||
|
@ -15,8 +15,6 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
bool isNewDerivationLoading = false;
|
||||
String lastFlyBy = '';
|
||||
String dragAddress = '';
|
||||
bool isPinValid = false;
|
||||
bool isPinLoading = true;
|
||||
|
||||
int getCurrentChest() {
|
||||
if (configBox.get('currentChest') == null) {
|
||||
|
@ -28,7 +26,7 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
|
||||
bool checkIfWalletExist() {
|
||||
if (chestBox.isEmpty) {
|
||||
// log.i('No wallets detected');
|
||||
log.i('No wallets detected');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
@ -48,7 +46,7 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
}
|
||||
|
||||
WalletData? getWalletDataById(List<int?> id) {
|
||||
if (id.isEmpty) return WalletData(address: '', isOwned: true);
|
||||
if (id.isEmpty) return WalletData();
|
||||
int? chest = id[0];
|
||||
int? nbr = id[1];
|
||||
WalletData? targetedWallet;
|
||||
|
@ -78,18 +76,18 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
|
||||
WalletData getDefaultWallet([int? chest]) {
|
||||
if (chestBox.isEmpty) {
|
||||
return WalletData(address: '', chest: 0, number: 0, isOwned: true);
|
||||
return WalletData(chest: 0, number: 0);
|
||||
} else {
|
||||
chest ??= getCurrentChest();
|
||||
int? defaultWalletNumber = chestBox.get(chest)!.defaultWallet;
|
||||
return getWalletDataById([chest, defaultWalletNumber]) ??
|
||||
WalletData(address: '', chest: chest, number: 0, isOwned: true);
|
||||
WalletData(chest: chest, number: 0);
|
||||
}
|
||||
}
|
||||
|
||||
Future<int> deleteAllWallet(context) async {
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final myWalletProvider =
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
try {
|
||||
log.w('DELETE ALL WALLETS ?');
|
||||
|
@ -126,30 +124,30 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
|
||||
int? chest = getCurrentChest();
|
||||
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
WalletData defaultWallet = getDefaultWallet();
|
||||
|
||||
final address = await sub.derive(
|
||||
context, defaultWallet.address, newDerivationNbr, pinCode);
|
||||
context, defaultWallet.address!, newDerivationNbr, pinCode);
|
||||
|
||||
WalletData newWallet = WalletData(
|
||||
version: dataVersion,
|
||||
chest: chest,
|
||||
address: address,
|
||||
number: newWalletNbr,
|
||||
name: name,
|
||||
derivation: newDerivationNbr,
|
||||
imageDefaultPath: '${newWalletNbr % 4}.png',
|
||||
isOwned: true);
|
||||
imageDefaultPath: '${newWalletNbr % 4}.png');
|
||||
|
||||
await walletBox.put(newWallet.address, newWallet);
|
||||
await walletBox.add(newWallet);
|
||||
|
||||
isNewDerivationLoading = false;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> generateRootWallet(context, String name) async {
|
||||
final myWalletProvider =
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
|
||||
isNewDerivationLoading = true;
|
||||
|
@ -158,32 +156,29 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
int? chest = getCurrentChest();
|
||||
|
||||
List<WalletData> walletConfig = readAllWallets(chest);
|
||||
walletConfig.sort((p1, p2) {
|
||||
return Comparable.compare(p1.number!, p2.number!);
|
||||
});
|
||||
|
||||
if (walletConfig.isEmpty) {
|
||||
newWalletNbr = 0;
|
||||
} else {
|
||||
newWalletNbr = walletConfig.last.number! + 1;
|
||||
}
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
WalletData defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
|
||||
final address =
|
||||
await sub.generateRootKeypair(defaultWallet.address, pinCode);
|
||||
await sub.generateRootKeypair(defaultWallet.address!, pinCode);
|
||||
|
||||
WalletData newWallet = WalletData(
|
||||
version: dataVersion,
|
||||
chest: chest,
|
||||
address: address,
|
||||
number: newWalletNbr,
|
||||
name: name,
|
||||
derivation: -1,
|
||||
imageDefaultPath: '${newWalletNbr % 4}.png',
|
||||
isOwned: true);
|
||||
imageDefaultPath: '${newWalletNbr % 4}.png');
|
||||
|
||||
await walletBox.put(newWallet.address, newWallet);
|
||||
await walletBox.add(newWallet);
|
||||
|
||||
isNewDerivationLoading = false;
|
||||
notifyListeners();
|
||||
|
@ -197,9 +192,6 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
chestNumber ??= getCurrentChest();
|
||||
|
||||
List<WalletData> walletConfig = readAllWallets(chestNumber);
|
||||
walletConfig.sort((p1, p2) {
|
||||
return Comparable.compare(p1.number!, p2.number!);
|
||||
});
|
||||
|
||||
if (walletConfig.isEmpty) {
|
||||
newDerivationNbr = 2;
|
||||
|
|
|
@ -7,7 +7,6 @@ class SearchProvider with ChangeNotifier {
|
|||
List searchResult = [];
|
||||
final cacheDuring = 20 * 60 * 1000; //First number is minutes
|
||||
int cacheTime = 0;
|
||||
int resultLenght = 0;
|
||||
|
||||
void reload() {
|
||||
notifyListeners();
|
||||
|
@ -69,7 +68,8 @@ class SearchProvider with ChangeNotifier {
|
|||
// }
|
||||
|
||||
Future<List<G1WalletsList>> searchAddress() async {
|
||||
final walletProfiles = WalletsProfilesProvider('pubkey');
|
||||
final WalletsProfilesProvider walletProfiles =
|
||||
WalletsProfilesProvider('pubkey');
|
||||
|
||||
if (walletProfiles.isAddress(searchController.text)) {
|
||||
G1WalletsList wallet = G1WalletsList(address: searchController.text);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:fast_base58/fast_base58.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
|
@ -11,7 +10,6 @@ import 'package:gecko/providers/home.dart';
|
|||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:pinenacl/ed25519.dart';
|
||||
import 'package:polkawallet_sdk/api/apiKeyring.dart';
|
||||
import 'package:polkawallet_sdk/api/types/networkParams.dart';
|
||||
import 'package:polkawallet_sdk/api/types/txInfoData.dart';
|
||||
|
@ -41,11 +39,9 @@ class SubstrateSdk with ChangeNotifier {
|
|||
TextEditingController csSalt = TextEditingController();
|
||||
TextEditingController csPassword = TextEditingController();
|
||||
String g1V1NewAddress = '';
|
||||
String g1V1OldPubkey = '';
|
||||
bool isCesiumIDVisible = false;
|
||||
bool isCesiumAddresLoading = false;
|
||||
late int udValue;
|
||||
Map<String, List<int>> certsCounterCache = {};
|
||||
|
||||
/////////////////////////////////////
|
||||
////////// 1: API METHODS ///////////
|
||||
|
@ -126,20 +122,12 @@ class SubstrateSdk with ChangeNotifier {
|
|||
return await _getStorage('identity.identityIndexOf("$address")') ?? 0;
|
||||
}
|
||||
|
||||
Future<List<int>> getCertsCounter(String address) async {
|
||||
Future<List<int>> getCerts(String address) async {
|
||||
final idtyIndex = await _getIdentityIndexOf(address);
|
||||
final certsReceiver =
|
||||
await _getStorage('cert.storageIdtyCertMeta($idtyIndex)') ?? [];
|
||||
|
||||
if (certsCounterCache[address] == null) {
|
||||
certsCounterCache.putIfAbsent(address, () => []);
|
||||
}
|
||||
certsCounterCache.update(
|
||||
address,
|
||||
(value) =>
|
||||
[certsReceiver['receivedCount'], certsReceiver['issuedCount']]);
|
||||
|
||||
return certsCounterCache[address]!;
|
||||
return [certsReceiver['receivedCount'], certsReceiver['issuedCount']];
|
||||
}
|
||||
|
||||
Future<int> getCertValidityPeriod(String from, String to) async {
|
||||
|
@ -180,6 +168,8 @@ class SubstrateSdk with ChangeNotifier {
|
|||
}
|
||||
|
||||
Future<Map<String, double>> getBalance(String address) async {
|
||||
// log.d('currencyParameters: $currencyParameters');
|
||||
|
||||
if (!nodeConnected) {
|
||||
return {
|
||||
'transferableBalance': 0,
|
||||
|
@ -196,11 +186,13 @@ class SubstrateSdk with ChangeNotifier {
|
|||
final Map? idtyData = idtyIndex == null
|
||||
? null
|
||||
: await _getStorage('identity.identities($idtyIndex)');
|
||||
final int currentUdIndex =
|
||||
int.parse(await _getStorage('universalDividend.currentUdIndex()'));
|
||||
final List pastReevals =
|
||||
await _getStorage('universalDividend.pastReevals()');
|
||||
|
||||
// Compute amount of claimable UDs
|
||||
final int unclaimedUds = _computeUnclaimUds(
|
||||
final int unclaimedUds = _computeUnclaimUds(currentUdIndex,
|
||||
idtyData?['data']?['firstEligibleUd'] ?? 0, pastReevals);
|
||||
|
||||
// Calculate transferable and potential balance
|
||||
|
@ -218,13 +210,12 @@ class SubstrateSdk with ChangeNotifier {
|
|||
};
|
||||
|
||||
// log.i(finalBalances);
|
||||
log.d(
|
||||
'${getShortPubkey(address)} --- BALANCE: ${finalBalances['transferableBalance']}');
|
||||
|
||||
return finalBalances;
|
||||
}
|
||||
|
||||
int _computeUnclaimUds(int firstEligibleUd, List pastReevals) {
|
||||
int _computeUnclaimUds(
|
||||
int currentUdIndex, int firstEligibleUd, List pastReevals) {
|
||||
int totalAmount = 0;
|
||||
|
||||
if (firstEligibleUd == 0) return 0;
|
||||
|
@ -248,13 +239,8 @@ class SubstrateSdk with ChangeNotifier {
|
|||
return totalAmount;
|
||||
}
|
||||
|
||||
Future<bool> isMember(String address) async {
|
||||
final isMember = await idtyStatus(address) == 'Validated';
|
||||
final walletData = walletBox.get(address) ?? WalletData(address: address);
|
||||
walletData.isMember = isMember;
|
||||
walletBox.put(address, walletData);
|
||||
// notifyListeners();
|
||||
return isMember;
|
||||
Future<bool> isMemberGet(String address) async {
|
||||
return await idtyStatus(address) == 'Validated';
|
||||
}
|
||||
|
||||
Future<bool> isSmithGet(String address) async {
|
||||
|
@ -274,7 +260,7 @@ class SubstrateSdk with ChangeNotifier {
|
|||
Map<String, int> result = {};
|
||||
final toStatus = await idtyStatus(to);
|
||||
|
||||
if (from != to && await isMember(from)) {
|
||||
if (from != to && await isMemberGet(from)) {
|
||||
final removableOn = await getCertValidityPeriod(from, to);
|
||||
final certMeta = await getCertMeta(from);
|
||||
final int nextIssuableOn = certMeta['nextIssuableOn'] ?? 0;
|
||||
|
@ -289,9 +275,6 @@ class SubstrateSdk with ChangeNotifier {
|
|||
result.putIfAbsent('certDelay', () => certDelayDuration);
|
||||
} else if (toStatus == 'Created') {
|
||||
result.putIfAbsent('toStatus', () => 1);
|
||||
} else if (toStatus == 'noid') {
|
||||
result.putIfAbsent('toStatus', () => 2);
|
||||
result.putIfAbsent('canCert', () => 0);
|
||||
} else {
|
||||
result.putIfAbsent('canCert', () => 0);
|
||||
}
|
||||
|
@ -312,7 +295,7 @@ class SubstrateSdk with ChangeNotifier {
|
|||
}
|
||||
|
||||
Future<String> idtyStatus(String address) async {
|
||||
// final walletOptions =
|
||||
// WalletOptionsProvider walletOptions =
|
||||
// Provider.of<WalletOptionsProvider>(homeContext, listen: false);
|
||||
|
||||
var idtyIndex = await _getIdentityIndexOf(address);
|
||||
|
@ -336,15 +319,6 @@ class SubstrateSdk with ChangeNotifier {
|
|||
}
|
||||
}
|
||||
|
||||
Future<bool> isSmith(String address) async {
|
||||
var idtyIndex = await _getIdentityIndexOf(address);
|
||||
if (idtyIndex == 0) return false;
|
||||
|
||||
final isSmith =
|
||||
await _getStorage('smithsMembership.membership($idtyIndex)');
|
||||
return isSmith == null ? false : true;
|
||||
}
|
||||
|
||||
Future<String> getGenesisHash() async {
|
||||
final String genesisHash = await sdk.webView!.evalJavascript(
|
||||
'api.genesisHash.toHex()',
|
||||
|
@ -406,77 +380,6 @@ class SubstrateSdk with ChangeNotifier {
|
|||
return estimateFees.partialFee / 100;
|
||||
}
|
||||
|
||||
int hexStringToUint16(String input) {
|
||||
// Slice the string in 2-char substrings and parse it from hex to decimal
|
||||
final bytes = sliceString(input, 2).map((s) => int.parse(s, radix: 16));
|
||||
|
||||
// Create a Uint8 from the 2-bytes list
|
||||
final u8list = Uint8List.fromList(bytes.toList());
|
||||
|
||||
// Return a Uint16 little endian representation
|
||||
return ByteData.view(u8list.buffer).getUint16(0, Endian.little);
|
||||
}
|
||||
|
||||
List<String> sliceString(String input, int count) {
|
||||
if (input.isEmpty) return [];
|
||||
|
||||
if (input.length % count != 0) {
|
||||
throw ArgumentError("Cannot slice $input in $count slices.");
|
||||
}
|
||||
// final slices = List<String>(count);
|
||||
var slices = List<String>.filled(count, '');
|
||||
|
||||
int len = input.length;
|
||||
int sliceSize = len ~/ count;
|
||||
|
||||
for (var i = 0; i < count; i++) {
|
||||
var start = i * sliceSize;
|
||||
slices[i] = input.substring(start, start + sliceSize);
|
||||
}
|
||||
|
||||
return List.unmodifiable(slices);
|
||||
}
|
||||
|
||||
Future<DateFormat> getBlockchainStart() async {
|
||||
////// Manu indexer
|
||||
//// Extract block date. Ugly, I can't find a better way to get the date of the block ?
|
||||
//// The only polkadot issue for that : https://github.com/polkadot-js/api/issues/2603
|
||||
// const created_at = new Date(
|
||||
// signedBlock.block.extrinsics
|
||||
// .filter(
|
||||
// ({ method: { section, method } }) =>
|
||||
// section === 'timestamp' && method === 'set'
|
||||
// )[0]
|
||||
// .args[0].toNumber()
|
||||
// )
|
||||
//// manu rpc
|
||||
// genesis: api.genesisHash.toHex(),
|
||||
// chain: await api.rpc.chain.getHeader(),
|
||||
// chainInfo: await api.registry.getChainProperties(),
|
||||
// test: await api.rpc.state.getPairs('0x')
|
||||
// query block finalisé qui ne change jamais.
|
||||
// api.rpc.chain.subscribeFinalizedHeads
|
||||
// events: await api.rpc.state.getStorage('0x26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7'),
|
||||
// lastFinalizedBlock: await api.rpc.chain.getFinalizedHead()
|
||||
// get block
|
||||
// api.rpc.chain.getFinalizedHead
|
||||
|
||||
// shit
|
||||
// final blockHash =
|
||||
// await sdk.webView!.evalJavascript('api.rpc.chain.getBlockHash(1)');
|
||||
// final Map blockContent = await sdk.webView!
|
||||
// .evalJavascript('api.rpc.chain.getBlock("$blockHash")');
|
||||
// final String dateBrut = blockContent['block']['extrinsics'][0];
|
||||
|
||||
// final dateTextByte = hex.decode(dateBrut.substring(2));
|
||||
|
||||
// final dateText = await sdk.webView!
|
||||
// .evalJavascript('api.tx($dateTextByte)', wrapPromise: false);
|
||||
|
||||
// log.d('aaaaaaaaaaaaaaaaaaaaa: $dateText');
|
||||
return DateFormat();
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
////// 3: SUBSTRATE CONNECTION //////
|
||||
/////////////////////////////////////
|
||||
|
@ -497,8 +400,9 @@ class SubstrateSdk with ChangeNotifier {
|
|||
}
|
||||
|
||||
Future<void> connectNode(BuildContext ctx) async {
|
||||
final homeProvider = Provider.of<HomeProvider>(ctx, listen: false);
|
||||
final myWalletProvider = Provider.of<MyWalletsProvider>(ctx, listen: false);
|
||||
HomeProvider homeProvider = Provider.of<HomeProvider>(ctx, listen: false);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(ctx, listen: false);
|
||||
|
||||
homeProvider.changeMessage("connectionPending".tr(), 0);
|
||||
|
||||
|
@ -538,8 +442,8 @@ class SubstrateSdk with ChangeNotifier {
|
|||
}
|
||||
notifyListeners();
|
||||
});
|
||||
currentUdIndex =
|
||||
int.parse(await _getStorage('universalDividend.currentUdIndex()'));
|
||||
|
||||
await initCurrencyParameters();
|
||||
await getBalanceRatio();
|
||||
|
||||
notifyListeners();
|
||||
|
@ -664,7 +568,7 @@ class SubstrateSdk with ChangeNotifier {
|
|||
Future<KeyPairData?> changePassword(BuildContext context, String address,
|
||||
String passOld, String passNew) async {
|
||||
final account = getKeypair(address);
|
||||
final myWalletProvider =
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
keyring.setCurrent(account);
|
||||
myWalletProvider.resetPinCode();
|
||||
|
@ -700,7 +604,7 @@ class SubstrateSdk with ChangeNotifier {
|
|||
await chestBox.put(currentChestNumber, newChestData);
|
||||
|
||||
try {
|
||||
final acc = getKeypair(wallet.address);
|
||||
final acc = getKeypair(wallet.address!);
|
||||
keyring.setCurrent(acc);
|
||||
return acc.address!;
|
||||
} catch (e) {
|
||||
|
@ -776,9 +680,6 @@ class SubstrateSdk with ChangeNotifier {
|
|||
cryptoType: CryptoType.ed25519,
|
||||
rawSeed: rawSeedHex);
|
||||
|
||||
SigningKey rootKey = SigningKey(seed: rawSeed);
|
||||
g1V1OldPubkey = Base58Encode(rootKey.publicKey);
|
||||
|
||||
g1V1NewAddress = newAddress.address!;
|
||||
notifyListeners();
|
||||
return g1V1NewAddress;
|
||||
|
@ -794,15 +695,8 @@ class SubstrateSdk with ChangeNotifier {
|
|||
final fromHasConsumer =
|
||||
fromAddress == '' ? false : await hasAccountConsumers(fromAddress);
|
||||
final toIdtyStatus = await idtyStatus(toAddress);
|
||||
final isSmithData = await isSmith(fromAddress);
|
||||
|
||||
return [
|
||||
fromBalance,
|
||||
fromIdtyStatus,
|
||||
toIdtyStatus,
|
||||
fromHasConsumer,
|
||||
isSmithData
|
||||
];
|
||||
return [fromBalance, fromIdtyStatus, toIdtyStatus, fromHasConsumer];
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
@ -885,7 +779,7 @@ class SubstrateSdk with ChangeNotifier {
|
|||
List txOptions = [];
|
||||
String? rawParams;
|
||||
|
||||
final toCerts = await getCertsCounter(destAddress);
|
||||
final toCerts = await getCerts(destAddress);
|
||||
|
||||
// log.d('debug: ${currencyParameters['minCertForMembership']}');
|
||||
|
||||
|
@ -1113,7 +1007,7 @@ void snackNode(BuildContext context, bool isConnected) {
|
|||
if (!isConnected) {
|
||||
message = "noDuniterNodeAvailableTryLater".tr();
|
||||
} else {
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
message =
|
||||
"${"youAreConnectedToNode".tr()}\n${sub.getConnectedEndpoint()!.split('//')[1]}";
|
||||
|
|
|
@ -11,12 +11,14 @@ import 'package:gecko/providers/duniter_indexer.dart';
|
|||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/widgets/commons/common_elements.dart';
|
||||
import 'package:gecko/screens/animated_text.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||
import 'package:gecko/screens/transaction_in_progress.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:image_cropper/image_cropper.dart';
|
||||
import 'package:truncate/truncate.dart';
|
||||
|
||||
class WalletOptionsProvider with ChangeNotifier {
|
||||
TextEditingController address = TextEditingController();
|
||||
|
@ -26,11 +28,12 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
TextEditingController newPin = TextEditingController();
|
||||
bool isEditing = false;
|
||||
bool isBalanceBlur = false;
|
||||
FocusNode walletNameFocus = FocusNode();
|
||||
TextEditingController nameController = TextEditingController();
|
||||
late bool isDefaultWallet;
|
||||
bool canValidateNameBool = false;
|
||||
Map<String, String> idtyStatusCache = {};
|
||||
Future<NewWallet>? get badWallet => null;
|
||||
Map<String, double> balanceCache = {};
|
||||
|
||||
int getPinLenght(walletNbr) {
|
||||
return pinLength;
|
||||
|
@ -48,27 +51,27 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
}
|
||||
|
||||
Future<int> deleteWallet(context, WalletData wallet) async {
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final bool? answer = await (confirmPopup(
|
||||
context, 'areYouSureToForgetWallet'.tr(args: [wallet.name!])));
|
||||
|
||||
if (answer ?? false) {
|
||||
//Check if balance is null
|
||||
final balance = await sub.getBalance(wallet.address);
|
||||
final balance = await sub.getBalance(wallet.address!);
|
||||
if (balance != {}) {
|
||||
final myWalletProvider =
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
final defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
log.d(defaultWallet.address);
|
||||
sub.pay(
|
||||
fromAddress: wallet.address,
|
||||
destAddress: defaultWallet.address,
|
||||
fromAddress: wallet.address!,
|
||||
destAddress: defaultWallet.address!,
|
||||
amount: -1,
|
||||
password: myWalletProvider.pinCode);
|
||||
}
|
||||
|
||||
await walletBox.delete(wallet.key);
|
||||
await sub.deleteAccounts([wallet.address]);
|
||||
await sub.deleteAccounts([wallet.address!]);
|
||||
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
@ -129,17 +132,98 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
}
|
||||
}
|
||||
|
||||
Widget idtyStatus(BuildContext context, String address,
|
||||
{bool isOwner = false, Color color = Colors.black}) {
|
||||
DuniterIndexer duniterIndexer =
|
||||
Provider.of<DuniterIndexer>(context, listen: false);
|
||||
|
||||
showText(String text,
|
||||
[double size = 18, bool bold = false, bool smooth = true]) {
|
||||
log.d('$address $text');
|
||||
return AnimatedFadeOutIn<String>(
|
||||
data: text,
|
||||
duration: Duration(milliseconds: smooth ? 200 : 0),
|
||||
builder: (value) => Text(
|
||||
value,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: size,
|
||||
color: bold ? color : Colors.black,
|
||||
fontWeight: bold ? FontWeight.w500 : FontWeight.w400),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
return FutureBuilder(
|
||||
future: sub.idtyStatus(address),
|
||||
initialData: '',
|
||||
builder: (context, snapshot) {
|
||||
idtyStatusCache[address] = snapshot.data.toString();
|
||||
switch (snapshot.data.toString()) {
|
||||
case 'noid':
|
||||
{
|
||||
return showText('noIdentity'.tr());
|
||||
}
|
||||
case 'Created':
|
||||
{
|
||||
return showText('identityCreated'.tr());
|
||||
}
|
||||
case 'ConfirmedByOwner':
|
||||
{
|
||||
return isOwner
|
||||
? showText('identityConfirmed'.tr())
|
||||
: duniterIndexer.getNameByAddress(
|
||||
context,
|
||||
address,
|
||||
null,
|
||||
20,
|
||||
true,
|
||||
Colors.grey[700]!,
|
||||
FontWeight.w500,
|
||||
FontStyle.italic);
|
||||
}
|
||||
|
||||
case 'Validated':
|
||||
{
|
||||
return isOwner
|
||||
? showText('memberValidated'.tr(), 18, true)
|
||||
: duniterIndexer.getNameByAddress(
|
||||
context,
|
||||
address,
|
||||
null,
|
||||
20,
|
||||
true,
|
||||
Colors.black,
|
||||
FontWeight.w600,
|
||||
FontStyle.normal);
|
||||
}
|
||||
|
||||
case 'expired':
|
||||
{
|
||||
return showText('identityExpired'.tr());
|
||||
}
|
||||
}
|
||||
return SizedBox(
|
||||
child: showText('', 18, false, false),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Future<bool> isMember(BuildContext context, String address) async {
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
return await sub.idtyStatus(address) == 'Validated';
|
||||
}
|
||||
|
||||
Future<String?> confirmIdentityPopup(BuildContext context) async {
|
||||
TextEditingController idtyName = TextEditingController();
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final walletOptions =
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
WalletOptionsProvider walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
final myWalletProvider =
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
|
||||
bool canValidate = false;
|
||||
bool idtyExist = false;
|
||||
|
||||
return showDialog<String>(
|
||||
context: context,
|
||||
barrierDismissible: true, // user must tap button!
|
||||
|
@ -156,16 +240,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
const SizedBox(height: 20),
|
||||
TextField(
|
||||
key: keyEnterIdentityUsername,
|
||||
onChanged: (_) async {
|
||||
idtyExist = await isIdtyExist(idtyName.text);
|
||||
canValidate = !idtyExist &&
|
||||
!await isIdtyExist(idtyName.text) &&
|
||||
idtyName.text.length >= 2 &&
|
||||
idtyName.text.length <= 32;
|
||||
log.d('aaaaaaaaaa: $canValidate');
|
||||
|
||||
notifyListeners();
|
||||
},
|
||||
onChanged: (_) => notifyListeners(),
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
// FilteringTextInputFormatter.allow(RegExp("[0-9a-zA-Z]")),
|
||||
FilteringTextInputFormatter.deny(RegExp(r'^ ')),
|
||||
|
@ -175,12 +250,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
autofocus: true,
|
||||
controller: idtyName,
|
||||
style: const TextStyle(fontSize: 19),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Consumer<WalletOptionsProvider>(builder: (context, wOptions, _) {
|
||||
return Text(idtyExist ? 'Cette identité existe déjà' : '',
|
||||
style: TextStyle(color: Colors.red[500]));
|
||||
})
|
||||
)
|
||||
]),
|
||||
),
|
||||
actions: <Widget>[
|
||||
|
@ -191,65 +261,61 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
builder: (context, wOptions, _) {
|
||||
return TextButton(
|
||||
key: keyConfirm,
|
||||
onPressed: canValidate
|
||||
? () async {
|
||||
idtyName.text =
|
||||
idtyName.text.trim().replaceAll(' ', '');
|
||||
|
||||
if (idtyName.text.length.clamp(3, 32) ==
|
||||
idtyName.text.length) {
|
||||
WalletData? defaultWallet =
|
||||
myWalletProvider.getDefaultWallet();
|
||||
|
||||
String? pin;
|
||||
if (myWalletProvider.pinCode == '') {
|
||||
pin = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (homeContext) {
|
||||
return UnlockingWallet(
|
||||
wallet: defaultWallet);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
if (pin != null ||
|
||||
myWalletProvider.pinCode != '') {
|
||||
final wallet = myWalletProvider
|
||||
.getWalletDataByAddress(address.text);
|
||||
await sub.setCurrentWallet(wallet!);
|
||||
sub.confirmIdentity(walletOptions.address.text,
|
||||
idtyName.text, myWalletProvider.pinCode);
|
||||
Navigator.pop(context);
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return TransactionInProgress(
|
||||
transType: 'comfirmIdty',
|
||||
fromAddress:
|
||||
getShortPubkey(wallet.address),
|
||||
toAddress: getShortPubkey(wallet.address),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
: null,
|
||||
child: Text(
|
||||
"validate".tr(),
|
||||
style: TextStyle(
|
||||
fontSize: 21,
|
||||
color: canValidate
|
||||
? const Color(0xffD80000)
|
||||
: Colors.grey[500]),
|
||||
fontSize: 21,
|
||||
color: idtyName.text.length.clamp(3, 64) ==
|
||||
idtyName.text.length
|
||||
? const Color(0xffD80000)
|
||||
: Colors.grey,
|
||||
),
|
||||
),
|
||||
onPressed: () async {
|
||||
idtyName.text = idtyName.text.trim().replaceAll(' ', '');
|
||||
|
||||
if (idtyName.text.length.clamp(3, 64) ==
|
||||
idtyName.text.length) {
|
||||
WalletData? defaultWallet =
|
||||
myWalletProvider.getDefaultWallet();
|
||||
|
||||
String? pin;
|
||||
if (myWalletProvider.pinCode == '') {
|
||||
pin = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (homeContext) {
|
||||
return UnlockingWallet(wallet: defaultWallet);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
if (pin != null || myWalletProvider.pinCode != '') {
|
||||
final wallet = myWalletProvider
|
||||
.getWalletDataByAddress(address.text);
|
||||
await sub.setCurrentWallet(wallet!);
|
||||
sub.confirmIdentity(walletOptions.address.text,
|
||||
idtyName.text, myWalletProvider.pinCode);
|
||||
Navigator.pop(context);
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return TransactionInProgress(
|
||||
transType: 'comfirmIdty',
|
||||
fromAddress: getShortPubkey(wallet.address!),
|
||||
toAddress: getShortPubkey(wallet.address!),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
})
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 5)
|
||||
const SizedBox(height: 20)
|
||||
],
|
||||
);
|
||||
},
|
||||
|
@ -305,7 +371,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
if (canValidateNameBool) {
|
||||
nameController.text = walletName.text;
|
||||
_renameWallet(wID, walletName.text, isCesium: false);
|
||||
notifyListeners();
|
||||
// notifyListeners();
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
|
@ -339,7 +405,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
}
|
||||
|
||||
bool canValidateName(BuildContext context, TextEditingController walletName) {
|
||||
final myWalletProvider =
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
|
||||
bool isNameValid = walletName.text.length >= 2 &&
|
||||
|
@ -375,7 +441,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
String? addressGet;
|
||||
walletBox.toMap().forEach((key, value) {
|
||||
if (value.chest == chest && value.derivation == derivation) {
|
||||
addressGet = value.address;
|
||||
addressGet = value.address!;
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
@ -384,4 +450,190 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
|
||||
return addressGet;
|
||||
}
|
||||
|
||||
Widget walletNameController(BuildContext context, WalletData wallet,
|
||||
[double size = 20]) {
|
||||
nameController.text = wallet.name!;
|
||||
|
||||
return SizedBox(
|
||||
width: 260,
|
||||
child: Stack(children: <Widget>[
|
||||
TextField(
|
||||
key: keyWalletName,
|
||||
autofocus: false,
|
||||
focusNode: walletNameFocus,
|
||||
enabled: isEditing,
|
||||
controller: nameController,
|
||||
minLines: 1,
|
||||
maxLines: 3,
|
||||
textAlign: TextAlign.center,
|
||||
decoration: const InputDecoration(
|
||||
border: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
enabledBorder: InputBorder.none,
|
||||
disabledBorder: InputBorder.none,
|
||||
contentPadding: EdgeInsets.all(15.0),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 0,
|
||||
child: InkWell(
|
||||
key: keyRenameWallet,
|
||||
onTap: () async {
|
||||
// _isNewNameValid =
|
||||
// walletProvider.editWalletName(wallet.id(), isCesium: false);
|
||||
await editWalletName(context, wallet.id());
|
||||
await Future.delayed(const Duration(milliseconds: 30));
|
||||
walletNameFocus.requestFocus();
|
||||
},
|
||||
child: ClipRRect(
|
||||
child: Image.asset(
|
||||
isEditing
|
||||
? 'assets/walletOptions/android-checkmark.png'
|
||||
: 'assets/walletOptions/edit.png',
|
||||
width: 25,
|
||||
height: 25),
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
Widget walletName(BuildContext context, WalletData wallet,
|
||||
[double size = 20, Color color = Colors.black]) {
|
||||
double newSize = wallet.name!.length <= 15 ? size : size - 2;
|
||||
|
||||
return Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
||||
Text(
|
||||
truncate(wallet.name!, 20),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? newSize : newSize * 0.9,
|
||||
color: color,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, double> balanceCache = {};
|
||||
|
||||
Widget balance(BuildContext context, String address, double size,
|
||||
[Color color = Colors.black,
|
||||
Color loadingColor = const Color(0xffd07316)]) {
|
||||
return Column(children: <Widget>[
|
||||
Consumer<SubstrateSdk>(builder: (context, sdk, _) {
|
||||
return FutureBuilder(
|
||||
future: sdk.getBalance(address),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<Map<String, double>> globalBalance) {
|
||||
if (globalBalance.connectionState != ConnectionState.done ||
|
||||
globalBalance.hasError) {
|
||||
if (balanceCache[address] != null &&
|
||||
balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9, color: color)),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: 15,
|
||||
width: 15,
|
||||
child: CircularProgressIndicator(
|
||||
color: loadingColor,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
balanceCache[address] = globalBalance.data!['transferableBalance']!;
|
||||
if (balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(
|
||||
balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return const Text('');
|
||||
}
|
||||
});
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
Widget getCerts(BuildContext context, String address, double size,
|
||||
[Color color = Colors.black]) {
|
||||
return Column(children: <Widget>[
|
||||
Consumer<SubstrateSdk>(builder: (context, sdk, _) {
|
||||
return FutureBuilder(
|
||||
future: sdk.getCerts(address),
|
||||
builder: (BuildContext context, AsyncSnapshot<List<int>> certs) {
|
||||
// log.d(_certs.data);
|
||||
|
||||
return certs.data?[0] != 0 && certs.data != null
|
||||
? Row(
|
||||
children: [
|
||||
Image.asset('assets/medal.png', height: 20),
|
||||
const SizedBox(width: 1),
|
||||
Text(certs.data?[0].toString() ?? '0',
|
||||
style: const TextStyle(fontSize: 20)),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
"(${certs.data?[1].toString() ?? '0'})",
|
||||
style: const TextStyle(fontSize: 14),
|
||||
)
|
||||
],
|
||||
)
|
||||
: const Text('');
|
||||
});
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
Widget udUnitDisplay(double size, [Color color = Colors.black]) {
|
||||
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||
return isUdUnit
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
'ud'.tr(args: ['']),
|
||||
style:
|
||||
TextStyle(fontSize: isTall ? size : size * 0.9, color: color),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
currencyName,
|
||||
style: TextStyle(
|
||||
fontSize: (isTall ? size : size * 0.9) * 0.7,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: color),
|
||||
),
|
||||
const SizedBox(height: 15)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
: Text(currencyName,
|
||||
style: TextStyle(fontSize: isTall ? size : size * 0.9, color: color));
|
||||
}
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
import 'dart:io';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/g1_wallets_list.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/cesium_plus.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/wallet_view.dart';
|
||||
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:provider/provider.dart';
|
||||
|
||||
class WalletsProfilesProvider with ChangeNotifier {
|
||||
WalletsProfilesProvider(this.address);
|
||||
|
@ -37,10 +44,7 @@ class WalletsProfilesProvider with ChangeNotifier {
|
|||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return WalletViewScreen(
|
||||
address: barcode!.rawContent,
|
||||
username: '',
|
||||
);
|
||||
return WalletViewScreen(address: barcode!.rawContent);
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
|
@ -125,6 +129,102 @@ class WalletsProfilesProvider with ChangeNotifier {
|
|||
return _balance;
|
||||
}
|
||||
|
||||
Widget headerProfileView(
|
||||
BuildContext context, String address, String? username) {
|
||||
const double avatarSize = 140;
|
||||
|
||||
WalletOptionsProvider walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
CesiumPlusProvider cesiumPlusProvider =
|
||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||
// SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
return Stack(children: <Widget>[
|
||||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
bool isAccountExist = balanceCache[address] != 0;
|
||||
return Container(
|
||||
height: 180,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
isAccountExist ? yellowC : Colors.grey[400]!,
|
||||
isAccountExist ? const Color(0xFFE7811A) : Colors.grey[600]!,
|
||||
],
|
||||
),
|
||||
));
|
||||
}),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 30, right: 40),
|
||||
child: Row(children: <Widget>[
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 10,
|
||||
color: yellowC, // Colors.grey[400],
|
||||
),
|
||||
Row(children: [
|
||||
GestureDetector(
|
||||
key: keyCopyAddress,
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: address));
|
||||
snackCopyKey(context);
|
||||
},
|
||||
child: Text(
|
||||
getShortPubkey(address),
|
||||
style: const TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 25),
|
||||
balance(context, address, 22),
|
||||
const SizedBox(height: 10),
|
||||
walletOptions.idtyStatus(context, address,
|
||||
isOwner: false, color: Colors.black),
|
||||
getCerts(context, address, 14),
|
||||
// if (username == null &&
|
||||
// g1WalletsBox.get(address)?.username != null)
|
||||
// SizedBox(
|
||||
// width: 230,
|
||||
// child: Text(
|
||||
// g1WalletsBox.get(address)?.username ?? '',
|
||||
// style: const TextStyle(
|
||||
// fontSize: 27,
|
||||
// color: Color(0xff814C00),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// if (username != null)
|
||||
// SizedBox(
|
||||
// width: 230,
|
||||
// child: Text(
|
||||
// username,
|
||||
// style: const TextStyle(
|
||||
// fontSize: 27,
|
||||
// color: Color(0xff814C00),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
const SizedBox(height: 55),
|
||||
]),
|
||||
const Spacer(),
|
||||
Column(children: <Widget>[
|
||||
ClipOval(
|
||||
child: cesiumPlusProvider.defaultAvatar(avatarSize),
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
CommonElements().offlineInfo(context),
|
||||
]);
|
||||
}
|
||||
|
||||
bool isContact(String address) {
|
||||
return contactsBox.containsKey(address);
|
||||
}
|
||||
|
@ -152,12 +252,3 @@ snackCopyKey(context) {
|
|||
duration: const Duration(seconds: 2));
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
}
|
||||
|
||||
snackCopySeed(context) {
|
||||
final snackBar = SnackBar(
|
||||
padding: const EdgeInsets.all(20),
|
||||
content: Text("thisMnemonicHasBeenCopiedToClipboard".tr(),
|
||||
style: const TextStyle(fontSize: 17)),
|
||||
duration: const Duration(seconds: 4));
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
}
|
||||
|
|
|
@ -1,24 +1,44 @@
|
|||
// ignore_for_file: must_be_immutable
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/queries_indexer.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/cesium_plus.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/providers/home.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/widgets/bottom_app_bar.dart';
|
||||
import 'package:gecko/widgets/header_profile.dart';
|
||||
import 'package:gecko/widgets/history_query.dart';
|
||||
import 'package:gecko/screens/wallet_view.dart';
|
||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||
ActivityScreen({required this.address, required this.avatar, this.username})
|
||||
: super(key: keyActivityScreen);
|
||||
final ScrollController scrollController = ScrollController();
|
||||
final double avatarsSize = 80;
|
||||
final String address;
|
||||
final String? username;
|
||||
final Image avatar;
|
||||
|
||||
FetchMore? fetchMore;
|
||||
FetchMoreOptions? opts;
|
||||
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
WalletsProfilesProvider walletProfile =
|
||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
HomeProvider homeProvider =
|
||||
Provider.of<HomeProvider>(context, listen: false);
|
||||
|
||||
return Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
toolbarHeight: 60 * ratio,
|
||||
|
@ -27,10 +47,319 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
|||
child: Text('accountActivity'.tr()),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: const GeckoBottomAppBar(),
|
||||
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||
body: Column(children: <Widget>[
|
||||
HeaderProfile(address: address, username: username),
|
||||
HistoryQuery(address: address),
|
||||
walletProfile.headerProfileView(context, address, username),
|
||||
historyQuery(context),
|
||||
]));
|
||||
}
|
||||
|
||||
Widget historyQuery(context) {
|
||||
DuniterIndexer duniterIndexer =
|
||||
Provider.of<DuniterIndexer>(context, listen: false);
|
||||
|
||||
if (indexerEndpoint == '') {
|
||||
Column(children: <Widget>[
|
||||
const SizedBox(height: 50),
|
||||
Text(
|
||||
"noNetworkNoHistory".tr(),
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
final httpLink = HttpLink(
|
||||
'$indexerEndpoint/v1beta1/relay',
|
||||
);
|
||||
|
||||
final client = ValueNotifier(
|
||||
GraphQLClient(
|
||||
cache: GraphQLCache(),
|
||||
link: httpLink,
|
||||
),
|
||||
);
|
||||
|
||||
return GraphQLProvider(
|
||||
client: client,
|
||||
child: Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Query(
|
||||
options: QueryOptions(
|
||||
document: gql(getHistoryByAddressQ),
|
||||
variables: <String, dynamic>{
|
||||
'address': address,
|
||||
'number': 20,
|
||||
'cursor': null
|
||||
},
|
||||
),
|
||||
builder: (QueryResult result, {fetchMore, refetch}) {
|
||||
if (result.isLoading && result.data == null) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
|
||||
if (result.hasException) {
|
||||
log.e('Error Indexer: ${result.exception}');
|
||||
return Column(children: <Widget>[
|
||||
const SizedBox(height: 50),
|
||||
Text(
|
||||
"noNetworkNoHistory".tr(),
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
]);
|
||||
} else if (result
|
||||
.data?['transaction_connection']?['edges'].isEmpty) {
|
||||
return Column(children: <Widget>[
|
||||
const SizedBox(height: 50),
|
||||
Text(
|
||||
"noDataToDisplay".tr(),
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
if (result.isNotLoading) {
|
||||
// log.d(result.data);
|
||||
opts = duniterIndexer.checkQueryResult(result, opts, address);
|
||||
}
|
||||
|
||||
// Build history list
|
||||
return NotificationListener(
|
||||
child: Builder(
|
||||
builder: (context) => Expanded(
|
||||
child: ListView(
|
||||
key: keyListTransactions,
|
||||
controller: scrollController,
|
||||
children: <Widget>[historyView(context, result)],
|
||||
),
|
||||
),
|
||||
),
|
||||
onNotification: (dynamic t) {
|
||||
if (t is ScrollEndNotification &&
|
||||
scrollController.position.pixels >=
|
||||
scrollController.position.maxScrollExtent * 0.7 &&
|
||||
duniterIndexer.pageInfo!['hasNextPage'] &&
|
||||
result.isNotLoading) {
|
||||
fetchMore!(opts!);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget historyView(context, result) {
|
||||
DuniterIndexer duniterIndexer =
|
||||
Provider.of<DuniterIndexer>(context, listen: false);
|
||||
|
||||
return duniterIndexer.transBC == null
|
||||
? Column(children: <Widget>[
|
||||
const SizedBox(height: 50),
|
||||
Text(
|
||||
"noTransactionToDisplay".tr(),
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
])
|
||||
: Column(children: <Widget>[
|
||||
getTransactionTile(context, duniterIndexer),
|
||||
if (result.isLoading && duniterIndexer.pageInfo!['hasPreviousPage'])
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const <Widget>[
|
||||
CircularProgressIndicator(),
|
||||
],
|
||||
),
|
||||
if (!duniterIndexer.pageInfo!['hasNextPage'])
|
||||
Column(
|
||||
children: const <Widget>[
|
||||
SizedBox(height: 15),
|
||||
Text("Début de l'historique.",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 20)),
|
||||
SizedBox(height: 15)
|
||||
],
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
Widget getTransactionTile(
|
||||
BuildContext context, DuniterIndexer duniterIndexer) {
|
||||
CesiumPlusProvider cesiumPlusProvider =
|
||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||
|
||||
int keyID = 0;
|
||||
String? dateDelimiter;
|
||||
String? lastDateDelimiter;
|
||||
const double avatarSize = 200;
|
||||
|
||||
bool isTody = false;
|
||||
bool isYesterday = false;
|
||||
bool isThisWeek = false;
|
||||
|
||||
final Map<int, String> monthsInYear = {
|
||||
1: "month1".tr(),
|
||||
2: "month2".tr(),
|
||||
3: "month3".tr(),
|
||||
4: "month4".tr(),
|
||||
5: "month5".tr(),
|
||||
6: "month6".tr(),
|
||||
7: "month7".tr(),
|
||||
8: "month8".tr(),
|
||||
9: "month9".tr(),
|
||||
10: "month10".tr(),
|
||||
11: "month11".tr(),
|
||||
12: "month12".tr()
|
||||
};
|
||||
|
||||
return Column(
|
||||
children: duniterIndexer.transBC!.map((repository) {
|
||||
// log.d('bbbbbbbbbbbbbbbbbbbbbb: ' + repository.toString());
|
||||
|
||||
DateTime now = DateTime.now();
|
||||
DateTime date = repository[0];
|
||||
|
||||
String dateForm;
|
||||
if ({4, 10, 11, 12}.contains(date.month)) {
|
||||
dateForm = "${date.day} ${monthsInYear[date.month]!.substring(0, 3)}.";
|
||||
} else if ({1, 2, 7, 9}.contains(date.month)) {
|
||||
dateForm = "${date.day} ${monthsInYear[date.month]!.substring(0, 4)}.";
|
||||
} else {
|
||||
dateForm = "${date.day} ${monthsInYear[date.month]}";
|
||||
}
|
||||
|
||||
int weekNumber(DateTime date) {
|
||||
int dayOfYear = int.parse(DateFormat("D").format(date));
|
||||
return ((dayOfYear - date.weekday + 10) / 7).floor();
|
||||
}
|
||||
|
||||
final transactionDate = DateTime(date.year, date.month, date.day);
|
||||
final todayDate = DateTime(now.year, now.month, now.day);
|
||||
final yesterdayDate = DateTime(now.year, now.month, now.day - 1);
|
||||
|
||||
if (transactionDate == todayDate && !isTody) {
|
||||
dateDelimiter = lastDateDelimiter = "today".tr();
|
||||
isTody = true;
|
||||
} else if (transactionDate == yesterdayDate && !isYesterday) {
|
||||
dateDelimiter = lastDateDelimiter = "yesterday".tr();
|
||||
isYesterday = true;
|
||||
} else if (weekNumber(date) == weekNumber(now) &&
|
||||
date.year == now.year &&
|
||||
lastDateDelimiter != "thisWeek".tr() &&
|
||||
transactionDate != yesterdayDate &&
|
||||
transactionDate != todayDate &&
|
||||
!isThisWeek) {
|
||||
dateDelimiter = lastDateDelimiter = "thisWeek".tr();
|
||||
isThisWeek = true;
|
||||
} else if (lastDateDelimiter != monthsInYear[date.month] &&
|
||||
lastDateDelimiter != "${monthsInYear[date.month]} ${date.year}" &&
|
||||
transactionDate != todayDate &&
|
||||
transactionDate != yesterdayDate &&
|
||||
!(weekNumber(date) == weekNumber(now) && date.year == now.year)) {
|
||||
if (date.year == now.year) {
|
||||
dateDelimiter = lastDateDelimiter = monthsInYear[date.month];
|
||||
} else {
|
||||
dateDelimiter =
|
||||
lastDateDelimiter = "${monthsInYear[date.month]} ${date.year}";
|
||||
}
|
||||
} else {
|
||||
dateDelimiter = null;
|
||||
}
|
||||
|
||||
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||
late double amount;
|
||||
late String finalAmount;
|
||||
amount = repository[4] == 'RECEIVED' ? repository[3] : repository[3] * -1;
|
||||
|
||||
if (isUdUnit) {
|
||||
amount = round(amount / balanceRatio);
|
||||
finalAmount = 'ud'.tr(args: ['$amount ']);
|
||||
} else {
|
||||
finalAmount = '$amount $currencyName';
|
||||
}
|
||||
|
||||
return Column(children: <Widget>[
|
||||
if (dateDelimiter != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 30),
|
||||
child: Text(
|
||||
dateDelimiter!,
|
||||
style: const TextStyle(
|
||||
fontSize: 23, color: orangeC, fontWeight: FontWeight.w300),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 0),
|
||||
child:
|
||||
// Row(children: [Column(children: [],)],)
|
||||
ListTile(
|
||||
key: keyTransaction(keyID++),
|
||||
contentPadding: const EdgeInsets.only(
|
||||
left: 20, right: 30, top: 15, bottom: 15),
|
||||
leading: ClipOval(
|
||||
child: cesiumPlusProvider.defaultAvatar(avatarSize),
|
||||
),
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 5),
|
||||
child: Text(getShortPubkey(repository[1]),
|
||||
style: const TextStyle(
|
||||
fontSize: 18, fontFamily: 'Monospace')),
|
||||
),
|
||||
subtitle: RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey[700],
|
||||
),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: dateForm,
|
||||
),
|
||||
if (repository[2] != '')
|
||||
TextSpan(
|
||||
text: ' · ',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color: Colors.grey[550],
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: repository[2],
|
||||
style: TextStyle(
|
||||
fontStyle: FontStyle.italic,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
trailing: Text(finalAmount,
|
||||
style: const TextStyle(
|
||||
fontSize: 18, fontWeight: FontWeight.w500),
|
||||
textAlign: TextAlign.justify),
|
||||
dense: false,
|
||||
isThreeLine: false,
|
||||
onTap: () {
|
||||
duniterIndexer.nPage = 1;
|
||||
// _cesiumPlusProvider.avatarCancelToken.cancel('cancelled');
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return WalletViewScreen(address: repository[1]);
|
||||
}),
|
||||
);
|
||||
// Navigator.pop(context);
|
||||
}),
|
||||
),
|
||||
]);
|
||||
}).toList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
import 'package:accordion/controllers.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/widgets/certs_received.dart';
|
||||
import 'package:gecko/widgets/certs_counter.dart';
|
||||
import 'package:gecko/widgets/certs_sent.dart';
|
||||
import 'package:accordion/accordion.dart';
|
||||
|
||||
class CertificationsScreen extends StatelessWidget {
|
||||
const CertificationsScreen(
|
||||
{Key? key, required this.address, required this.username})
|
||||
: super(key: key);
|
||||
final String address;
|
||||
final String username;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
toolbarHeight: 60 * ratio,
|
||||
title: SizedBox(
|
||||
height: 22,
|
||||
child: Text('Certifications de $username'),
|
||||
)),
|
||||
body: SafeArea(
|
||||
child: Accordion(
|
||||
paddingListTop: 10,
|
||||
paddingListBottom: 10,
|
||||
maxOpenSections: 1,
|
||||
headerBackgroundColorOpened: orangeC,
|
||||
scaleWhenAnimating: true,
|
||||
openAndCloseAnimation: true,
|
||||
headerPadding:
|
||||
const EdgeInsets.symmetric(vertical: 7, horizontal: 15),
|
||||
sectionOpeningHapticFeedback: SectionHapticFeedback.heavy,
|
||||
sectionClosingHapticFeedback: SectionHapticFeedback.light,
|
||||
children: [
|
||||
AccordionSection(
|
||||
isOpen: true,
|
||||
leftIcon:
|
||||
const Icon(Icons.insights_rounded, color: Colors.black),
|
||||
headerBackgroundColor: yellowC,
|
||||
headerBackgroundColorOpened: orangeC,
|
||||
header: Row(children: [
|
||||
Text('received'.tr()),
|
||||
const SizedBox(width: 5),
|
||||
CertsCounter(address: address)
|
||||
]),
|
||||
content: CertsReceived(address: address),
|
||||
contentHorizontalPadding: 0,
|
||||
contentBorderWidth: 1,
|
||||
),
|
||||
AccordionSection(
|
||||
isOpen: false,
|
||||
leftIcon:
|
||||
const Icon(Icons.insights_rounded, color: Colors.black),
|
||||
headerBackgroundColor: yellowC,
|
||||
headerBackgroundColorOpened: orangeC,
|
||||
header: Row(children: [
|
||||
Text('sent'.tr()),
|
||||
const SizedBox(width: 5),
|
||||
CertsCounter(address: address, isSent: true)
|
||||
]),
|
||||
content: CertsSent(address: address),
|
||||
contentHorizontalPadding: 20,
|
||||
contentBorderWidth: 1,
|
||||
// onOpenSection: () => print('onOpenSection ...'),
|
||||
// onCloseSection: () => print('onCloseSection ...'),
|
||||
),
|
||||
]),
|
||||
));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,338 @@
|
|||
import 'package:dots_indicator/dots_indicator.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class CommonElements {
|
||||
// Exemple de Widget
|
||||
Widget exemple(String data) {
|
||||
return const Text('Coucou');
|
||||
}
|
||||
|
||||
Widget buildImage(String assetName,
|
||||
[double boxHeight = 440, double imageWidth = 350]) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(0),
|
||||
width: 440,
|
||||
height: isTall ? boxHeight : boxHeight * 0.9,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
Color(0xffd2d4cf),
|
||||
Color(0xffeaeae7),
|
||||
],
|
||||
),
|
||||
border: Border.all(color: Colors.grey[900]!)),
|
||||
child: Image.asset('assets/onBoarding/$assetName', width: imageWidth));
|
||||
}
|
||||
|
||||
Widget buildText(String text, [double size = 20, bool isMd = false]) {
|
||||
final mdStyle = MarkdownStyleSheet(
|
||||
p: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: Colors.black,
|
||||
letterSpacing: 0.3),
|
||||
textAlign: WrapAlignment.spaceBetween,
|
||||
);
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
width: 440,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white, border: Border.all(color: Colors.grey[900]!)),
|
||||
child: isMd
|
||||
? MarkdownBody(data: text, styleSheet: mdStyle)
|
||||
: Text(text,
|
||||
textAlign: TextAlign.justify,
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: Colors.black,
|
||||
letterSpacing: 0.3)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget nextButton(
|
||||
BuildContext context, String text, nextScreen, bool isFast) {
|
||||
return SizedBox(
|
||||
width: 380 * ratio,
|
||||
height: 60 * ratio,
|
||||
child: ElevatedButton(
|
||||
key: keyGoNext,
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: Colors.white, backgroundColor: orangeC,
|
||||
elevation: 4, // foreground
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context, FaderTransition(page: nextScreen, isFast: isFast));
|
||||
},
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(fontSize: 23 * ratio, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildProgressBar(double pagePosition) {
|
||||
return DotsIndicator(
|
||||
dotsCount: 10,
|
||||
position: pagePosition,
|
||||
decorator: DotsDecorator(
|
||||
spacing: const EdgeInsets.symmetric(horizontal: 10),
|
||||
color: Colors.grey[300]!, // Inactive color
|
||||
activeColor: orangeC,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget infoIntro(
|
||||
BuildContext context,
|
||||
String text,
|
||||
String assetName,
|
||||
String buttonText,
|
||||
nextScreen,
|
||||
double pagePosition, {
|
||||
bool isMd = false,
|
||||
bool isFast = false,
|
||||
double boxHeight = 440,
|
||||
double imageWidth = 350,
|
||||
double textSize = 20,
|
||||
}) {
|
||||
return Column(children: <Widget>[
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
buildProgressBar(pagePosition),
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
|
||||
buildText(text, textSize, isMd),
|
||||
|
||||
buildImage(assetName, boxHeight, imageWidth),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: nextButton(context, buttonText, nextScreen, false),
|
||||
),
|
||||
),
|
||||
// const SizedBox(height: 40),
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
]);
|
||||
}
|
||||
|
||||
Widget roundButton(
|
||||
AssetImage image,
|
||||
ontap,
|
||||
isAsync,
|
||||
double imgHight,
|
||||
EdgeInsets padding,
|
||||
) {
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey,
|
||||
blurRadius: 4.0,
|
||||
offset: Offset(2.0, 2.5),
|
||||
spreadRadius: 0.5)
|
||||
],
|
||||
),
|
||||
child: ClipOval(
|
||||
child: Material(
|
||||
color: const Color(0xffFFD58D), // button color
|
||||
child: InkWell(
|
||||
splashColor: orangeC, // inkwell color
|
||||
child: Padding(
|
||||
padding: padding,
|
||||
child: Image(image: image, height: imgHight)),
|
||||
onTap: () async {
|
||||
await ontap;
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget offlineInfo(BuildContext context) {
|
||||
final double screenWidth = MediaQuery.of(homeContext).size.width;
|
||||
return Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
return Visibility(
|
||||
visible: !sub.nodeConnected,
|
||||
child: Positioned(
|
||||
top: 0,
|
||||
child: Container(
|
||||
height: 30,
|
||||
width: screenWidth,
|
||||
color: Colors.grey[800],
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'youAreOffline'.tr(),
|
||||
style: TextStyle(color: Colors.grey[50]),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class SmoothTransition extends PageRouteBuilder {
|
||||
final Widget page;
|
||||
SmoothTransition({required this.page})
|
||||
: super(
|
||||
pageBuilder: (
|
||||
BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
) =>
|
||||
TweenAnimationBuilder(
|
||||
duration: const Duration(seconds: 5),
|
||||
tween: Tween(begin: 200, end: 200),
|
||||
builder: (BuildContext context, dynamic value, Widget? child) {
|
||||
return page;
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class FaderTransition extends PageRouteBuilder {
|
||||
final Widget page;
|
||||
final bool isFast;
|
||||
|
||||
FaderTransition({required this.page, required this.isFast})
|
||||
: super(
|
||||
pageBuilder: (
|
||||
BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
) =>
|
||||
page,
|
||||
transitionsBuilder: (
|
||||
BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
Widget child,
|
||||
) =>
|
||||
FadeTransition(
|
||||
opacity:
|
||||
Tween(begin: 0.0, end: isFast ? 3.0 : 1.0).animate(animation),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool?> confirmPopup(BuildContext context, String title) async {
|
||||
return showDialog<bool>(
|
||||
context: context,
|
||||
barrierDismissible: true, // user must tap button!
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
backgroundColor: backgroundColor,
|
||||
content: Text(
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
|
||||
),
|
||||
actions: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
key: keyConfirm,
|
||||
child: Text(
|
||||
"yes".tr(),
|
||||
style: const TextStyle(
|
||||
fontSize: 21,
|
||||
color: Color(0xffD80000),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context, true);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
TextButton(
|
||||
child: Text(
|
||||
"no".tr(),
|
||||
style: const TextStyle(fontSize: 21),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context, false);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 120)
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> infoPopup(BuildContext context, String title) async {
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: true, // user must tap button!
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
backgroundColor: backgroundColor,
|
||||
content: Text(
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
|
||||
),
|
||||
actions: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
key: keyInfoPopup,
|
||||
child: const Text(
|
||||
"D'accord",
|
||||
style: TextStyle(
|
||||
fontSize: 21,
|
||||
color: Color(0xffD80000),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context, true);
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// Widget geckoAppBar() {
|
||||
// return AppBar(
|
||||
// toolbarHeight: 60 * ratio,
|
||||
// elevation: 0,
|
||||
// leading: IconButton(
|
||||
// icon: const Icon(Icons.arrow_back, color: Colors.black),
|
||||
// onPressed: () {
|
||||
// _walletOptions.isEditing = false;
|
||||
// _walletOptions.isBalanceBlur = false;
|
||||
// Navigator.pop(context);
|
||||
// }),
|
||||
// title: SizedBox(
|
||||
// height: 22,
|
||||
// child: Consumer<WalletOptionsProvider>(
|
||||
// builder: (context, walletProvider, _) {
|
||||
// return Text(_walletOptions.nameController.text);
|
||||
// }),
|
||||
// ),
|
||||
// );
|
||||
// }
|
|
@ -4,8 +4,7 @@ import 'package:bubble/bubble.dart';
|
|||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/chest_data.dart';
|
||||
import 'package:gecko/models/g1_wallets_list.dart';
|
||||
import 'package:gecko/models/stateful_wrapper.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/chest_provider.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
|
@ -15,126 +14,30 @@ import 'package:gecko/providers/wallets_profiles.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/widgets/commons/animated_text.dart';
|
||||
import 'package:gecko/widgets/commons/common_elements.dart';
|
||||
import 'package:gecko/screens/animated_text.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/myWallets/restore_chest.dart';
|
||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||
import 'package:gecko/screens/myWallets/wallets_home.dart';
|
||||
import 'package:gecko/screens/onBoarding/1.dart';
|
||||
import 'package:gecko/screens/search.dart';
|
||||
import 'package:gecko/screens/settings.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:gecko/screens/my_contacts.dart';
|
||||
|
||||
class HomeScreen extends StatefulWidget {
|
||||
class HomeScreen extends StatelessWidget {
|
||||
const HomeScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<HomeScreen> createState() => _HomeScreenState();
|
||||
}
|
||||
|
||||
class _HomeScreenState extends State<HomeScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
final homeProviderInit =
|
||||
Provider.of<HomeProvider>(context, listen: false);
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final duniterIndexer =
|
||||
Provider.of<DuniterIndexer>(context, listen: false);
|
||||
final myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
|
||||
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
||||
|
||||
// Check if versionData non compatible, drop everything
|
||||
if (configBox.get('dataVersion') == null) {
|
||||
configBox.put('dataVersion', dataVersion);
|
||||
}
|
||||
if (isWalletsExists && (configBox.get('dataVersion')) < dataVersion) {
|
||||
if (!sub.sdkReady && !sub.sdkLoading) sub.initApi();
|
||||
await infoPopup(context, "chestNotCompatibleMustReinstallGecko".tr());
|
||||
await Hive.deleteBoxFromDisk('walletBox');
|
||||
await Hive.deleteBoxFromDisk('chestBox');
|
||||
chestBox = await Hive.openBox<ChestData>("chestBox");
|
||||
await configBox.delete('defaultWallet');
|
||||
if (!sub.sdkReady && !sub.sdkLoading) await sub.initApi();
|
||||
await sub.deleteAllAccounts();
|
||||
configBox.put('dataVersion', dataVersion);
|
||||
myWalletProvider.reload();
|
||||
} else {
|
||||
if (!sub.sdkReady && !sub.sdkLoading) await sub.initApi();
|
||||
}
|
||||
|
||||
if (sub.sdkReady && !sub.nodeConnected) {
|
||||
walletBox = await Hive.openBox<WalletData>("walletBox");
|
||||
await Hive.deleteBoxFromDisk('g1WalletsBox');
|
||||
g1WalletsBox = await Hive.openBox<G1WalletsList>("g1WalletsBox");
|
||||
contactsBox = await Hive.openBox<G1WalletsList>("contactsBox");
|
||||
|
||||
homeProviderInit.isWalletBoxInit = true;
|
||||
myWalletProvider.reload();
|
||||
|
||||
duniterIndexer.getValidIndexerEndpoint();
|
||||
|
||||
await homeProviderInit.getValidEndpoints();
|
||||
// await configBox.delete('isCacheChecked');
|
||||
if (configBox.get('isCacheChecked') == null) {
|
||||
configBox.put('isCacheChecked', false);
|
||||
}
|
||||
// log.d(await configBox.get('endpoint'));
|
||||
|
||||
// var connectivityResult =
|
||||
// await (Connectivity().checkConnectivity());
|
||||
|
||||
// if (connectivityResult != ConnectivityResult.mobile &&
|
||||
// connectivityResult != ConnectivityResult.wifi) {
|
||||
// homeProvider.changeMessage(
|
||||
// "notConnectedToInternet".tr(), 0);
|
||||
// sub.nodeConnected = false;
|
||||
// }
|
||||
|
||||
// Améliore ce code car il y a un bug: parfois l'app se croit hors ligne, alors que c'est faux, le téléphone est bien connecté à internet
|
||||
// (GPT vscode extension fixed it for my...)
|
||||
HomeProvider homeProvider =
|
||||
Provider.of<HomeProvider>(context, listen: false);
|
||||
Connectivity()
|
||||
.onConnectivityChanged
|
||||
.listen((ConnectivityResult result) async {
|
||||
log.d('Network changed: $result');
|
||||
if (result == ConnectivityResult.none) {
|
||||
sub.nodeConnected = false;
|
||||
await sub.sdk.api.setting.unsubscribeBestNumber();
|
||||
homeProvider.changeMessage("notConnectedToInternet".tr(), 0);
|
||||
sub.reload();
|
||||
} else {
|
||||
// Check if the phone is actually connected to the internet
|
||||
var connectivityResult = await (Connectivity().checkConnectivity());
|
||||
if (connectivityResult != ConnectivityResult.none) {
|
||||
await sub.connectNode(context);
|
||||
// Currency parameters
|
||||
await sub.initCurrencyParameters();
|
||||
}
|
||||
}
|
||||
|
||||
// Indexer Blockchain start
|
||||
getBlockStart();
|
||||
});
|
||||
// await sub.connectNode(ctx);
|
||||
}
|
||||
// _duniterIndexer.checkIndexerEndpointBackground();
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
homeContext = context;
|
||||
|
||||
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
Provider.of<ChestProvider>(context);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
||||
|
||||
isTall = false;
|
||||
|
@ -144,71 +47,148 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||
ratio = 1.125;
|
||||
}
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
drawer: Drawer(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ListView(padding: EdgeInsets.zero, children: <Widget>[
|
||||
DrawerHeader(
|
||||
decoration: const BoxDecoration(
|
||||
color: orangeC,
|
||||
),
|
||||
child: Column(children: const <Widget>[
|
||||
SizedBox(height: 0),
|
||||
Image(
|
||||
image: AssetImage('assets/icon/gecko_final.png'),
|
||||
height: 130),
|
||||
]),
|
||||
resizeToAvoidBottomInset: false,
|
||||
drawer: Drawer(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ListView(padding: EdgeInsets.zero, children: <Widget>[
|
||||
DrawerHeader(
|
||||
decoration: const BoxDecoration(
|
||||
color: orangeC,
|
||||
),
|
||||
ListTile(
|
||||
key: keyParameters,
|
||||
title: Text('parameters'.tr()),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return SettingsScreen();
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
if (isWalletsExists)
|
||||
ListTile(
|
||||
key: keyContacts,
|
||||
title: Text('contactsManagement'.tr()),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const ContactsScreen();
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
])),
|
||||
Align(
|
||||
alignment: FractionalOffset.bottomCenter,
|
||||
child: Text('Ğecko v$appVersion')),
|
||||
const SizedBox(height: 20)
|
||||
],
|
||||
),
|
||||
child: Column(children: const <Widget>[
|
||||
SizedBox(height: 0),
|
||||
Image(
|
||||
image: AssetImage('assets/icon/gecko_final.png'),
|
||||
height: 130),
|
||||
]),
|
||||
),
|
||||
ListTile(
|
||||
key: keyParameters,
|
||||
title: Text('parameters'.tr()),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return SettingsScreen();
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
key: keyContacts,
|
||||
title: Text('contactsManagement'.tr()),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const ContactsScreen();
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
])),
|
||||
Align(
|
||||
alignment: FractionalOffset.bottomCenter,
|
||||
child: Text('Ğecko v$appVersion')),
|
||||
const SizedBox(height: 20)
|
||||
],
|
||||
),
|
||||
backgroundColor: const Color(0xffF9F9F1),
|
||||
body: isWalletsExists ? geckHome(context) : welcomeHome(context));
|
||||
),
|
||||
// bottomNavigationBar: _homeProvider.bottomBar(context, 1),
|
||||
backgroundColor: const Color(0xffF9F9F1),
|
||||
body: Builder(
|
||||
builder: (ctx) => StatefulWrapper(
|
||||
onInit: () {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
DuniterIndexer duniterIndexer =
|
||||
Provider.of<DuniterIndexer>(ctx, listen: false);
|
||||
duniterIndexer.getValidIndexerEndpoint();
|
||||
|
||||
if (!sub.sdkReady && !sub.sdkLoading) await sub.initApi();
|
||||
if (sub.sdkReady && !sub.nodeConnected) {
|
||||
// Check if versionData non compatible, drop everything
|
||||
if (walletBox.isNotEmpty &&
|
||||
walletBox.getAt(0)!.version! < dataVersion) {
|
||||
await infoPopup(
|
||||
context, "chestNotCompatibleMustReinstallGecko".tr());
|
||||
await walletBox.clear();
|
||||
await chestBox.clear();
|
||||
await configBox.delete('defaultWallet');
|
||||
await sub.deleteAllAccounts();
|
||||
myWalletProvider.reload();
|
||||
}
|
||||
|
||||
// var connectivityResult =
|
||||
// await (Connectivity().checkConnectivity());
|
||||
|
||||
// if (connectivityResult != ConnectivityResult.mobile &&
|
||||
// connectivityResult != ConnectivityResult.wifi) {
|
||||
// homeProvider.changeMessage(
|
||||
// "notConnectedToInternet".tr(), 0);
|
||||
// sub.nodeConnected = false;
|
||||
// }
|
||||
|
||||
// TODO: fix random bad network status on startup
|
||||
HomeProvider homeProvider =
|
||||
Provider.of<HomeProvider>(ctx, listen: false);
|
||||
Connectivity()
|
||||
.onConnectivityChanged
|
||||
.listen((ConnectivityResult result) async {
|
||||
log.d('Network changed: $result');
|
||||
if (result == ConnectivityResult.none) {
|
||||
sub.nodeConnected = false;
|
||||
await sub.sdk.api.setting.unsubscribeBestNumber();
|
||||
homeProvider.changeMessage(
|
||||
"notConnectedToInternet".tr(), 0);
|
||||
sub.reload();
|
||||
} else {
|
||||
await sub.connectNode(ctx);
|
||||
}
|
||||
});
|
||||
// await sub.connectNode(ctx);
|
||||
}
|
||||
// _duniterIndexer.checkIndexerEndpointBackground();
|
||||
});
|
||||
},
|
||||
child: isWalletsExists ? geckHome(context) : welcomeHome(context)
|
||||
// bottomNavigationBar: BottomNavigationBar(
|
||||
// backgroundColor: backgroundColor,
|
||||
// fixedColor: Colors.grey[850],
|
||||
// unselectedItemColor: const Color(0xffBD935C),
|
||||
// type: BottomNavigationBarType.fixed,
|
||||
// onTap: (index) {
|
||||
// _homeProvider.currentIndex = index;
|
||||
// },
|
||||
// currentIndex: _homeProvider.currentIndex,
|
||||
// items: [
|
||||
// BottomNavigationBarItem(
|
||||
// icon: Image.asset('assets/block-space-disabled.png', height: 26),
|
||||
// activeIcon: Image.asset('assets/blockchain.png', height: 26),
|
||||
// label: 'Explorateur',
|
||||
// ),
|
||||
// const BottomNavigationBarItem(
|
||||
// icon: Icon(Icons.lock),
|
||||
// label: 'Mes portefeuilles',
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget geckHome(context) {
|
||||
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
||||
final homeProvider = Provider.of<HomeProvider>(context, listen: false);
|
||||
MyWalletsProvider myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
||||
Provider.of<ChestProvider>(context);
|
||||
|
||||
WalletsProfilesProvider historyProvider =
|
||||
Provider.of<WalletsProfilesProvider>(context);
|
||||
final statusBarHeight = MediaQuery.of(context).padding.top;
|
||||
final double statusBarHeight = MediaQuery.of(context).padding.top;
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
|
@ -350,47 +330,42 @@ Widget geckHome(context) {
|
|||
child: ClipOval(
|
||||
key: keyOpenWalletsHomme,
|
||||
child: Material(
|
||||
color: homeProvider.isWalletBoxInit
|
||||
? orangeC
|
||||
: Colors.grey[500], // button color
|
||||
color: orangeC, // button color
|
||||
child: InkWell(
|
||||
onTap: !homeProvider.isWalletBoxInit
|
||||
? null
|
||||
: () async {
|
||||
WalletData? defaultWallet =
|
||||
myWalletProvider.getDefaultWallet();
|
||||
String? pin;
|
||||
if (myWalletProvider.pinCode == '') {
|
||||
pin = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (homeContext) {
|
||||
return UnlockingWallet(
|
||||
wallet: defaultWallet);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
if (pin != null ||
|
||||
myWalletProvider.pinCode != '') {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const WalletsHome();
|
||||
}),
|
||||
);
|
||||
}
|
||||
// log.d(_myWalletProvider.pinCode);
|
||||
|
||||
// Navigator.pushNamed(
|
||||
// context, '/mywallets')));
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(18),
|
||||
child: Image(
|
||||
image: const AssetImage(
|
||||
'assets/home/wallet.png'),
|
||||
height: 68 * ratio))),
|
||||
height: 68 * ratio)),
|
||||
onTap: () async {
|
||||
WalletData? defaultWallet =
|
||||
myWalletProvider.getDefaultWallet();
|
||||
String? pin;
|
||||
if (myWalletProvider.pinCode == '') {
|
||||
pin = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (homeContext) {
|
||||
return UnlockingWallet(
|
||||
wallet: defaultWallet);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
if (pin != null || myWalletProvider.pinCode != '') {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const WalletsHome();
|
||||
}),
|
||||
);
|
||||
}
|
||||
// log.d(_myWalletProvider.pinCode);
|
||||
|
||||
// Navigator.pushNamed(
|
||||
// context, '/mywallets')));
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -459,7 +434,7 @@ Widget geckHome(context) {
|
|||
}
|
||||
|
||||
Widget welcomeHome(context) {
|
||||
final statusBarHeight = MediaQuery.of(context).padding.top;
|
||||
final double statusBarHeight = MediaQuery.of(context).padding.top;
|
||||
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:durt/durt.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/stateful_wrapper.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
|
@ -12,7 +13,7 @@ import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
|||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ChangePinScreen extends StatefulWidget with ChangeNotifier {
|
||||
class ChangePinScreen extends StatelessWidget with ChangeNotifier {
|
||||
ChangePinScreen(
|
||||
{Key? keyMyWallets,
|
||||
required this.walletName,
|
||||
|
@ -21,23 +22,13 @@ class ChangePinScreen extends StatefulWidget with ChangeNotifier {
|
|||
final String? walletName;
|
||||
final MyWalletsProvider walletProvider;
|
||||
|
||||
@override
|
||||
State<ChangePinScreen> createState() => _ChangePinScreenState();
|
||||
}
|
||||
|
||||
class _ChangePinScreenState extends State<ChangePinScreen> {
|
||||
final TextEditingController newPin = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
newPin.text = randomSecretCode(pinLength);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final myWalletProvider =
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
|
||||
return WillPopScope(
|
||||
|
@ -58,12 +49,18 @@ class _ChangePinScreenState extends State<ChangePinScreen> {
|
|||
}),
|
||||
title: SizedBox(
|
||||
height: 22,
|
||||
child: Text(widget.walletName!),
|
||||
child: Text(walletName!),
|
||||
),
|
||||
),
|
||||
body: Center(
|
||||
child: SafeArea(
|
||||
child: Column(children: <Widget>[
|
||||
StatefulWrapper(
|
||||
onInit: () {
|
||||
newPin.text = randomSecretCode(pinLength);
|
||||
},
|
||||
child: Container(),
|
||||
),
|
||||
const SizedBox(height: 80),
|
||||
Text(
|
||||
'choosePassword'.tr(),
|
||||
|
@ -121,9 +118,9 @@ class _ChangePinScreenState extends State<ChangePinScreen> {
|
|||
);
|
||||
}
|
||||
if (pin != null || myWalletProvider.pinCode != '') {
|
||||
await sub.changePassword(context, defaultWallet.address,
|
||||
widget.walletProvider.pinCode, newPin.text);
|
||||
widget.walletProvider.pinCode = newPin.text;
|
||||
await sub.changePassword(context, defaultWallet.address!,
|
||||
walletProvider.pinCode, newPin.text);
|
||||
walletProvider.pinCode = newPin.text;
|
||||
newPin.text = '';
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
|
|
@ -4,17 +4,18 @@ import 'package:easy_localization/easy_localization.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/chest_data.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/chest_provider.dart';
|
||||
import 'package:gecko/providers/home.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/myWallets/change_pin.dart';
|
||||
import 'package:gecko/screens/myWallets/custom_derivations.dart';
|
||||
import 'package:gecko/screens/myWallets/show_seed.dart';
|
||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||
import 'package:gecko/widgets/bottom_app_bar.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ChestOptions extends StatelessWidget {
|
||||
|
@ -24,7 +25,11 @@ class ChestOptions extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final chestProvider = Provider.of<ChestProvider>(context, listen: false);
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
ChestProvider chestProvider =
|
||||
Provider.of<ChestProvider>(context, listen: false);
|
||||
HomeProvider homeProvider =
|
||||
Provider.of<HomeProvider>(context, listen: false);
|
||||
|
||||
ChestData currentChest = chestBox.get(configBox.get('currentChest'))!;
|
||||
|
||||
|
@ -47,7 +52,7 @@ class ChestOptions extends StatelessWidget {
|
|||
height: 22,
|
||||
child: Text(currentChest.name!),
|
||||
)),
|
||||
bottomNavigationBar: const GeckoBottomAppBar(),
|
||||
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||
body: Stack(children: [
|
||||
Builder(
|
||||
builder: (ctx) => SafeArea(
|
||||
|
@ -56,7 +61,7 @@ class ChestOptions extends StatelessWidget {
|
|||
InkWell(
|
||||
key: keyShowSeed,
|
||||
onTap: () async {
|
||||
final myWalletProvider =
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
WalletData? defaultWallet =
|
||||
myWalletProvider.getDefaultWallet();
|
||||
|
@ -105,27 +110,26 @@ class ChestOptions extends StatelessWidget {
|
|||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
return InkWell(
|
||||
key: keyChangePin,
|
||||
onTap: null,
|
||||
// sub.nodeConnected
|
||||
// ? () async {
|
||||
// // await _chestProvider.changePin(context, cesiumWallet);
|
||||
// String? pinResult = await Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) {
|
||||
// return ChangePinScreen(
|
||||
// walletName: currentChest.name,
|
||||
// walletProvider: walletProvider,
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
onTap: sub.nodeConnected
|
||||
? () async {
|
||||
// await _chestProvider.changePin(context, cesiumWallet);
|
||||
String? pinResult = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return ChangePinScreen(
|
||||
walletName: currentChest.name,
|
||||
walletProvider: walletProvider,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
// if (pinResult != null) {
|
||||
// walletProvider.pinCode = pinResult;
|
||||
// }
|
||||
// }
|
||||
// : null,
|
||||
if (pinResult != null) {
|
||||
walletProvider.pinCode = pinResult;
|
||||
}
|
||||
}
|
||||
: null,
|
||||
child: SizedBox(
|
||||
height: 50,
|
||||
child: Row(children: <Widget>[
|
||||
|
@ -140,7 +144,7 @@ class ChestOptions extends StatelessWidget {
|
|||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color: sub.nodeConnected
|
||||
? Colors.grey[500]
|
||||
? Colors.black
|
||||
: Colors.grey[500]),
|
||||
),
|
||||
])),
|
||||
|
@ -211,7 +215,7 @@ class ChestOptions extends StatelessWidget {
|
|||
]),
|
||||
),
|
||||
),
|
||||
const OfflineInfo(),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
|
@ -30,7 +30,9 @@ class _ChooseChestState extends State<ChooseChest> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/screens/myWallets/wallets_home.dart';
|
||||
import 'package:gecko/widgets/balance.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
// import 'package:gecko/models/home.dart';
|
||||
// import 'package:provider/provider.dart';
|
||||
|
@ -23,7 +23,8 @@ class ChooseWalletScreen extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final int chest = configBox.get('currentChest');
|
||||
|
||||
return Scaffold(
|
||||
|
@ -72,7 +73,9 @@ class ChooseWalletScreen extends StatelessWidget {
|
|||
}
|
||||
|
||||
Widget myWalletsTiles(BuildContext context, int currentChest) {
|
||||
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
// SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
||||
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
|
@ -94,11 +97,8 @@ class ChooseWalletScreen extends StatelessWidget {
|
|||
]);
|
||||
}
|
||||
|
||||
List<WalletData> listWallets = myWalletProvider.listWallets;
|
||||
listWallets.sort((p1, p2) {
|
||||
return Comparable.compare(p1.number!, p2.number!);
|
||||
});
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
List listWallets = myWalletProvider.listWallets;
|
||||
final double screenWidth = MediaQuery.of(context).size.width;
|
||||
int nTule = 2;
|
||||
|
||||
if (screenWidth >= 900) {
|
||||
|
@ -116,11 +116,11 @@ class ChooseWalletScreen extends StatelessWidget {
|
|||
crossAxisSpacing: 0,
|
||||
mainAxisSpacing: 0,
|
||||
children: <Widget>[
|
||||
for (WalletData repository in listWallets)
|
||||
for (WalletData repository in listWallets as Iterable<WalletData>)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: GestureDetector(
|
||||
key: keySelectThisWallet(repository.address),
|
||||
key: keySelectThisWallet(repository.address!),
|
||||
onTap: () {
|
||||
selectedWallet = repository;
|
||||
myWalletProvider.reload();
|
||||
|
@ -169,8 +169,8 @@ class ChooseWalletScreen extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
)),
|
||||
balanceBuilder(context, repository.address,
|
||||
selectedWallet!.address == repository.address),
|
||||
balanceBuilder(context, repository.address!,
|
||||
selectedWallet!.address == repository.address!),
|
||||
ListTile(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(
|
||||
|
@ -225,10 +225,8 @@ class ChooseWalletScreen extends StatelessWidget {
|
|||
// style: TextStyle(color: isDefault ? Colors.white : Colors.black),
|
||||
// ),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Balance(
|
||||
address: address,
|
||||
size: 16,
|
||||
color: isDefault ? Colors.white : Colors.black),
|
||||
balance(
|
||||
context, address, 16, isDefault ? Colors.white : Colors.black),
|
||||
])
|
||||
]),
|
||||
),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
|
@ -27,7 +27,8 @@ class _CustomDerivationState extends State<CustomDerivation> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final myWalletProvider =
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
|
||||
final derivationList = <String>[
|
||||
|
|
|
@ -4,18 +4,16 @@ import 'dart:async';
|
|||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||
import 'package:gecko/screens/transaction_in_progress.dart';
|
||||
import 'package:gecko/widgets/certifications.dart';
|
||||
import 'package:gecko/widgets/idty_status.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ImportG1v1 extends StatelessWidget {
|
||||
|
@ -23,7 +21,10 @@ class ImportG1v1 extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final myWalletProvider =
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
WalletOptionsProvider walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
|
||||
Timer? debounce;
|
||||
|
@ -56,7 +57,7 @@ class ImportG1v1 extends StatelessWidget {
|
|||
child: Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
return FutureBuilder(
|
||||
future: sub.getBalanceAndIdtyStatus(
|
||||
sub.g1V1NewAddress, selectedWallet.address),
|
||||
sub.g1V1NewAddress, selectedWallet.address!),
|
||||
builder: (BuildContext context, AsyncSnapshot<List> status) {
|
||||
// log.d(_certs.data);
|
||||
|
||||
|
@ -82,7 +83,6 @@ class ImportG1v1 extends StatelessWidget {
|
|||
final String idtyStatus = status.data?[1];
|
||||
final String myIdtyStatus = status.data?[2];
|
||||
final bool hasConsumer = status.data?[3] ?? false;
|
||||
final bool isSmith = status.data?[4] ?? false;
|
||||
|
||||
// log.d('hasconsumer: $hasConsumer');
|
||||
|
||||
|
@ -92,7 +92,7 @@ class ImportG1v1 extends StatelessWidget {
|
|||
} else {
|
||||
canValidate = false;
|
||||
validationStatus = hasConsumer
|
||||
? 'youMustWaitBeforeCashoutThisAccount'.tr()
|
||||
? 'youMustWaitBeforeCashoutThisAccount'.tr(args: ['X'])
|
||||
: 'thisAccountIsEmpty'.tr();
|
||||
}
|
||||
|
||||
|
@ -102,11 +102,6 @@ class ImportG1v1 extends StatelessWidget {
|
|||
'youCannotMigrateIdentityToExistingIdentity'.tr();
|
||||
}
|
||||
|
||||
if (isSmith) {
|
||||
canValidate = false;
|
||||
validationStatus = 'smithCantMigrateIdentity'.tr();
|
||||
}
|
||||
|
||||
if (sub.g1V1NewAddress == '') {
|
||||
validationStatus = '';
|
||||
}
|
||||
|
@ -190,13 +185,13 @@ class ImportG1v1 extends StatelessWidget {
|
|||
key: keyCopyAddress,
|
||||
onTap: () {
|
||||
Clipboard.setData(
|
||||
ClipboardData(text: sub.g1V1OldPubkey));
|
||||
ClipboardData(text: sub.g1V1NewAddress));
|
||||
snackCopyKey(context);
|
||||
},
|
||||
child: Text(
|
||||
sub.g1V1OldPubkey,
|
||||
getShortPubkey(sub.g1V1NewAddress),
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
|
@ -209,12 +204,10 @@ class ImportG1v1 extends StatelessWidget {
|
|||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IdentityStatus(
|
||||
address: sub.g1V1NewAddress,
|
||||
isOwner: false,
|
||||
color: Colors.black),
|
||||
walletOptions.idtyStatus(context, sub.g1V1NewAddress,
|
||||
isOwner: false, color: Colors.black),
|
||||
const SizedBox(width: 10),
|
||||
Certifications(address: sub.g1V1NewAddress, size: 14)
|
||||
getCerts(context, sub.g1V1NewAddress, 14)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
|
@ -228,7 +221,7 @@ class ImportG1v1 extends StatelessWidget {
|
|||
icon: const Icon(Icons.keyboard_arrow_down),
|
||||
items: myWalletProvider.listWallets.map((wallet) {
|
||||
return DropdownMenuItem(
|
||||
key: keySelectThisWallet(wallet.address),
|
||||
key: keySelectThisWallet(wallet.address!),
|
||||
value: wallet,
|
||||
child: Text(
|
||||
wallet.name!,
|
||||
|
@ -270,8 +263,10 @@ class ImportG1v1 extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
|
||||
sub.migrateCsToV2(sub.csSalt.text,
|
||||
sub.csPassword.text, selectedWallet.address,
|
||||
sub.migrateCsToV2(
|
||||
sub.csSalt.text,
|
||||
sub.csPassword.text,
|
||||
selectedWallet.address!,
|
||||
destPassword:
|
||||
pin ?? myWalletProvider.pinCode,
|
||||
balance: balance,
|
||||
|
@ -284,7 +279,7 @@ class ImportG1v1 extends StatelessWidget {
|
|||
fromAddress:
|
||||
getShortPubkey(sub.g1V1NewAddress),
|
||||
toAddress: getShortPubkey(
|
||||
selectedWallet.address));
|
||||
selectedWallet.address!));
|
||||
}),
|
||||
);
|
||||
resetScreen(context);
|
||||
|
@ -313,7 +308,7 @@ class ImportG1v1 extends StatelessWidget {
|
|||
}
|
||||
|
||||
void resetScreen(BuildContext context) {
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
sub.csSalt.text = '';
|
||||
sub.csPassword.text = '';
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/widgets/commons/common_elements.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/myWallets/migrate_identity.dart';
|
||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||
import 'package:gecko/screens/transaction_in_progress.dart';
|
||||
|
@ -27,6 +27,7 @@ class ManageMembership extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
final sub = Provider.of<SubstrateSdk>(context);
|
||||
|
||||
return Scaffold(
|
||||
|
@ -115,9 +116,9 @@ class ManageMembership extends StatelessWidget {
|
|||
false;
|
||||
|
||||
if (answer) {
|
||||
final myWalletProvider =
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
// MyWalletsProvider mw = MyWalletsProvider();
|
||||
// final wallet = mw.getWalletDataByAddress(address);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -20,12 +20,14 @@ class MigrateIdentityScreen extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// final _homeProvider = Provider.of<HomeProvider>(context);
|
||||
final walletOptions =
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
// HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
||||
WalletOptionsProvider walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
final myWalletProvider =
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
|
||||
DuniterIndexer duniterIndexer =
|
||||
Provider.of<DuniterIndexer>(context, listen: false);
|
||||
|
||||
final fromAddress = walletOptions.address.text;
|
||||
final defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
|
@ -75,7 +77,7 @@ class MigrateIdentityScreen extends StatelessWidget {
|
|||
child: Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
return FutureBuilder(
|
||||
future: sub.getBalanceAndIdtyStatus(
|
||||
fromAddress, selectedWallet.address),
|
||||
fromAddress, selectedWallet.address!),
|
||||
builder: (BuildContext context, AsyncSnapshot<List> status) {
|
||||
if (status.data == null) {
|
||||
return Column(children: [
|
||||
|
@ -101,21 +103,12 @@ class MigrateIdentityScreen extends StatelessWidget {
|
|||
final String idtyStatus = status.data?[1];
|
||||
final String myIdtyStatus = status.data?[2];
|
||||
final bool hasConsumer = status.data?[3] ?? false;
|
||||
final bool isSmith = status.data?[4] ?? false;
|
||||
|
||||
// log.d('hasconsumer: $hasConsumer');
|
||||
|
||||
if (isSmith) {
|
||||
canValidate = false;
|
||||
validationStatus = 'smithCantMigrateIdentity'.tr();
|
||||
} else if (balance['transferableBalance'] != 0 &&
|
||||
!hasConsumer) {
|
||||
if (balance['transferableBalance'] != 0 && !hasConsumer) {
|
||||
canValidate = true;
|
||||
validationStatus = '';
|
||||
} else if (idtyStatus != 'noid' && myIdtyStatus != 'noid') {
|
||||
canValidate = false;
|
||||
validationStatus =
|
||||
'youCannotMigrateIdentityToExistingIdentity'.tr();
|
||||
} else {
|
||||
canValidate = false;
|
||||
validationStatus = hasConsumer
|
||||
|
@ -123,8 +116,14 @@ class MigrateIdentityScreen extends StatelessWidget {
|
|||
: 'thisAccountIsEmpty'.tr();
|
||||
}
|
||||
|
||||
if (idtyStatus != 'noid' && myIdtyStatus != 'noid') {
|
||||
canValidate = false;
|
||||
validationStatus =
|
||||
'youCannotMigrateIdentityToExistingIdentity'.tr();
|
||||
}
|
||||
|
||||
log.d(
|
||||
'tatatata: ${sub.g1V1NewAddress}, ${selectedWallet.address}, $balance, $idtyStatus, $myIdtyStatus');
|
||||
'tatatata: ${sub.g1V1NewAddress}, ${selectedWallet.address!}, $balance, $idtyStatus, $myIdtyStatus');
|
||||
|
||||
final walletsList = myWalletProvider.listWallets.toList();
|
||||
|
||||
|
@ -177,7 +176,7 @@ class MigrateIdentityScreen extends StatelessWidget {
|
|||
icon: const Icon(Icons.keyboard_arrow_down),
|
||||
items: walletsList.map((wallet) {
|
||||
return DropdownMenuItem(
|
||||
key: keySelectThisWallet(wallet.address),
|
||||
key: keySelectThisWallet(wallet.address!),
|
||||
value: wallet,
|
||||
child: Text(
|
||||
wallet.name!,
|
||||
|
@ -222,7 +221,7 @@ class MigrateIdentityScreen extends StatelessWidget {
|
|||
|
||||
sub.migrateIdentity(
|
||||
fromAddress: fromAddress,
|
||||
destAddress: selectedWallet.address,
|
||||
destAddress: selectedWallet.address!,
|
||||
fromPassword: pin ?? myWalletProvider.pinCode,
|
||||
destPassword: pin ?? myWalletProvider.pinCode,
|
||||
withBalance: true,
|
||||
|
@ -234,7 +233,7 @@ class MigrateIdentityScreen extends StatelessWidget {
|
|||
transType: 'identityMigration',
|
||||
fromAddress: getShortPubkey(fromAddress),
|
||||
toAddress: getShortPubkey(
|
||||
selectedWallet.address));
|
||||
selectedWallet.address!));
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
import 'package:bubble/bubble.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/generate_wallets.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/onBoarding/7.dart';
|
||||
import 'package:gecko/screens/onBoarding/9.dart';
|
||||
import 'package:gecko/widgets/commons/fader_transition.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
// import 'package:gecko/models/home.dart';
|
||||
// import 'package:provider/provider.dart';
|
||||
|
@ -20,8 +19,10 @@ class RestoreChest extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final genW = Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
GenerateWalletsProvider genW =
|
||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
genW.actualWallet = null;
|
||||
if (genW.isSentenceComplete(context)) {
|
||||
|
@ -156,7 +157,7 @@ class RestoreChest extends StatelessWidget {
|
|||
)
|
||||
])
|
||||
]),
|
||||
const OfflineInfo(),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
),
|
||||
),
|
||||
|
@ -182,7 +183,7 @@ class RestoreChest extends StatelessWidget {
|
|||
}
|
||||
|
||||
Widget arrayCell(BuildContext context, TextEditingController cellCtl) {
|
||||
final generateWalletProvider =
|
||||
GenerateWalletsProvider generateWalletProvider =
|
||||
Provider.of<GenerateWalletsProvider>(context);
|
||||
|
||||
return Container(
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:gecko/widgets/commons/build_text.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:pdf/pdf.dart';
|
||||
import 'package:printing/printing.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
@ -25,9 +23,12 @@ class ShowSeed extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final myWalletProvider =
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
CommonElements common = CommonElements();
|
||||
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
WalletData defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
|
||||
|
@ -44,7 +45,7 @@ class ShowSeed extends StatelessWidget {
|
|||
const Spacer(flex: 1),
|
||||
FutureBuilder(
|
||||
future:
|
||||
sub.getSeed(defaultWallet.address, walletProvider.pinCode),
|
||||
sub.getSeed(defaultWallet.address!, walletProvider.pinCode),
|
||||
builder: (BuildContext context, AsyncSnapshot<String?> seed) {
|
||||
if (seed.connectionState != ConnectionState.done ||
|
||||
seed.hasError) {
|
||||
|
@ -64,7 +65,7 @@ class ShowSeed extends StatelessWidget {
|
|||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Column(children: [
|
||||
BuildText(text: 'keepYourMnemonicSecret'.tr()),
|
||||
common.buildText('keepYourMnemonicSecret'.tr()),
|
||||
SizedBox(height: 35 * ratio),
|
||||
sentanceArray(context, seed.data!.split(' ')),
|
||||
const SizedBox(height: 20),
|
||||
|
@ -82,7 +83,7 @@ class ShowSeed extends StatelessWidget {
|
|||
onPressed: () {
|
||||
Clipboard.setData(
|
||||
ClipboardData(text: seed.data));
|
||||
snackCopySeed(context);
|
||||
snackCopyKey(context);
|
||||
},
|
||||
child: Row(children: <Widget>[
|
||||
Image.asset(
|
||||
|
@ -140,6 +141,16 @@ class ShowSeed extends StatelessWidget {
|
|||
));
|
||||
}
|
||||
|
||||
snackCopyKey(context) {
|
||||
const snackBar = SnackBar(
|
||||
padding: EdgeInsets.all(20),
|
||||
content: Text(
|
||||
"Votre phrase de restauration a été copié dans votre presse-papier.",
|
||||
style: TextStyle(fontSize: 16)),
|
||||
duration: Duration(seconds: 2));
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
}
|
||||
|
||||
Widget sentanceArray(BuildContext context, List mnemonic) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 3),
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import 'dart:async';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/models/chest_data.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
|
@ -22,8 +22,6 @@ class UnlockingWallet extends StatelessWidget {
|
|||
late int currentChestNumber;
|
||||
late ChestData currentChest;
|
||||
bool canUnlock = true;
|
||||
TextEditingController enterPin = TextEditingController();
|
||||
FocusNode pinFocus = FocusNode(debugLabel: 'pinFocusNode');
|
||||
|
||||
// ignore: close_sinks
|
||||
StreamController<ErrorAnimationType>? errorController;
|
||||
|
@ -32,10 +30,10 @@ class UnlockingWallet extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
final myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
WalletOptionsProvider walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context);
|
||||
// final double statusBarHeight = MediaQuery.of(context).padding.top;
|
||||
|
||||
currentChestNumber = configBox.get('currentChest');
|
||||
currentChest = chestBox.get(currentChestNumber)!;
|
||||
|
@ -43,168 +41,154 @@ class UnlockingWallet extends StatelessWidget {
|
|||
int pinLenght = walletOptions.getPinLenght(wallet.number);
|
||||
errorController = StreamController<ErrorAnimationType>();
|
||||
|
||||
// if (enterPin.text == '') myWalletProvider.isPinLoading = true;
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () {
|
||||
myWalletProvider.isPinValid = false;
|
||||
myWalletProvider.isPinLoading = true;
|
||||
return Future<bool>.value(true);
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Stack(children: <Widget>[
|
||||
Positioned(
|
||||
top: 10, //statusBarHeight + 10,
|
||||
left: 15,
|
||||
child: Builder(
|
||||
builder: (context) => IconButton(
|
||||
key: keyPopButton,
|
||||
icon: const Icon(
|
||||
Icons.arrow_back,
|
||||
color: Colors.black,
|
||||
size: 30,
|
||||
),
|
||||
onPressed: () {
|
||||
myWalletProvider.isPinValid = false;
|
||||
myWalletProvider.isPinLoading = true;
|
||||
Navigator.pop(context);
|
||||
},
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Stack(children: <Widget>[
|
||||
Positioned(
|
||||
top: 10, //statusBarHeight + 10,
|
||||
left: 15,
|
||||
child: Builder(
|
||||
builder: (context) => IconButton(
|
||||
key: keyPopButton,
|
||||
icon: const Icon(
|
||||
Icons.arrow_back,
|
||||
color: Colors.black,
|
||||
size: 30,
|
||||
),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
),
|
||||
Column(children: <Widget>[
|
||||
SizedBox(height: isTall ? 100 : 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
currentChest.imageFile == null
|
||||
? Image.asset(
|
||||
'assets/chests/${currentChest.imageName}',
|
||||
width: isTall ? 130 : 100,
|
||||
)
|
||||
: Image.file(
|
||||
currentChest.imageFile!,
|
||||
width: isTall ? 130 : 100,
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
SizedBox(
|
||||
width: 250,
|
||||
child: Text(
|
||||
currentChest.name!,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
fontSize: 25,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w700),
|
||||
)),
|
||||
]),
|
||||
SizedBox(height: 30 * ratio),
|
||||
SizedBox(
|
||||
width: 400,
|
||||
child: Text(
|
||||
'toUnlockEnterPassword'.tr(),
|
||||
style: const TextStyle(
|
||||
fontSize: 19,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w400),
|
||||
)),
|
||||
SizedBox(height: 30 * ratio),
|
||||
if (!myWalletProvider.isPinValid &&
|
||||
!myWalletProvider.isPinLoading)
|
||||
Text(
|
||||
"Ce n'est pas le bon code".tr(),
|
||||
style: const TextStyle(
|
||||
color: Colors.red, fontWeight: FontWeight.w500),
|
||||
),
|
||||
SizedBox(height: 10 * ratio),
|
||||
pinForm(context, pinLenght),
|
||||
SizedBox(height: 3 * ratio),
|
||||
if (canUnlock)
|
||||
Consumer<WalletOptionsProvider>(
|
||||
builder: (context, sub, _) {
|
||||
return InkWell(
|
||||
key: keyCachePassword,
|
||||
onTap: () {
|
||||
walletOptions.changePinCacheChoice();
|
||||
},
|
||||
child: Row(children: [
|
||||
const SizedBox(height: 30),
|
||||
const Spacer(),
|
||||
Icon(
|
||||
configBox.get('isCacheChecked')
|
||||
? Icons.check_box
|
||||
: Icons.check_box_outline_blank,
|
||||
color: orangeC,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'rememberPassword'.tr(),
|
||||
style: TextStyle(
|
||||
fontSize: 16, color: Colors.grey[700]),
|
||||
),
|
||||
const Spacer()
|
||||
]),
|
||||
);
|
||||
}),
|
||||
const SizedBox(height: 10),
|
||||
// if (canUnlock)
|
||||
InkWell(
|
||||
key: keyChangeChest,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const ChooseChest();
|
||||
}),
|
||||
);
|
||||
},
|
||||
child: SizedBox(
|
||||
width: 400,
|
||||
height: 50,
|
||||
child: Center(
|
||||
),
|
||||
Column(children: <Widget>[
|
||||
SizedBox(height: isTall ? 100 : 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
currentChest.imageFile == null
|
||||
? Image.asset(
|
||||
'assets/chests/${currentChest.imageName}',
|
||||
width: isTall ? 130 : 100,
|
||||
)
|
||||
: Image.file(
|
||||
currentChest.imageFile!,
|
||||
width: isTall ? 130 : 100,
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
SizedBox(
|
||||
width: 250,
|
||||
child: Text(
|
||||
'changeChest'.tr(),
|
||||
currentChest.name!,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
color: orangeC,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
fontSize: 25,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w700),
|
||||
)),
|
||||
]),
|
||||
SizedBox(height: 30 * ratio),
|
||||
SizedBox(
|
||||
width: 400,
|
||||
child: Text(
|
||||
'toUnlockEnterPassword'.tr(),
|
||||
style: const TextStyle(
|
||||
fontSize: 19,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w400),
|
||||
)),
|
||||
SizedBox(height: 40 * ratio),
|
||||
pinForm(context, pinLenght),
|
||||
SizedBox(height: 3 * ratio),
|
||||
if (canUnlock)
|
||||
InkWell(
|
||||
key: keyCachePassword,
|
||||
onTap: () {
|
||||
walletOptions.changePinCacheChoice();
|
||||
},
|
||||
child: Row(children: [
|
||||
const SizedBox(height: 30),
|
||||
const Spacer(),
|
||||
Icon(
|
||||
configBox.get('isCacheChecked')
|
||||
? Icons.check_box
|
||||
: Icons.check_box_outline_blank,
|
||||
color: orangeC,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'rememberPassword'.tr(),
|
||||
style: TextStyle(
|
||||
fontSize: 16, color: Colors.grey[700]),
|
||||
),
|
||||
const Spacer()
|
||||
]),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
// if (canUnlock)
|
||||
InkWell(
|
||||
key: keyChangeChest,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const ChooseChest();
|
||||
}),
|
||||
);
|
||||
},
|
||||
child: SizedBox(
|
||||
width: 400,
|
||||
height: 50,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'changeChest'.tr(),
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
color: orangeC,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
)),
|
||||
]),
|
||||
),
|
||||
)),
|
||||
]),
|
||||
]),
|
||||
)),
|
||||
);
|
||||
]),
|
||||
));
|
||||
}
|
||||
|
||||
Widget pinForm(context, pinLenght) {
|
||||
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
// var _walletPin = '';
|
||||
// ignore: close_sinks
|
||||
StreamController<ErrorAnimationType> errorController =
|
||||
StreamController<ErrorAnimationType>();
|
||||
TextEditingController enterPin = TextEditingController();
|
||||
WalletOptionsProvider walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
FocusNode pinFocus = FocusNode();
|
||||
|
||||
WalletData defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
|
||||
// if (defaultWallet.address == null) {
|
||||
// canUnlock = false;
|
||||
// return Text(
|
||||
// 'Impossible de retrouver votre\nportefeuille par défaut.\nID: ${defaultWallet.id()}',
|
||||
// textAlign: TextAlign.center,
|
||||
// style: const TextStyle(
|
||||
// color: Colors.redAccent, fontWeight: FontWeight.w500),
|
||||
// );
|
||||
// }
|
||||
// defaultWallet.address = null;
|
||||
if (defaultWallet.address == null) {
|
||||
canUnlock = false;
|
||||
return Text(
|
||||
'Impossible de retrouver votre\nportefeuille par défaut.\nID: ${defaultWallet.id()}',
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
color: Colors.redAccent, fontWeight: FontWeight.w500),
|
||||
);
|
||||
}
|
||||
|
||||
return Form(
|
||||
// key: keyPinForm,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 5 * ratio, horizontal: 30),
|
||||
child: PinCodeTextField(
|
||||
key: keyPinForm,
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
focusNode: pinFocus,
|
||||
autoFocus: true,
|
||||
appContext: context,
|
||||
|
@ -215,8 +199,7 @@ class UnlockingWallet extends StatelessWidget {
|
|||
length: pinLenght,
|
||||
obscureText: true,
|
||||
obscuringCharacter: '*',
|
||||
animationType: AnimationType.slide,
|
||||
animationDuration: const Duration(milliseconds: 40),
|
||||
animationType: AnimationType.fade,
|
||||
validator: (v) {
|
||||
if (v!.length < pinLenght) {
|
||||
return "yourPasswordLengthIsX".tr(args: [pinLenght.toString()]);
|
||||
|
@ -235,9 +218,11 @@ class UnlockingWallet extends StatelessWidget {
|
|||
),
|
||||
showCursor: kDebugMode ? false : true,
|
||||
cursorColor: Colors.black,
|
||||
textStyle: const TextStyle(fontSize: 27, height: 1.6),
|
||||
animationDuration: const Duration(milliseconds: 300),
|
||||
textStyle: const TextStyle(fontSize: 20, height: 1.6),
|
||||
backgroundColor: const Color(0xffF9F9F1),
|
||||
enableActiveFill: false,
|
||||
errorAnimationController: errorController,
|
||||
controller: enterPin,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
boxShadows: const [
|
||||
|
@ -248,32 +233,28 @@ class UnlockingWallet extends StatelessWidget {
|
|||
)
|
||||
],
|
||||
onCompleted: (pin) async {
|
||||
myWalletProvider.isPinLoading = true;
|
||||
myWalletProvider.pinCode = pin.toUpperCase();
|
||||
final isValid = await sub.checkPassword(
|
||||
defaultWallet.address, pin.toUpperCase());
|
||||
defaultWallet.address!, pin.toUpperCase());
|
||||
|
||||
if (!isValid) {
|
||||
await Future.delayed(const Duration(milliseconds: 20));
|
||||
await Future.delayed(const Duration(milliseconds: 50));
|
||||
errorController.add(ErrorAnimationType
|
||||
.shake); // Triggering error shake animation
|
||||
pinColor = Colors.red[600];
|
||||
myWalletProvider.isPinLoading = false;
|
||||
myWalletProvider.isPinValid = false;
|
||||
myWalletProvider.pinCode = myWalletProvider.mnemonic = '';
|
||||
enterPin.text = '';
|
||||
walletOptions.reload();
|
||||
pinFocus.requestFocus();
|
||||
} else {
|
||||
myWalletProvider.isPinValid = true;
|
||||
myWalletProvider.isPinLoading = false;
|
||||
pinColor = Colors.green[400];
|
||||
myWalletProvider.resetPinCode();
|
||||
Navigator.pop(context, pin.toUpperCase());
|
||||
}
|
||||
},
|
||||
onChanged: (value) {
|
||||
if (enterPin.text != '') myWalletProvider.isPinLoading = true;
|
||||
if (pinColor != const Color(0xFFA4B600)) {
|
||||
pinColor = const Color(0xFFA4B600);
|
||||
}
|
||||
myWalletProvider.reload();
|
||||
},
|
||||
)),
|
||||
);
|
||||
|
|
|
@ -2,28 +2,21 @@ import 'dart:async';
|
|||
import 'dart:io';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/providers/home.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:gecko/screens/certifications.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/activity.dart';
|
||||
import 'package:gecko/screens/myWallets/manage_membership.dart';
|
||||
import 'package:gecko/screens/qrcode_fullscreen.dart';
|
||||
import 'package:gecko/widgets/balance.dart';
|
||||
import 'package:gecko/widgets/bottom_app_bar.dart';
|
||||
import 'package:gecko/widgets/certifications.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
import 'package:gecko/widgets/idty_status.dart';
|
||||
import 'package:gecko/widgets/name_by_address.dart';
|
||||
import 'package:gecko/widgets/page_route_no_transition.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
|
||||
class WalletOptions extends StatelessWidget {
|
||||
|
@ -33,24 +26,25 @@ class WalletOptions extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final walletOptions =
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
WalletOptionsProvider walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
WalletsProfilesProvider historyProvider =
|
||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
final myWalletProvider =
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
HomeProvider homeProvider =
|
||||
Provider.of<HomeProvider>(context, listen: false);
|
||||
DuniterIndexer duniterIndexer =
|
||||
Provider.of<DuniterIndexer>(context, listen: false);
|
||||
|
||||
// final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
// SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
// sub.spawnBlock();
|
||||
// sub.spawnBlock(0, 20);
|
||||
|
||||
log.d(walletOptions.address.text);
|
||||
|
||||
final currentChest = myWalletProvider.getCurrentChest();
|
||||
bool isWalletNameIndexed =
|
||||
duniterIndexer.walletNameIndexer[walletOptions.address.text] != null;
|
||||
final int currentChest = myWalletProvider.getCurrentChest();
|
||||
|
||||
// final currentWallet = _myWalletProvider.getDefaultWallet();
|
||||
// log.d(_walletOptions.getAddress(_currentChest, 3));
|
||||
|
@ -82,10 +76,7 @@ class WalletOptions extends StatelessWidget {
|
|||
height: 22,
|
||||
child: Consumer<WalletOptionsProvider>(
|
||||
builder: (context, walletProvider, _) {
|
||||
return Text(isWalletNameIndexed
|
||||
? duniterIndexer
|
||||
.walletNameIndexer[walletOptions.address.text]!
|
||||
: wallet.name!);
|
||||
return Text(wallet.name!);
|
||||
}),
|
||||
),
|
||||
actions: [
|
||||
|
@ -108,7 +99,7 @@ class WalletOptions extends StatelessWidget {
|
|||
),
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: const GeckoBottomAppBar(),
|
||||
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||
body: Stack(children: [
|
||||
Builder(
|
||||
builder: (ctx) => SafeArea(
|
||||
|
@ -129,95 +120,44 @@ class WalletOptions extends StatelessWidget {
|
|||
backgroundColor,
|
||||
],
|
||||
)),
|
||||
child: Row(children: <Widget>[
|
||||
const Spacer(flex: 1),
|
||||
avatar(walletProvider),
|
||||
const Spacer(flex: 1),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Stack(children: [
|
||||
SizedBox(
|
||||
width: 250,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Consumer<WalletOptionsProvider>(
|
||||
builder: (context, walletProvider, _) {
|
||||
return NameByAddress(
|
||||
wallet: wallet,
|
||||
size: 27,
|
||||
color: Colors.black,
|
||||
fontWeight: wallet.isMember
|
||||
? FontWeight.w500
|
||||
: FontWeight.w400,
|
||||
fontStyle: FontStyle.normal);
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
if (duniterIndexer
|
||||
.walletNameIndexer[wallet.address] ==
|
||||
null)
|
||||
Positioned(
|
||||
right: 0,
|
||||
child: InkWell(
|
||||
key: keyRenameWallet,
|
||||
onTap: () async {
|
||||
await walletOptions.editWalletName(
|
||||
context, wallet.id());
|
||||
await Future.delayed(
|
||||
const Duration(milliseconds: 30));
|
||||
},
|
||||
child: ClipRRect(
|
||||
child: Image.asset(
|
||||
walletOptions.isEditing
|
||||
? 'assets/walletOptions/android-checkmark.png'
|
||||
: 'assets/walletOptions/edit.png',
|
||||
width: 25,
|
||||
height: 25),
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
SizedBox(height: isTall ? 5 : 0),
|
||||
Balance(
|
||||
address: walletProvider.address.text, size: 21),
|
||||
const SizedBox(width: 30),
|
||||
InkWell(
|
||||
onTap: () => isWalletNameIndexed
|
||||
? {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageNoTransit(builder: (context) {
|
||||
return CertificationsScreen(
|
||||
address:
|
||||
walletProvider.address.text,
|
||||
username: duniterIndexer
|
||||
.walletNameIndexer[
|
||||
walletProvider
|
||||
.address.text]!);
|
||||
}),
|
||||
),
|
||||
}
|
||||
: null,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
IdentityStatus(
|
||||
address: walletOptions.address.text,
|
||||
isOwner: true,
|
||||
color: orangeC),
|
||||
Certifications(
|
||||
address: walletProvider.address.text,
|
||||
size: 15)
|
||||
]),
|
||||
),
|
||||
SizedBox(height: 10 * ratio),
|
||||
]),
|
||||
const Spacer(flex: 2),
|
||||
]),
|
||||
child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
const Spacer(flex: 1),
|
||||
avatar(walletProvider),
|
||||
const Spacer(flex: 1),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
duniterIndexer.getNameByAddress(
|
||||
context,
|
||||
walletProvider.address.text,
|
||||
wallet,
|
||||
27,
|
||||
false,
|
||||
Colors.black,
|
||||
FontWeight.w400,
|
||||
FontStyle.normal),
|
||||
// SizedBox(height: isTall ? 5 : 0),
|
||||
|
||||
SizedBox(height: isTall ? 5 : 0),
|
||||
balance(
|
||||
context, walletProvider.address.text, 21),
|
||||
const SizedBox(width: 30),
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
walletOptions.idtyStatus(
|
||||
context, walletOptions.address.text,
|
||||
isOwner: true, color: orangeC),
|
||||
getCerts(context,
|
||||
walletProvider.address.text, 15),
|
||||
]),
|
||||
SizedBox(height: 10 * ratio),
|
||||
]),
|
||||
const Spacer(flex: 2),
|
||||
]),
|
||||
);
|
||||
}),
|
||||
Expanded(
|
||||
|
@ -261,8 +201,8 @@ class WalletOptions extends StatelessWidget {
|
|||
SizedBox(height: 17 * ratio),
|
||||
// walletProvider.isMember(context, _walletOptions.address.text)
|
||||
FutureBuilder(
|
||||
future:
|
||||
sub.isMember(walletOptions.address.text),
|
||||
future: walletProvider.isMember(
|
||||
context, walletOptions.address.text),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<bool> isMember) {
|
||||
if (isMember.connectionState !=
|
||||
|
@ -289,7 +229,7 @@ class WalletOptions extends StatelessWidget {
|
|||
]),
|
||||
),
|
||||
),
|
||||
const OfflineInfo(),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
@ -362,7 +302,7 @@ class WalletOptions extends StatelessWidget {
|
|||
foregroundColor: Colors.white, elevation: 4,
|
||||
backgroundColor: orangeC, // foreground
|
||||
),
|
||||
onPressed: () async {
|
||||
onPressed: () {
|
||||
walletProvider.confirmIdentityPopup(context);
|
||||
// Navigator.push(
|
||||
// context,
|
||||
|
@ -397,7 +337,7 @@ class WalletOptions extends StatelessWidget {
|
|||
}
|
||||
|
||||
Widget pubkeyWidget(WalletOptionsProvider walletProvider, BuildContext ctx) {
|
||||
final shortPubkey = getShortPubkey(walletProvider.address.text);
|
||||
final String shortPubkey = getShortPubkey(walletProvider.address.text);
|
||||
return GestureDetector(
|
||||
key: keyCopyAddress,
|
||||
onTap: () {
|
||||
|
@ -464,7 +404,7 @@ class WalletOptions extends StatelessWidget {
|
|||
// _historyProvider.nPage = 1;
|
||||
Navigator.push(
|
||||
context,
|
||||
PageNoTransit(builder: (context) {
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return ActivityScreen(
|
||||
address: walletProvider.address.text,
|
||||
avatar: wallet.imageCustomPath == null
|
||||
|
@ -497,7 +437,7 @@ class WalletOptions extends StatelessWidget {
|
|||
}
|
||||
|
||||
Widget manageMembership(BuildContext context) {
|
||||
final walletOptions =
|
||||
WalletOptionsProvider walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
return InkWell(
|
||||
key: keyManageMembership,
|
||||
|
@ -529,8 +469,8 @@ class WalletOptions extends StatelessWidget {
|
|||
Widget setDefaultWalletWidget(
|
||||
BuildContext context,
|
||||
WalletOptionsProvider walletProvider,
|
||||
final myWalletProvider,
|
||||
final walletOptions,
|
||||
MyWalletsProvider myWalletProvider,
|
||||
WalletOptionsProvider walletOptions,
|
||||
int currentChest) {
|
||||
return Consumer<MyWalletsProvider>(builder: (context, myWalletProvider, _) {
|
||||
WalletData defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
|
@ -571,10 +511,10 @@ class WalletOptions extends StatelessWidget {
|
|||
}
|
||||
|
||||
Future setDefaultWallet(BuildContext context, int currentChest) async {
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final myWalletProvider =
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
final walletOptions =
|
||||
WalletOptionsProvider walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
|
||||
// WalletData defaultWallet = _myWalletProvider.getDefaultWallet()!;
|
||||
|
@ -585,26 +525,26 @@ class WalletOptions extends StatelessWidget {
|
|||
walletOptions.reload();
|
||||
}
|
||||
|
||||
Widget deleteWallet(BuildContext context, WalletOptionsProvider walletOptions,
|
||||
int currentChest) {
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final myWalletProvider =
|
||||
Widget deleteWallet(BuildContext context,
|
||||
WalletOptionsProvider walletProvider, int currentChest) {
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
|
||||
final defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
final bool isDefaultWallet =
|
||||
walletOptions.address.text == defaultWallet.address;
|
||||
walletProvider.address.text == defaultWallet.address;
|
||||
// return Consumer<MyWalletsProvider>(
|
||||
// builder: (context, _myWalletProvider, _) {
|
||||
return FutureBuilder(
|
||||
future: sub.hasAccountConsumers(wallet.address),
|
||||
future: sub.hasAccountConsumers(wallet.address!),
|
||||
builder: (BuildContext context, AsyncSnapshot<bool> hasConsumers) {
|
||||
if (hasConsumers.connectionState != ConnectionState.done ||
|
||||
hasConsumers.hasError) {
|
||||
return const Text('');
|
||||
}
|
||||
final double balance =
|
||||
walletOptions.balanceCache[walletOptions.address.text] ?? -1;
|
||||
balanceCache[walletProvider.address.text] ?? -1;
|
||||
final bool canDelete = !isDefaultWallet &&
|
||||
!hasConsumers.data! &&
|
||||
(balance > 2 || balance == 0);
|
||||
|
@ -612,7 +552,7 @@ class WalletOptions extends StatelessWidget {
|
|||
key: keyDeleteWallet,
|
||||
onTap: canDelete
|
||||
? () async {
|
||||
await walletOptions.deleteWallet(context, wallet);
|
||||
await walletProvider.deleteWallet(context, wallet);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
myWalletProvider.listWallets =
|
||||
myWalletProvider.readAllWallets(currentChest);
|
||||
|
|
|
@ -1,77 +1,41 @@
|
|||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/chest_data.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/providers/home.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/myWallets/chest_options.dart';
|
||||
import 'package:gecko/screens/myWallets/choose_chest.dart';
|
||||
import 'package:gecko/screens/myWallets/import_g1_v1.dart';
|
||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||
import 'package:gecko/screens/myWallets/wallet_options.dart';
|
||||
import 'package:gecko/screens/wallet_view.dart';
|
||||
import 'package:gecko/widgets/balance.dart';
|
||||
import 'package:gecko/widgets/bottom_app_bar.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
import 'package:gecko/widgets/commons/smooth_transition.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:truncate/truncate.dart';
|
||||
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
|
||||
|
||||
class WalletsHome extends StatefulWidget {
|
||||
class WalletsHome extends StatelessWidget {
|
||||
const WalletsHome({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<WalletsHome> createState() => _WalletsHomeState();
|
||||
}
|
||||
|
||||
class _WalletsHomeState extends State<WalletsHome> {
|
||||
final safeKey = GlobalKey();
|
||||
// List<TargetFocus> targets = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// targets
|
||||
// .add(TargetFocus(identify: "Target 1", keyTarget: safeKey, contents: [
|
||||
// TargetContent(
|
||||
// align: ContentAlign.right,
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: const <Widget>[
|
||||
// Text(
|
||||
// "Titulo lorem ipsum",
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.bold,
|
||||
// color: Colors.white,
|
||||
// fontSize: 20.0),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: EdgeInsets.only(top: 10.0),
|
||||
// child: Text(
|
||||
// "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin pulvinar tortor eget maximus iaculis.",
|
||||
// style: TextStyle(color: Colors.white),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ))
|
||||
// ]));
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
HomeProvider homeProvider =
|
||||
Provider.of<HomeProvider>(context, listen: false);
|
||||
|
||||
final currentChestNumber = myWalletProvider.getCurrentChest();
|
||||
final int currentChestNumber = myWalletProvider.getCurrentChest();
|
||||
final ChestData currentChest = chestBox.get(currentChestNumber)!;
|
||||
myWalletProvider.listWallets =
|
||||
myWalletProvider.readAllWallets(currentChestNumber);
|
||||
|
@ -97,28 +61,17 @@ class _WalletsHomeState extends State<WalletsHome> {
|
|||
ModalRoute.withName('/'),
|
||||
);
|
||||
}),
|
||||
title: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/chests/${currentChest.imageName}',
|
||||
height: 32,
|
||||
),
|
||||
const SizedBox(width: 17),
|
||||
Text(currentChest.name!,
|
||||
style: TextStyle(color: Colors.grey[850])),
|
||||
],
|
||||
),
|
||||
title: Text(currentChest.name!,
|
||||
style: TextStyle(color: Colors.grey[850])),
|
||||
backgroundColor: const Color(0xffFFD58D),
|
||||
),
|
||||
bottomNavigationBar: myWalletProvider.lastFlyBy == ''
|
||||
? const GeckoBottomAppBar(
|
||||
actualRoute: 'safeHome',
|
||||
)
|
||||
? homeProvider.bottomAppBar(context)
|
||||
: dragInfo(context),
|
||||
body: SafeArea(
|
||||
child: Stack(children: [
|
||||
myWalletsTiles(context, currentChestNumber),
|
||||
const OfflineInfo(),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
),
|
||||
),
|
||||
|
@ -137,7 +90,7 @@ class _WalletsHomeState extends State<WalletsHome> {
|
|||
final bool isSameAddress =
|
||||
myWalletProvider.dragAddress == myWalletProvider.lastFlyBy;
|
||||
|
||||
final screenWidth = MediaQuery.of(homeContext).size.width;
|
||||
final double screenWidth = MediaQuery.of(homeContext).size.width;
|
||||
return Container(
|
||||
color: yellowC,
|
||||
width: screenWidth,
|
||||
|
@ -156,7 +109,8 @@ class _WalletsHomeState extends State<WalletsHome> {
|
|||
);
|
||||
}
|
||||
|
||||
Widget chestOptions(BuildContext context, final myWalletProvider) {
|
||||
Widget chestOptions(
|
||||
BuildContext context, MyWalletsProvider myWalletProvider) {
|
||||
return Column(children: [
|
||||
const SizedBox(height: 50),
|
||||
SizedBox(
|
||||
|
@ -187,58 +141,46 @@ class _WalletsHomeState extends State<WalletsHome> {
|
|||
),
|
||||
)),
|
||||
const SizedBox(height: 30),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
'assets/cesium_bw2.svg',
|
||||
semanticsLabel: 'CS',
|
||||
height: 50,
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
InkWell(
|
||||
key: keyImportG1v1,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const ImportG1v1();
|
||||
}),
|
||||
);
|
||||
},
|
||||
child: SizedBox(
|
||||
width: 350,
|
||||
height: 60,
|
||||
child: Center(
|
||||
child: Text('importG1v1'.tr(),
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
color: Colors.blue[900],
|
||||
fontWeight: FontWeight.w500))),
|
||||
),
|
||||
),
|
||||
],
|
||||
InkWell(
|
||||
key: keyImportG1v1,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const ImportG1v1();
|
||||
}),
|
||||
);
|
||||
},
|
||||
child: SizedBox(
|
||||
width: 400,
|
||||
height: 60,
|
||||
child: Center(
|
||||
child: Text('importG1v1'.tr(),
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
color: Colors.blue[900],
|
||||
fontWeight: FontWeight.w500))),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const SizedBox(height: 5),
|
||||
InkWell(
|
||||
key: keyChangeChest,
|
||||
onTap: null,
|
||||
// () {
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(builder: (context) {
|
||||
// return const ChooseChest();
|
||||
// }),
|
||||
// );
|
||||
// },
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const ChooseChest();
|
||||
}),
|
||||
);
|
||||
},
|
||||
child: SizedBox(
|
||||
width: 400,
|
||||
height: 60,
|
||||
child: Center(
|
||||
child: Text('changeChest'.tr(),
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
color: Colors.grey[500],
|
||||
color: orangeC,
|
||||
fontWeight: FontWeight.w500))),
|
||||
),
|
||||
),
|
||||
|
@ -247,12 +189,12 @@ class _WalletsHomeState extends State<WalletsHome> {
|
|||
}
|
||||
|
||||
Widget myWalletsTiles(BuildContext context, int currentChestNumber) {
|
||||
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
||||
final walletOptions =
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
WalletOptionsProvider walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
if (!isWalletsExists) {
|
||||
return const Text('');
|
||||
|
@ -269,31 +211,21 @@ class _WalletsHomeState extends State<WalletsHome> {
|
|||
]));
|
||||
}
|
||||
|
||||
// Get wallet list and sort by derivation number
|
||||
List<WalletData> listWallets = myWalletProvider.listWallets;
|
||||
listWallets.sort((p1, p2) {
|
||||
return Comparable.compare(p1.number!, p2.number!);
|
||||
});
|
||||
|
||||
List listWallets = myWalletProvider.listWallets;
|
||||
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
int nTule;
|
||||
final double screenWidth = MediaQuery.of(context).size.width;
|
||||
int nTule = 2;
|
||||
|
||||
if (screenWidth >= 900) {
|
||||
nTule = 4;
|
||||
} else if (screenWidth >= 650) {
|
||||
nTule = 3;
|
||||
} else {
|
||||
nTule = 2;
|
||||
}
|
||||
// Offset followDragAnchorStrategy(
|
||||
// Draggable<Object> d, BuildContext context, Offset point) {
|
||||
// return Offset(d.feedbackOffset.dx - 30, d.feedbackOffset.dy - 0);
|
||||
// }
|
||||
|
||||
// showTutorial();
|
||||
// Future.delayed(const Duration(seconds: 1), showTutorial);
|
||||
|
||||
return CustomScrollView(slivers: <Widget>[
|
||||
const SliverToBoxAdapter(child: SizedBox(height: 20)),
|
||||
SliverGrid.count(
|
||||
|
@ -303,17 +235,17 @@ class _WalletsHomeState extends State<WalletsHome> {
|
|||
crossAxisSpacing: 0,
|
||||
mainAxisSpacing: 0,
|
||||
children: <Widget>[
|
||||
for (WalletData repository in listWallets)
|
||||
for (WalletData repository in listWallets as Iterable<WalletData>)
|
||||
LongPressDraggable<String>(
|
||||
delay: const Duration(milliseconds: 200),
|
||||
data: repository.address,
|
||||
data: repository.address!,
|
||||
dragAnchorStrategy:
|
||||
(Draggable<Object> _, BuildContext __, Offset ___) =>
|
||||
const Offset(0, 0),
|
||||
// feedbackOffset: const Offset(-500, -500),
|
||||
// dragAnchorStrategy: childDragAnchorStrategy,
|
||||
onDragStarted: () =>
|
||||
myWalletProvider.dragAddress = repository.address,
|
||||
myWalletProvider.dragAddress = repository.address!,
|
||||
onDragEnd: (_) {
|
||||
myWalletProvider.lastFlyBy = '';
|
||||
myWalletProvider.dragAddress = '';
|
||||
|
@ -334,21 +266,21 @@ class _WalletsHomeState extends State<WalletsHome> {
|
|||
child: DragTarget<String>(
|
||||
onAccept: (senderAddress) async {
|
||||
log.d(
|
||||
'INTERPAY: sender: $senderAddress --- receiver: ${repository.address}');
|
||||
'INTERPAY: sender: $senderAddress --- receiver: ${repository.address!}');
|
||||
final walletData = myWalletProvider
|
||||
.getWalletDataByAddress(senderAddress);
|
||||
await sub.setCurrentWallet(walletData!);
|
||||
sub.reload();
|
||||
paymentPopup(context, repository.address);
|
||||
paymentPopup(context, repository.address!);
|
||||
},
|
||||
onMove: (details) {
|
||||
if (repository.address != myWalletProvider.lastFlyBy) {
|
||||
myWalletProvider.lastFlyBy = repository.address;
|
||||
if (repository.address! != myWalletProvider.lastFlyBy) {
|
||||
myWalletProvider.lastFlyBy = repository.address!;
|
||||
myWalletProvider.reload();
|
||||
}
|
||||
},
|
||||
onWillAccept: (senderAddress) =>
|
||||
senderAddress != repository.address,
|
||||
senderAddress != repository.address!,
|
||||
builder: (
|
||||
BuildContext context,
|
||||
List<dynamic> accepted,
|
||||
|
@ -357,7 +289,7 @@ class _WalletsHomeState extends State<WalletsHome> {
|
|||
return Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: GestureDetector(
|
||||
key: keyOpenWallet(repository.address),
|
||||
key: keyOpenWallet(repository.address!),
|
||||
onTap: () {
|
||||
walletOptions.getAddress(
|
||||
currentChestNumber, repository.derivation!);
|
||||
|
@ -385,15 +317,14 @@ class _WalletsHomeState extends State<WalletsHome> {
|
|||
child: Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
decoration: const BoxDecoration(
|
||||
gradient: RadialGradient(
|
||||
radius: 0.8,
|
||||
colors: [
|
||||
Color.fromARGB(255, 255, 255, 211),
|
||||
yellowC,
|
||||
],
|
||||
),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
gradient: RadialGradient(
|
||||
radius: 0.6,
|
||||
colors: [
|
||||
Colors.green[400]!,
|
||||
const Color(0xFFE7E7A6),
|
||||
],
|
||||
)),
|
||||
child:
|
||||
// SvgPicture.asset('assets/chopp-gecko2.png',
|
||||
// semanticsLabel: 'Gecko', height: 48),
|
||||
|
@ -419,46 +350,13 @@ class _WalletsHomeState extends State<WalletsHome> {
|
|||
),
|
||||
)),
|
||||
Stack(children: <Widget>[
|
||||
BalanceBuilder(
|
||||
address: repository.address,
|
||||
isDefault: repository.address ==
|
||||
balanceBuilder(
|
||||
context,
|
||||
repository.address!,
|
||||
repository.address ==
|
||||
defaultWallet.address),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
const SizedBox(height: 7),
|
||||
Opacity(
|
||||
opacity: 0.7,
|
||||
child: Text(
|
||||
duniterIndexer.walletNameIndexer[
|
||||
repository.address] ??
|
||||
truncate(
|
||||
repository.name!, 20),
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color:
|
||||
defaultWallet.address ==
|
||||
repository.address
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
)
|
||||
// NameByAddress(
|
||||
// wallet: repository,
|
||||
// address: repository.address,
|
||||
// size: 20,
|
||||
// color: defaultWallet.address ==
|
||||
// repository.address
|
||||
// ? Colors.white
|
||||
// : Colors.black,
|
||||
// ),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
nameBuilder(context, repository,
|
||||
defaultWallet, currentChestNumber),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
|
@ -477,8 +375,69 @@ class _WalletsHomeState extends State<WalletsHome> {
|
|||
]);
|
||||
}
|
||||
|
||||
Widget balanceBuilder(context, String address, bool isDefault) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
color: isDefault ? orangeC : yellowC,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 5, right: 5, top: 38),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
balance(
|
||||
context,
|
||||
address,
|
||||
15,
|
||||
isDefault ? Colors.white : Colors.black,
|
||||
isDefault ? yellowC : orangeC)
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget nameBuilder(BuildContext context, WalletData repository,
|
||||
WalletData defaultWallet, int currentChestNumber) {
|
||||
WalletOptionsProvider walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
DuniterIndexer duniterIndexer =
|
||||
Provider.of<DuniterIndexer>(context, listen: false);
|
||||
return ListTile(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(bottom: Radius.circular(12))),
|
||||
tileColor: repository.address == defaultWallet.address
|
||||
? orangeC
|
||||
: const Color(0xffFFD58D),
|
||||
title: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 5, right: 5, bottom: 35, top: 5),
|
||||
child: duniterIndexer.getNameByAddress(
|
||||
context,
|
||||
repository.address!,
|
||||
repository,
|
||||
20,
|
||||
true,
|
||||
repository.id()[1] == defaultWallet.id()[1]
|
||||
? const Color(0xffF9F9F1)
|
||||
: Colors.black),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
walletOptions.getAddress(currentChestNumber, repository.derivation!);
|
||||
Navigator.push(
|
||||
context,
|
||||
SmoothTransition(
|
||||
page: WalletOptions(
|
||||
wallet: repository,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget addNewDerivation(context) {
|
||||
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
|
||||
String newDerivationName =
|
||||
'${'wallet'.tr()} ${myWalletProvider.listWallets.last.number! + 2}';
|
||||
|
@ -538,41 +497,6 @@ class _WalletsHomeState extends State<WalletsHome> {
|
|||
}
|
||||
}
|
||||
|
||||
class BalanceBuilder extends StatelessWidget {
|
||||
const BalanceBuilder({
|
||||
Key? key,
|
||||
required this.address,
|
||||
required this.isDefault,
|
||||
}) : super(key: key);
|
||||
|
||||
final String address;
|
||||
final bool isDefault;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
color: isDefault ? orangeC : yellowC,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 5, right: 5, top: 38, bottom: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Opacity(
|
||||
opacity: 0.7,
|
||||
child: Balance(
|
||||
address: address,
|
||||
size: 16,
|
||||
color: isDefault ? Colors.white : Colors.black,
|
||||
loadingColor: isDefault ? yellowC : orangeC),
|
||||
)
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CustomClipperOval extends CustomClipper<Rect> {
|
||||
@override
|
||||
Rect getClip(Size size) {
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/cesium_plus.dart';
|
||||
import 'package:gecko/models/g1_wallets_list.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/providers/home.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:gecko/widgets/bottom_app_bar.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
import 'package:gecko/widgets/contacts_list.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/wallet_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ContactsScreen extends StatelessWidget {
|
||||
|
@ -14,12 +19,24 @@ class ContactsScreen extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
CesiumPlusProvider cesiumPlusProvider =
|
||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||
WalletsProfilesProvider walletsProfilesClass =
|
||||
Provider.of<WalletsProfilesProvider>(context, listen: true);
|
||||
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
|
||||
HomeProvider homeProvider =
|
||||
Provider.of<HomeProvider>(context, listen: false);
|
||||
DuniterIndexer duniterIndexer =
|
||||
Provider.of<DuniterIndexer>(context, listen: false);
|
||||
|
||||
double avatarSize = 55;
|
||||
|
||||
final myContacts = contactsBox.toMap().values.toList();
|
||||
|
||||
// for (var element in myContacts) {
|
||||
// log.d('yooo: ${element.pubkey} ${element.username}');
|
||||
// }
|
||||
|
||||
myContacts.sort((p1, p2) {
|
||||
return Comparable.compare(p1.username?.toLowerCase() ?? 'zz',
|
||||
p2.username?.toLowerCase() ?? 'zz');
|
||||
|
@ -36,15 +53,87 @@ class ContactsScreen extends StatelessWidget {
|
|||
'contactsManagementWithNbr'.tr(args: ['${myContacts.length}'])),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: const GeckoBottomAppBar(),
|
||||
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||
body: SafeArea(
|
||||
child: Stack(children: [
|
||||
ContactsList(
|
||||
myContacts: myContacts,
|
||||
avatarSize: avatarSize,
|
||||
walletsProfilesClass: walletsProfilesClass,
|
||||
duniterIndexer: duniterIndexer),
|
||||
const OfflineInfo(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
const SizedBox(height: 20),
|
||||
if (myContacts.isEmpty)
|
||||
Text('noContacts'.tr())
|
||||
else
|
||||
Expanded(
|
||||
child: ListView(children: <Widget>[
|
||||
for (G1WalletsList g1Wallet in myContacts)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5),
|
||||
child: ListTile(
|
||||
key: keySearchResult('keyID++'),
|
||||
horizontalTitleGap: 40,
|
||||
contentPadding: const EdgeInsets.all(5),
|
||||
leading: cesiumPlusProvider
|
||||
.defaultAvatar(avatarSize),
|
||||
title: Row(children: <Widget>[
|
||||
Text(getShortPubkey(g1Wallet.address),
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Monospace',
|
||||
fontWeight: FontWeight.w500),
|
||||
textAlign: TextAlign.center),
|
||||
]),
|
||||
trailing: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 110,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.end,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
balance(context,
|
||||
g1Wallet.address, 16),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
]),
|
||||
subtitle: Row(children: <Widget>[
|
||||
duniterIndexer.getNameByAddress(
|
||||
context, g1Wallet.address)
|
||||
]),
|
||||
dense: false,
|
||||
isThreeLine: false,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
walletsProfilesClass.address =
|
||||
g1Wallet.address;
|
||||
return WalletViewScreen(
|
||||
address: g1Wallet.address,
|
||||
username: g1WalletsBox
|
||||
.get(g1Wallet.address)
|
||||
?.id
|
||||
?.username,
|
||||
avatar: g1WalletsBox
|
||||
.get(g1Wallet.address)
|
||||
?.avatar,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}),
|
||||
),
|
||||
]),
|
||||
)
|
||||
]),
|
||||
),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
// ignore_for_file: file_names
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/onBoarding/2.dart';
|
||||
import 'package:gecko/widgets/commons/intro_info.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
|
||||
class OnboardingStepOne extends StatelessWidget {
|
||||
const OnboardingStepOne({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
CommonElements common = CommonElements();
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
appBar: AppBar(
|
||||
|
@ -27,15 +28,16 @@ class OnboardingStepOne extends StatelessWidget {
|
|||
extendBodyBehindAppBar: true,
|
||||
body: SafeArea(
|
||||
child: Stack(children: [
|
||||
InfoIntro(
|
||||
text: 'geckoGenerateYourWalletFromMnemonic'.tr(),
|
||||
assetName: 'fabrication-de-portefeuille.png',
|
||||
buttonText: '>',
|
||||
nextScreen: const OnboardingStepTwo(),
|
||||
pagePosition: 0,
|
||||
common.infoIntro(
|
||||
context,
|
||||
'geckoGenerateYourWalletFromMnemonic'.tr(),
|
||||
'fabrication-de-portefeuille.png',
|
||||
'>',
|
||||
const OnboardingStepTwo(),
|
||||
0,
|
||||
isMd: true,
|
||||
),
|
||||
const OfflineInfo(),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import 'dart:async';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
|
@ -13,11 +13,8 @@ import 'package:gecko/providers/generate_wallets.dart';
|
|||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/widgets/commons/build_progress_bar.dart';
|
||||
import 'package:gecko/widgets/commons/build_text.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/onBoarding/11_congratulations.dart';
|
||||
import 'package:gecko/widgets/commons/fader_transition.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
import 'package:pin_code_fields/pin_code_fields.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
|
@ -29,149 +26,126 @@ class OnboardingStepTen extends StatelessWidget {
|
|||
final formKey = GlobalKey<FormState>();
|
||||
Color? pinColor = const Color(0xFFA4B600);
|
||||
bool hasError = false;
|
||||
TextEditingController enterPin = TextEditingController();
|
||||
FocusNode pinFocus = FocusNode(debugLabel: 'pinFocusNode');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final generateWalletProvider =
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
GenerateWalletsProvider generateWalletProvider =
|
||||
Provider.of<GenerateWalletsProvider>(context);
|
||||
final walletOptions = Provider.of<WalletOptionsProvider>(context);
|
||||
final sub = Provider.of<SubstrateSdk>(context);
|
||||
final myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
final pinLenght = generateWalletProvider.pin.text.length;
|
||||
WalletOptionsProvider walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context);
|
||||
CommonElements common = CommonElements();
|
||||
final int pinLenght = generateWalletProvider.pin.text.length;
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () {
|
||||
myWalletProvider.isPinValid = false;
|
||||
myWalletProvider.isPinLoading = true;
|
||||
return Future<bool>.value(true);
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
appBar: AppBar(
|
||||
toolbarHeight: 60 * ratio,
|
||||
title: SizedBox(
|
||||
height: 22,
|
||||
child: Text(
|
||||
'myPassword'.tr(),
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
appBar: AppBar(
|
||||
toolbarHeight: 60 * ratio,
|
||||
title: SizedBox(
|
||||
height: 22,
|
||||
child: Text(
|
||||
'myPassword'.tr(),
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
||||
onPressed: () {
|
||||
myWalletProvider.isPinValid = false;
|
||||
myWalletProvider.isPinLoading = true;
|
||||
Navigator.of(context).pop();
|
||||
}),
|
||||
),
|
||||
extendBodyBehindAppBar: true,
|
||||
body: SafeArea(
|
||||
child: Stack(children: [
|
||||
Column(children: <Widget>[
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
const BuildProgressBar(pagePosition: 9),
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
BuildText(text: "geckoWillCheckPassword".tr()),
|
||||
SizedBox(height: isTall ? 60 : 10),
|
||||
Visibility(
|
||||
visible: generateWalletProvider.scanedValidWalletNumber != -1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 15),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("derivationsScanProgress".tr(args: [
|
||||
'${generateWalletProvider.scanedWalletNumber}',
|
||||
'${generateWalletProvider.numberScan + 1}'
|
||||
])),
|
||||
const SizedBox(width: 10),
|
||||
const SizedBox(
|
||||
height: 22,
|
||||
width: 22,
|
||||
child: CircularProgressIndicator(
|
||||
color: orangeC,
|
||||
strokeWidth: 3,
|
||||
),
|
||||
),
|
||||
extendBodyBehindAppBar: true,
|
||||
body: SafeArea(
|
||||
child: Stack(children: [
|
||||
Column(children: <Widget>[
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
common.buildProgressBar(9),
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
common.buildText("geckoWillCheckPassword".tr()),
|
||||
SizedBox(height: isTall ? 80 : 20),
|
||||
Visibility(
|
||||
visible: generateWalletProvider.scanedValidWalletNumber != -1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 15),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("derivationsScanProgress".tr(args: [
|
||||
'${generateWalletProvider.scanedWalletNumber}',
|
||||
'${generateWalletProvider.numberScan + 1}'
|
||||
])),
|
||||
const SizedBox(width: 10),
|
||||
const SizedBox(
|
||||
height: 22,
|
||||
width: 22,
|
||||
child: CircularProgressIndicator(
|
||||
color: orangeC,
|
||||
strokeWidth: 3,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Consumer<MyWalletsProvider>(builder: (context, mw, _) {
|
||||
return Visibility(
|
||||
visible: !myWalletProvider.isPinValid &&
|
||||
!myWalletProvider.isPinLoading,
|
||||
child: Text(
|
||||
"Ce n'est pas le bon code".tr(),
|
||||
style: const TextStyle(
|
||||
color: Colors.red, fontWeight: FontWeight.w500),
|
||||
),
|
||||
);
|
||||
}),
|
||||
SizedBox(height: isTall ? 20 : 10),
|
||||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
return sub.nodeConnected
|
||||
? pinForm(context, walletOptions, pinLenght, 1, 2)
|
||||
: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const [
|
||||
Text(
|
||||
'Vous devez vous connecter à internet\npour valider votre coffre',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color: Colors.redAccent,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
]);
|
||||
}),
|
||||
Consumer<WalletOptionsProvider>(
|
||||
builder: (context, walletOptions, _) {
|
||||
return sub.nodeConnected
|
||||
? InkWell(
|
||||
key: keyCachePassword,
|
||||
onTap: () {
|
||||
walletOptions.changePinCacheChoice();
|
||||
},
|
||||
child: Row(children: [
|
||||
const SizedBox(height: 30),
|
||||
const Spacer(),
|
||||
Icon(
|
||||
configBox.get('isCacheChecked') ?? false
|
||||
? Icons.check_box
|
||||
: Icons.check_box_outline_blank,
|
||||
color: orangeC,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
),
|
||||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
return sub.nodeConnected
|
||||
? pinForm(context, walletOptions, pinLenght, 1, 2)
|
||||
: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const [
|
||||
Text(
|
||||
'rememberPassword'.tr(),
|
||||
'Vous devez vous connecter à internet\npour valider votre coffre',
|
||||
style: TextStyle(
|
||||
fontSize: 16, color: Colors.grey[700]),
|
||||
fontSize: 20,
|
||||
color: Colors.redAccent,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const Spacer()
|
||||
]))
|
||||
: const Text('');
|
||||
}),
|
||||
const SizedBox(height: 10),
|
||||
]),
|
||||
const OfflineInfo(),
|
||||
]);
|
||||
}),
|
||||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
return sub.nodeConnected
|
||||
? InkWell(
|
||||
key: keyCachePassword,
|
||||
onTap: () {
|
||||
walletOptions.changePinCacheChoice();
|
||||
},
|
||||
child: Row(children: [
|
||||
const SizedBox(height: 30),
|
||||
const Spacer(),
|
||||
Icon(
|
||||
configBox.get('isCacheChecked') ?? false
|
||||
? Icons.check_box
|
||||
: Icons.check_box_outline_blank,
|
||||
color: orangeC,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'rememberPassword'.tr(),
|
||||
style: TextStyle(
|
||||
fontSize: 16, color: Colors.grey[700]),
|
||||
),
|
||||
const Spacer()
|
||||
]))
|
||||
: const Text('');
|
||||
}),
|
||||
const SizedBox(height: 10),
|
||||
]),
|
||||
)),
|
||||
);
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
));
|
||||
}
|
||||
|
||||
Widget pinForm(
|
||||
context, final walletOptions, pinLenght, int walletNbr, int derivation) {
|
||||
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
||||
final generateWalletProvider =
|
||||
Widget pinForm(context, WalletOptionsProvider walletOptions, pinLenght,
|
||||
int walletNbr, int derivation) {
|
||||
// var _walletPin = '';
|
||||
// ignore: close_sinks
|
||||
StreamController<ErrorAnimationType> errorController =
|
||||
StreamController<ErrorAnimationType>();
|
||||
TextEditingController enterPin = TextEditingController();
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
GenerateWalletsProvider generateWalletProvider =
|
||||
Provider.of<GenerateWalletsProvider>(context);
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
final currentChest = myWalletProvider.getCurrentChest();
|
||||
final int currentChest = myWalletProvider.getCurrentChest();
|
||||
|
||||
return Form(
|
||||
key: formKey,
|
||||
|
@ -179,9 +153,6 @@ class OnboardingStepTen extends StatelessWidget {
|
|||
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 30),
|
||||
child: PinCodeTextField(
|
||||
key: keyPinForm,
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
// autoDisposeControllers: false,
|
||||
focusNode: pinFocus,
|
||||
autoFocus: true,
|
||||
appContext: context,
|
||||
pastedTextStyle: TextStyle(
|
||||
|
@ -191,8 +162,7 @@ class OnboardingStepTen extends StatelessWidget {
|
|||
length: pinLenght,
|
||||
obscureText: true,
|
||||
obscuringCharacter: '*',
|
||||
animationType: AnimationType.slide,
|
||||
animationDuration: const Duration(milliseconds: 40),
|
||||
animationType: AnimationType.fade,
|
||||
validator: (v) {
|
||||
if (v!.length < pinLenght) {
|
||||
return "yourPasswordLengthIsX".tr(args: [pinLenght.toString()]);
|
||||
|
@ -205,15 +175,17 @@ class OnboardingStepTen extends StatelessWidget {
|
|||
borderWidth: 4,
|
||||
shape: PinCodeFieldShape.box,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
fieldHeight: 50 * ratio,
|
||||
fieldHeight: 60,
|
||||
fieldWidth: 50,
|
||||
activeFillColor: Colors.black,
|
||||
activeFillColor: hasError ? Colors.blueAccent : Colors.black,
|
||||
),
|
||||
showCursor: kDebugMode ? false : true,
|
||||
cursorColor: Colors.black,
|
||||
textStyle: const TextStyle(fontSize: 27, height: 1.6),
|
||||
animationDuration: const Duration(milliseconds: 300),
|
||||
textStyle: const TextStyle(fontSize: 20, height: 1.6),
|
||||
backgroundColor: const Color(0xffF9F9F1),
|
||||
enableActiveFill: false,
|
||||
errorAnimationController: errorController,
|
||||
controller: enterPin,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
boxShadows: const [
|
||||
|
@ -229,8 +201,6 @@ class OnboardingStepTen extends StatelessWidget {
|
|||
log.d('$pin || ${generateWalletProvider.pin.text}');
|
||||
if (pin.toUpperCase() == generateWalletProvider.pin.text) {
|
||||
pinColor = Colors.green[500];
|
||||
myWalletProvider.isPinLoading = false;
|
||||
myWalletProvider.isPinValid = true;
|
||||
|
||||
await generateWalletProvider.storeHDWChest(context);
|
||||
bool isAlive = false;
|
||||
|
@ -244,14 +214,14 @@ class OnboardingStepTen extends StatelessWidget {
|
|||
derivePath: '//2',
|
||||
password: generateWalletProvider.pin.text);
|
||||
WalletData myWallet = WalletData(
|
||||
version: dataVersion,
|
||||
chest: configBox.get('currentChest'),
|
||||
address: address,
|
||||
number: 0,
|
||||
name: 'currentWallet'.tr(),
|
||||
derivation: 2,
|
||||
imageDefaultPath: '0.png',
|
||||
isOwned: true);
|
||||
await walletBox.put(myWallet.address, myWallet);
|
||||
imageDefaultPath: '0.png');
|
||||
await walletBox.add(myWallet);
|
||||
}
|
||||
myWalletProvider.readAllWallets(currentChest);
|
||||
myWalletProvider.reload();
|
||||
|
@ -265,21 +235,17 @@ class OnboardingStepTen extends StatelessWidget {
|
|||
page: const OnboardingStepEleven(), isFast: false),
|
||||
);
|
||||
} else {
|
||||
errorController.add(ErrorAnimationType
|
||||
.shake); // Triggering error shake animation
|
||||
hasError = true;
|
||||
myWalletProvider.isPinLoading = false;
|
||||
myWalletProvider.isPinValid = false;
|
||||
pinColor = Colors.red[600];
|
||||
enterPin.text = '';
|
||||
// myWalletProvider.reload();
|
||||
pinFocus.requestFocus();
|
||||
walletOptions.reload();
|
||||
}
|
||||
},
|
||||
onChanged: (value) {
|
||||
if (enterPin.text != '') myWalletProvider.isPinLoading = true;
|
||||
if (pinColor != const Color(0xFFA4B600)) {
|
||||
pinColor = const Color(0xFFA4B600);
|
||||
}
|
||||
myWalletProvider.reload();
|
||||
},
|
||||
)),
|
||||
);
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
// ignore_for_file: file_names
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/widgets/commons/build_text.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
|
||||
class OnboardingStepEleven extends StatelessWidget {
|
||||
const OnboardingStepEleven({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
CommonElements common = CommonElements();
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
appBar: AppBar(
|
||||
|
@ -28,7 +31,7 @@ class OnboardingStepEleven extends StatelessWidget {
|
|||
body: SafeArea(
|
||||
child: Column(children: <Widget>[
|
||||
const SizedBox(height: 40),
|
||||
BuildText(text: "yourChestAndWalletWereCreatedSuccessfully".tr()),
|
||||
common.buildText("yourChestAndWalletWereCreatedSuccessfully".tr()),
|
||||
SizedBox(height: isTall ? 20 : 10),
|
||||
Image.asset(
|
||||
'assets/onBoarding/gecko-clin.gif',
|
||||
|
@ -56,8 +59,22 @@ Widget finishButton(BuildContext context) {
|
|||
backgroundColor: orangeC, // foreground
|
||||
),
|
||||
onPressed: () {
|
||||
//TODO: fix bad widget ancestor when pupUntil (multi_chest test failed)
|
||||
|
||||
// Navigator.popUntil(homeContext, ModalRoute.withName('/'));
|
||||
// Navigator.of(homeContext, rootNavigator: true)
|
||||
// .popUntil(ModalRoute.withName('/'));
|
||||
// while (Navigator.of(homeContext).canPop()) {
|
||||
// Navigator.of(homeContext).pop();
|
||||
// }
|
||||
|
||||
// Navigator.pushNamed(homeContext, '/mywallets');
|
||||
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
context, '/mywallets', ModalRoute.withName('/'));
|
||||
context, '/mywallets', (route) => route.isFirst);
|
||||
|
||||
// Navigator.pushNamedAndRemoveUntil(
|
||||
// homeContext, '/mywallets', ModalRoute.withName('/'));
|
||||
},
|
||||
child: Text("accessMyChest".tr(),
|
||||
style:
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
// ignore_for_file: file_names
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/onBoarding/3.dart';
|
||||
import 'package:gecko/widgets/commons/intro_info.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
|
||||
class OnboardingStepTwo extends StatelessWidget {
|
||||
const OnboardingStepTwo({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
CommonElements common = CommonElements();
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
appBar: AppBar(
|
||||
|
@ -28,14 +30,14 @@ class OnboardingStepTwo extends StatelessWidget {
|
|||
extendBodyBehindAppBar: true,
|
||||
body: SafeArea(
|
||||
child: Stack(children: [
|
||||
InfoIntro(
|
||||
text: 'keepThisMnemonicSecure'.tr(),
|
||||
assetName:
|
||||
'fabrication-de-portefeuille-impossible-sans-phrase.png',
|
||||
buttonText: '>',
|
||||
nextScreen: const OnboardingStepThree(),
|
||||
pagePosition: 1),
|
||||
const OfflineInfo(),
|
||||
common.infoIntro(
|
||||
context,
|
||||
'keepThisMnemonicSecure'.tr(),
|
||||
'fabrication-de-portefeuille-impossible-sans-phrase.png',
|
||||
'>',
|
||||
const OnboardingStepThree(),
|
||||
1),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
// ignore_for_file: file_names
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/onBoarding/4.dart';
|
||||
import 'package:gecko/widgets/commons/intro_info.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
|
||||
class OnboardingStepThree extends StatelessWidget {
|
||||
const OnboardingStepThree({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
CommonElements common = CommonElements();
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
appBar: AppBar(
|
||||
|
@ -28,13 +30,9 @@ class OnboardingStepThree extends StatelessWidget {
|
|||
extendBodyBehindAppBar: true,
|
||||
body: SafeArea(
|
||||
child: Stack(children: [
|
||||
InfoIntro(
|
||||
text: 'warningForgotPassword'.tr(),
|
||||
assetName: 'forgot_password.png'.tr(),
|
||||
buttonText: '>',
|
||||
nextScreen: const OnboardingStepFor(),
|
||||
pagePosition: 2),
|
||||
const OfflineInfo(),
|
||||
common.infoIntro(context, 'warningForgotPassword'.tr(),
|
||||
'forgot_password.png'.tr(), '>', const OnboardingStepFor(), 2),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
// ignore_for_file: file_names
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/onBoarding/5.dart';
|
||||
import 'package:gecko/widgets/commons/intro_info.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
|
||||
class OnboardingStepFor extends StatelessWidget {
|
||||
const OnboardingStepFor({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
CommonElements common = CommonElements();
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
appBar: AppBar(
|
||||
|
@ -28,14 +30,15 @@ class OnboardingStepFor extends StatelessWidget {
|
|||
extendBodyBehindAppBar: true,
|
||||
body: SafeArea(
|
||||
child: Stack(children: [
|
||||
InfoIntro(
|
||||
text: 'itsTimeToUseAPenAndPaper'.tr(),
|
||||
assetName: 'gecko_also_can_forget.png'.tr(),
|
||||
buttonText: '>',
|
||||
nextScreen: const OnboardingStepFive(),
|
||||
pagePosition: 3,
|
||||
common.infoIntro(
|
||||
context,
|
||||
'itsTimeToUseAPenAndPaper'.tr(),
|
||||
'gecko_also_can_forget.png'.tr(),
|
||||
'>',
|
||||
const OnboardingStepFive(),
|
||||
3,
|
||||
isMd: true),
|
||||
const OfflineInfo(),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
// ignore_for_file: file_names
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/generate_wallets.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:gecko/widgets/commons/build_progress_bar.dart';
|
||||
import 'package:gecko/widgets/commons/build_text.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/onBoarding/6.dart';
|
||||
import 'package:gecko/widgets/commons/fader_transition.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
import 'package:printing/printing.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
|
@ -34,9 +29,12 @@ class OnboardingStepFive extends StatefulWidget {
|
|||
class _ChooseChestState extends State<OnboardingStepFive> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final generateWalletProvider =
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
GenerateWalletsProvider generateWalletProvider =
|
||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||
|
||||
final CommonElements common = CommonElements();
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
appBar: AppBar(
|
||||
|
@ -54,63 +52,26 @@ class _ChooseChestState extends State<OnboardingStepFive> {
|
|||
child: Stack(children: [
|
||||
Column(children: [
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
const BuildProgressBar(pagePosition: 4),
|
||||
common.buildProgressBar(4),
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
BuildText(text: 'geckoGeneratedYourMnemonicKeepItSecret'.tr()),
|
||||
common.buildText('geckoGeneratedYourMnemonicKeepItSecret'.tr()),
|
||||
SizedBox(height: 35 * ratio),
|
||||
sentanceArray(context),
|
||||
SizedBox(height: 17 * ratio),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
// const SizedBox(height: 10),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return PrintWallet(
|
||||
generateWalletProvider.generatedMnemonic);
|
||||
}),
|
||||
);
|
||||
},
|
||||
child: Image.asset(
|
||||
'assets/printer.png',
|
||||
height: 42 * ratio,
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 40,
|
||||
width: 120,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: Colors.black,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
backgroundColor: orangeC,
|
||||
elevation: 1, // foreground
|
||||
),
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(
|
||||
text: generateWalletProvider.generatedMnemonic));
|
||||
snackCopySeed(context);
|
||||
},
|
||||
child: Row(children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/walletOptions/copy-white.png',
|
||||
height: 25,
|
||||
),
|
||||
const SizedBox(width: 7),
|
||||
Text(
|
||||
'copy'.tr(),
|
||||
style: TextStyle(fontSize: 15, color: Colors.grey[50]),
|
||||
)
|
||||
]),
|
||||
),
|
||||
),
|
||||
],
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return PrintWallet(
|
||||
generateWalletProvider.generatedMnemonic);
|
||||
}),
|
||||
);
|
||||
},
|
||||
child: Image.asset(
|
||||
'assets/printer.png',
|
||||
height: 42 * ratio,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
Expanded(
|
||||
|
@ -143,7 +104,7 @@ class _ChooseChestState extends State<OnboardingStepFive> {
|
|||
const Spacer(),
|
||||
// SizedBox(height: 35 * ratio),
|
||||
]),
|
||||
const OfflineInfo(),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
@ -151,7 +112,7 @@ class _ChooseChestState extends State<OnboardingStepFive> {
|
|||
}
|
||||
|
||||
Widget sentanceArray(BuildContext context) {
|
||||
final generateWalletProvider =
|
||||
GenerateWalletsProvider generateWalletProvider =
|
||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||
|
||||
return Padding(
|
||||
|
@ -228,7 +189,7 @@ class PrintWallet extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final generateWalletProvider =
|
||||
GenerateWalletsProvider generateWalletProvider =
|
||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
|
@ -261,9 +222,9 @@ class PrintWallet extends StatelessWidget {
|
|||
|
||||
Widget nextButton(
|
||||
BuildContext context, String text, bool isFast, bool skipIntro) {
|
||||
final generateWalletProvider =
|
||||
GenerateWalletsProvider generateWalletProvider =
|
||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||
final myWalletProvider =
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
return SizedBox(
|
||||
width: 380 * ratio,
|
||||
|
|
|
@ -2,17 +2,14 @@
|
|||
// ignore_for_file: must_be_immutable
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/generate_wallets.dart';
|
||||
import 'package:gecko/widgets/commons/build_progress_bar.dart';
|
||||
import 'package:gecko/widgets/commons/build_text.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/onBoarding/7.dart';
|
||||
import 'package:gecko/screens/onBoarding/9.dart';
|
||||
import 'package:gecko/widgets/commons/fader_transition.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class OnboardingStepSix extends StatelessWidget {
|
||||
|
@ -27,9 +24,11 @@ class OnboardingStepSix extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final generateWalletProvider =
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
GenerateWalletsProvider generateWalletProvider =
|
||||
Provider.of<GenerateWalletsProvider>(context, listen: true);
|
||||
|
||||
CommonElements common = CommonElements();
|
||||
_mnemonicController.text = generatedMnemonic!;
|
||||
|
||||
return WillPopScope(
|
||||
|
@ -58,14 +57,14 @@ class OnboardingStepSix extends StatelessWidget {
|
|||
alignment: Alignment.topCenter,
|
||||
child: Column(children: [
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
const BuildProgressBar(pagePosition: 5),
|
||||
common.buildProgressBar(5),
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
BuildText(
|
||||
text: "didYouNoteMnemonicToBeSureTypeWord".tr(args: [
|
||||
common.buildText(
|
||||
"didYouNoteMnemonicToBeSureTypeWord".tr(args: [
|
||||
(generateWalletProvider.nbrWord + 1).toString()
|
||||
]),
|
||||
size: 20,
|
||||
isMd: true),
|
||||
20,
|
||||
true),
|
||||
SizedBox(height: isTall ? 70 : 20),
|
||||
Text('${generateWalletProvider.nbrWord + 1}',
|
||||
key: keyAskedWord,
|
||||
|
@ -137,7 +136,7 @@ class OnboardingStepSix extends StatelessWidget {
|
|||
SizedBox(height: 35 * ratio),
|
||||
]),
|
||||
),
|
||||
const OfflineInfo(),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
),
|
||||
),
|
||||
|
@ -146,7 +145,7 @@ class OnboardingStepSix extends StatelessWidget {
|
|||
}
|
||||
|
||||
Widget nextButton(BuildContext context, String text, nextScreen, bool isFast) {
|
||||
final generateWalletProvider =
|
||||
GenerateWalletsProvider generateWalletProvider =
|
||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||
|
||||
generateWalletProvider.isAskedWordValid = false;
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
// ignore_for_file: file_names
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/onBoarding/8.dart';
|
||||
import 'package:gecko/widgets/commons/intro_info.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
|
||||
class OnboardingStepSeven extends StatelessWidget {
|
||||
const OnboardingStepSeven({Key? key, this.scanDerivation = false})
|
||||
|
@ -14,6 +13,8 @@ class OnboardingStepSeven extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
CommonElements common = CommonElements();
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
appBar: AppBar(
|
||||
|
@ -29,14 +30,15 @@ class OnboardingStepSeven extends StatelessWidget {
|
|||
extendBodyBehindAppBar: true,
|
||||
body: SafeArea(
|
||||
child: Stack(children: [
|
||||
InfoIntro(
|
||||
text: 'geckoWillGenerateAPassword'.tr(),
|
||||
assetName: 'coffre-fort-code-secret-dans-telephone.png',
|
||||
buttonText: '>',
|
||||
nextScreen: OnboardingStepEight(scanDerivation: scanDerivation),
|
||||
pagePosition: 6,
|
||||
common.infoIntro(
|
||||
context,
|
||||
'geckoWillGenerateAPassword'.tr(),
|
||||
'coffre-fort-code-secret-dans-telephone.png',
|
||||
'>',
|
||||
OnboardingStepEight(scanDerivation: scanDerivation),
|
||||
6,
|
||||
boxHeight: 400),
|
||||
const OfflineInfo(),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
// ignore_for_file: file_names
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/onBoarding/9.dart';
|
||||
import 'package:gecko/widgets/commons/intro_info.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
|
||||
class OnboardingStepEight extends StatelessWidget {
|
||||
const OnboardingStepEight({Key? key, this.scanDerivation = false})
|
||||
|
@ -14,6 +13,8 @@ class OnboardingStepEight extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
CommonElements common = CommonElements();
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
appBar: AppBar(
|
||||
|
@ -29,14 +30,15 @@ class OnboardingStepEight extends StatelessWidget {
|
|||
extendBodyBehindAppBar: true,
|
||||
body: SafeArea(
|
||||
child: Stack(children: [
|
||||
InfoIntro(
|
||||
text: 'thisPasswordProtectsYourWalletsInASecureChest'.tr(),
|
||||
assetName: 'coffre-fort-protege-les-portefeuilles.png',
|
||||
buttonText: '>',
|
||||
nextScreen: OnboardingStepNine(scanDerivation: scanDerivation),
|
||||
pagePosition: 7,
|
||||
common.infoIntro(
|
||||
context,
|
||||
'thisPasswordProtectsYourWalletsInASecureChest'.tr(),
|
||||
'coffre-fort-protege-les-portefeuilles.png',
|
||||
'>',
|
||||
OnboardingStepNine(scanDerivation: scanDerivation),
|
||||
7,
|
||||
isMd: true),
|
||||
const OfflineInfo(),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
// ignore_for_file: file_names
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/generate_wallets.dart';
|
||||
import 'package:gecko/widgets/commons/build_progress_bar.dart';
|
||||
import 'package:gecko/widgets/commons/build_text.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/onBoarding/10.dart';
|
||||
import 'package:gecko/widgets/commons/next_button.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class OnboardingStepNine extends StatelessWidget {
|
||||
|
@ -19,10 +16,12 @@ class OnboardingStepNine extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final generateWalletProvider =
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
GenerateWalletsProvider generateWalletProvider =
|
||||
Provider.of<GenerateWalletsProvider>(context);
|
||||
// final myWalletProvider =
|
||||
// MyWalletsProvider myWalletProvider =
|
||||
// Provider.of<MyWalletsProvider>(context);
|
||||
CommonElements common = CommonElements();
|
||||
|
||||
generateWalletProvider.pin.text = debugPin // kDebugMode &&
|
||||
? 'AAAAA'
|
||||
|
@ -45,16 +44,15 @@ class OnboardingStepNine extends StatelessWidget {
|
|||
child: Stack(children: [
|
||||
Column(children: <Widget>[
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
const BuildProgressBar(pagePosition: 8),
|
||||
common.buildProgressBar(8),
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
BuildText(text: "hereIsThePasswordKeepIt".tr()),
|
||||
common.buildText("hereIsThePasswordKeepIt".tr(), 20, true),
|
||||
const SizedBox(height: 100),
|
||||
Stack(
|
||||
alignment: Alignment.centerRight,
|
||||
children: <Widget>[
|
||||
TextField(
|
||||
key: keyGeneratedPin,
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
enabled: false,
|
||||
controller: generateWalletProvider.pin,
|
||||
maxLines: 1,
|
||||
|
@ -74,12 +72,6 @@ class OnboardingStepNine extends StatelessWidget {
|
|||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
Text(
|
||||
'Pendant la phase de test de Ğecko,\nles codes secrets\nsont systématiquement AAAAA.'
|
||||
.tr(),
|
||||
style: TextStyle(color: Colors.grey[700], fontSize: 15),
|
||||
textAlign: TextAlign.center),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
|
@ -104,13 +96,11 @@ class OnboardingStepNine extends StatelessWidget {
|
|||
fontWeight: FontWeight.w600))),
|
||||
))),
|
||||
SizedBox(height: 22 * ratio),
|
||||
NextButton(
|
||||
text: "iNotedMyPassword".tr(),
|
||||
nextScreen: OnboardingStepTen(scanDerivation: scanDerivation),
|
||||
isFast: false),
|
||||
common.nextButton(context, "iNotedMyPassword".tr(),
|
||||
OnboardingStepTen(scanDerivation: scanDerivation), false),
|
||||
SizedBox(height: 35 * ratio),
|
||||
]),
|
||||
const OfflineInfo(),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
));
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// ignore_for_file: must_be_immutable
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
|
@ -16,6 +17,7 @@ class QrCodeFullscreen extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
|
|
|
@ -1,53 +1,26 @@
|
|||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
// import 'package:gecko/providers/home.dart';
|
||||
import 'package:gecko/providers/search.dart';
|
||||
import 'package:gecko/widgets/commons/common_elements.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/search_result.dart';
|
||||
import 'package:gecko/screens/wallet_view.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
// import 'package:gecko/models/home.dart';
|
||||
// import 'package:provider/provider.dart';
|
||||
|
||||
class SearchScreen extends StatefulWidget {
|
||||
class SearchScreen extends StatelessWidget {
|
||||
const SearchScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SearchScreen> createState() => _SearchScreenState();
|
||||
}
|
||||
|
||||
class _SearchScreenState extends State<SearchScreen> {
|
||||
bool canPasteAddress = false;
|
||||
String pastedAddress = '';
|
||||
Timer? debounce;
|
||||
final int debouneTime = 50;
|
||||
|
||||
Future getClipBoard() async {
|
||||
final clipboard = await Clipboard.getData('text/plain');
|
||||
pastedAddress = clipboard?.text ?? '';
|
||||
canPasteAddress = isAddress(pastedAddress);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
await getClipBoard();
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final searchProvider = Provider.of<SearchProvider>(context);
|
||||
final screenHeight = MediaQuery.of(context).size.height;
|
||||
|
||||
final canValidate = searchProvider.searchController.text.length >= 2;
|
||||
// final canPasteAddress = false;
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
SearchProvider searchProvider = Provider.of<SearchProvider>(context);
|
||||
final double screenHeight = MediaQuery.of(context).size.height;
|
||||
// HomeProvider _homeProvider =
|
||||
// Provider.of<HomeProvider>(context, listen: false);
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () {
|
||||
|
@ -56,6 +29,7 @@ class _SearchScreenState extends State<SearchScreen> {
|
|||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
|
||||
appBar: AppBar(
|
||||
elevation: 1,
|
||||
toolbarHeight: 60 * ratio,
|
||||
|
@ -70,6 +44,7 @@ class _SearchScreenState extends State<SearchScreen> {
|
|||
Navigator.of(context).pop();
|
||||
}),
|
||||
),
|
||||
// bottomNavigationBar: _homeProvider.bottomAppBar(context),
|
||||
body: SafeArea(
|
||||
child: Stack(children: [
|
||||
Column(children: <Widget>[
|
||||
|
@ -77,52 +52,18 @@ class _SearchScreenState extends State<SearchScreen> {
|
|||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 17),
|
||||
child: TextField(
|
||||
onSubmitted: searchProvider.searchController.text.length >= 2
|
||||
? (_) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const SearchResultScreen();
|
||||
}),
|
||||
);
|
||||
}
|
||||
: (value) {},
|
||||
textInputAction: TextInputAction.search,
|
||||
key: keySearchField,
|
||||
controller: searchProvider.searchController,
|
||||
autofocus: true,
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.left,
|
||||
onChanged: (v) => {
|
||||
if (debounce?.isActive ?? false) {debounce!.cancel()},
|
||||
debounce = Timer(Duration(milliseconds: debouneTime), () {
|
||||
getClipBoard();
|
||||
searchProvider.reload();
|
||||
})
|
||||
},
|
||||
onChanged: (v) => searchProvider.reload(),
|
||||
decoration: InputDecoration(
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
prefixIconConstraints: const BoxConstraints(
|
||||
minHeight: 32,
|
||||
),
|
||||
suffixIcon: searchProvider.searchController.text == ''
|
||||
? null
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 17),
|
||||
child: IconButton(
|
||||
onPressed: (() async => {
|
||||
searchProvider.searchController.text = '',
|
||||
await getClipBoard(),
|
||||
searchProvider.reload(),
|
||||
}),
|
||||
icon: Icon(
|
||||
Icons.close,
|
||||
color: Colors.grey[600],
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
prefixIcon: const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 17),
|
||||
child: Image(
|
||||
|
@ -149,15 +90,15 @@ class _SearchScreenState extends State<SearchScreen> {
|
|||
),
|
||||
const Spacer(flex: 1),
|
||||
SizedBox(
|
||||
width: 320,
|
||||
height: 90,
|
||||
width: 410,
|
||||
height: 70,
|
||||
child: ElevatedButton(
|
||||
key: keyConfirmSearch,
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: Colors.white, elevation: 4,
|
||||
backgroundColor: orangeC, // foreground
|
||||
),
|
||||
onPressed: canValidate
|
||||
onPressed: searchProvider.searchController.text.length >= 2
|
||||
? () {
|
||||
Navigator.push(
|
||||
context,
|
||||
|
@ -166,32 +107,17 @@ class _SearchScreenState extends State<SearchScreen> {
|
|||
}),
|
||||
);
|
||||
}
|
||||
: canPasteAddress
|
||||
? () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return WalletViewScreen(
|
||||
address: pastedAddress, username: '');
|
||||
}),
|
||||
);
|
||||
}
|
||||
: null,
|
||||
: null,
|
||||
child: Text(
|
||||
canValidate
|
||||
? 'search'.tr()
|
||||
: canPasteAddress
|
||||
? 'pasteAddress'.tr()
|
||||
: 'search'.tr(),
|
||||
textAlign: TextAlign.center,
|
||||
'search'.tr(),
|
||||
style: const TextStyle(
|
||||
fontSize: 21, fontWeight: FontWeight.w600),
|
||||
fontSize: 24, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(flex: screenHeight <= 800 ? 1 : 2),
|
||||
]),
|
||||
const OfflineInfo(),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/cesium_plus.dart';
|
||||
import 'package:gecko/models/g1_wallets_list.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/providers/home.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:gecko/providers/search.dart';
|
||||
import 'package:gecko/widgets/bottom_app_bar.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
import 'package:gecko/widgets/search_result_list.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/wallet_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class SearchResultScreen extends StatelessWidget {
|
||||
|
@ -15,19 +20,19 @@ class SearchResultScreen extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final searchProvider = Provider.of<SearchProvider>(context, listen: false);
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
SearchProvider searchProvider =
|
||||
Provider.of<SearchProvider>(context, listen: false);
|
||||
CesiumPlusProvider cesiumPlusProvider =
|
||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||
WalletsProfilesProvider walletsProfilesClass =
|
||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
|
||||
HomeProvider homeProvider =
|
||||
Provider.of<HomeProvider>(context, listen: false);
|
||||
DuniterIndexer duniterIndexer =
|
||||
Provider.of<DuniterIndexer>(context, listen: false);
|
||||
|
||||
double avatarSize = 55;
|
||||
// List<G1WalletsList> myContacts = contactsBox.toMap().values.toList();
|
||||
// myContacts = myContacts
|
||||
// .where((map) =>
|
||||
// (map.username ?? '').contains(searchProvider.searchController.text))
|
||||
// .toList();
|
||||
|
||||
// final searchProvider.resultLenght.toString();
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
|
@ -39,7 +44,7 @@ class SearchResultScreen extends StatelessWidget {
|
|||
child: Text('researchResults'.tr()),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: const GeckoBottomAppBar(),
|
||||
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||
body: SafeArea(
|
||||
child: Stack(children: [
|
||||
Padding(
|
||||
|
@ -48,45 +53,129 @@ class SearchResultScreen extends StatelessWidget {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
const SizedBox(height: 30),
|
||||
Center(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
"resultsFor".tr(),
|
||||
style: TextStyle(color: Colors.grey[600]),
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
color: Colors.grey[700],
|
||||
),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: "resultsFor".tr(),
|
||||
),
|
||||
TextSpan(
|
||||
text: '"${searchProvider.searchController.text}"',
|
||||
style: const TextStyle(fontStyle: FontStyle.italic),
|
||||
),
|
||||
Text(
|
||||
'"${searchProvider.searchController.text}"',
|
||||
style: const TextStyle(
|
||||
fontStyle: FontStyle.italic, fontSize: 21),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
// const SizedBox(height: 40),
|
||||
// Text(
|
||||
// 'Dans mes contacts'.tr(args: [currencyName]),
|
||||
// style: const TextStyle(fontSize: 20),
|
||||
// ),
|
||||
// ContactsList(
|
||||
// myContacts: myContacts,
|
||||
// avatarSize: avatarSize,
|
||||
// walletsProfilesClass: walletsProfilesClass,
|
||||
// duniterIndexer: duniterIndexer),
|
||||
const SizedBox(height: 40),
|
||||
Text(
|
||||
'inBlockchainResult'.tr(args: [currencyName]),
|
||||
style: const TextStyle(fontSize: 20),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
SearchResult(
|
||||
searchProvider: searchProvider,
|
||||
duniterIndexer: duniterIndexer,
|
||||
avatarSize: avatarSize,
|
||||
walletsProfilesClass: walletsProfilesClass),
|
||||
FutureBuilder(
|
||||
future: searchProvider.searchAddress(),
|
||||
builder: (context, AsyncSnapshot<List?> snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.data?.isEmpty ?? true) {
|
||||
return duniterIndexer.searchIdentity(
|
||||
context, searchProvider.searchController.text);
|
||||
|
||||
// const Text('Aucun résultat');
|
||||
} else {
|
||||
return Expanded(
|
||||
child: ListView(children: <Widget>[
|
||||
for (G1WalletsList g1Wallet
|
||||
in snapshot.data ?? [])
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 5),
|
||||
child: ListTile(
|
||||
key: keySearchResult(g1Wallet.address),
|
||||
horizontalTitleGap: 40,
|
||||
contentPadding: const EdgeInsets.all(5),
|
||||
leading: cesiumPlusProvider
|
||||
.defaultAvatar(avatarSize),
|
||||
title: Row(children: <Widget>[
|
||||
Text(getShortPubkey(g1Wallet.address),
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Monospace',
|
||||
fontWeight: FontWeight.w500),
|
||||
textAlign: TextAlign.center),
|
||||
]),
|
||||
trailing: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 110,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.end,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.center,
|
||||
children: [
|
||||
balance(
|
||||
context,
|
||||
g1Wallet.address,
|
||||
16),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
]),
|
||||
subtitle: Row(children: <Widget>[
|
||||
duniterIndexer.getNameByAddress(
|
||||
context, g1Wallet.address)
|
||||
]),
|
||||
dense: false,
|
||||
isThreeLine: false,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
walletsProfilesClass.address =
|
||||
g1Wallet.address;
|
||||
return WalletViewScreen(
|
||||
address: g1Wallet.address,
|
||||
username: g1WalletsBox
|
||||
.get(g1Wallet.address)
|
||||
?.id
|
||||
?.username,
|
||||
avatar: g1WalletsBox
|
||||
.get(g1Wallet.address)
|
||||
?.avatar,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
return const Center(
|
||||
heightFactor: 5,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 3,
|
||||
backgroundColor: yellowC,
|
||||
color: orangeC,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
// Text(
|
||||
// _searchProvider.searchResult.toString(),
|
||||
// )
|
||||
]),
|
||||
),
|
||||
const OfflineInfo(),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/providers/home.dart';
|
||||
|
@ -18,6 +18,8 @@ class SettingsScreen extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
|
||||
const double buttonHigh = 50;
|
||||
const double buttonWidth = 240;
|
||||
const double fontSize = 16;
|
||||
|
@ -108,7 +110,7 @@ class SettingsScreen extends StatelessWidget {
|
|||
}
|
||||
|
||||
Widget duniterEndpointSelection(BuildContext context) {
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
String? selectedDuniterEndpoint;
|
||||
|
||||
// List of items in our dropdown menu
|
||||
|
@ -269,7 +271,8 @@ class SettingsScreen extends StatelessWidget {
|
|||
}
|
||||
|
||||
Widget indexerEndpointSelection(BuildContext context) {
|
||||
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
|
||||
DuniterIndexer indexer =
|
||||
Provider.of<DuniterIndexer>(context, listen: false);
|
||||
|
||||
String? selectedIndexerEndpoint;
|
||||
if (configBox.containsKey('customIndexer')) {
|
||||
|
@ -279,7 +282,7 @@ class SettingsScreen extends StatelessWidget {
|
|||
}
|
||||
|
||||
if (selectedIndexerEndpoint == '') {
|
||||
selectedIndexerEndpoint = duniterIndexer.listIndexerEndpoints[0];
|
||||
selectedIndexerEndpoint = indexer.listIndexerEndpoints[0];
|
||||
}
|
||||
|
||||
TextEditingController indexerEndpointController = TextEditingController(
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
@ -6,7 +7,8 @@ class TemplateScreen extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// final _homeProvider = Provider.of<HomeProvider>(context);
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
// HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
|
@ -20,10 +20,11 @@ class TransactionInProgress extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: true);
|
||||
final walletProfiles =
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: true);
|
||||
WalletsProfilesProvider walletViewProvider =
|
||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
final myWalletProvider =
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
bool isValid = false;
|
||||
|
||||
|
@ -34,11 +35,11 @@ class TransactionInProgress extends StatelessWidget {
|
|||
|
||||
// sub.spawnBlock();
|
||||
|
||||
log.d(walletProfiles.address);
|
||||
log.d(walletViewProvider.address);
|
||||
|
||||
final from = fromAddress ?? myWalletProvider.getDefaultWallet().name!;
|
||||
final to = toAddress ?? getShortPubkey(walletProfiles.address);
|
||||
final amount = walletProfiles.payAmount.text;
|
||||
final to = toAddress ?? getShortPubkey(walletViewProvider.address);
|
||||
final amount = walletViewProvider.payAmount.text;
|
||||
String actionName = '';
|
||||
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||
|
||||
|
|
|
@ -2,56 +2,53 @@
|
|||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/models/g1_wallets_list.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/cesium_plus.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/providers/home.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:gecko/screens/activity.dart';
|
||||
import 'package:gecko/widgets/commons/common_elements.dart';
|
||||
import 'package:gecko/screens/common_elements.dart';
|
||||
import 'package:gecko/screens/myWallets/choose_wallet.dart';
|
||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||
import 'package:gecko/screens/qrcode_fullscreen.dart';
|
||||
import 'package:gecko/screens/transaction_in_progress.dart';
|
||||
import 'package:gecko/widgets/balance.dart';
|
||||
import 'package:gecko/widgets/bottom_app_bar.dart';
|
||||
import 'package:gecko/widgets/header_profile.dart';
|
||||
import 'package:gecko/widgets/page_route_no_transition.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
|
||||
class WalletViewScreen extends StatelessWidget {
|
||||
const WalletViewScreen(
|
||||
{required this.address, required this.username, this.avatar, Key? key})
|
||||
{required this.address, this.username, this.avatar, Key? key})
|
||||
: super(key: key);
|
||||
final String address;
|
||||
final String username;
|
||||
final String? username;
|
||||
final Image? avatar;
|
||||
final double buttonSize = 100;
|
||||
final double buttonFontSize = 18;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
WalletsProfilesProvider walletProfile =
|
||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final myWalletProvider =
|
||||
CesiumPlusProvider cesiumPlusProvider =
|
||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||
walletProfile.address = address;
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
HomeProvider homeProvider =
|
||||
Provider.of<HomeProvider>(context, listen: false);
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
|
||||
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
|
||||
walletProfile.address = address;
|
||||
sub.setCurrentWallet(defaultWallet);
|
||||
|
||||
log.d('aaaaaaaaaaaaaaaaaaa: $username');
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
resizeToAvoidBottomInset: true,
|
||||
|
@ -103,21 +100,15 @@ class WalletViewScreen extends StatelessWidget {
|
|||
)
|
||||
],
|
||||
title: SizedBox(
|
||||
height: 22,
|
||||
child: Text(duniterIndexer
|
||||
.walletNameIndexer[walletProfile.address] ==
|
||||
null
|
||||
? 'seeAWallet'.tr()
|
||||
: 'memberAccountOf'.tr(args: [
|
||||
duniterIndexer.walletNameIndexer[walletProfile.address] ??
|
||||
'?'
|
||||
]))),
|
||||
height: 22,
|
||||
child: Text('seeAWallet'.tr()),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: const GeckoBottomAppBar(),
|
||||
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||
body: SafeArea(
|
||||
child: Column(children: <Widget>[
|
||||
HeaderProfile(address: address, username: username),
|
||||
SizedBox(height: isTall ? 30 : 15),
|
||||
walletProfile.headerProfileView(context, address, username),
|
||||
SizedBox(height: isTall ? 10 : 0),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
||||
Column(children: <Widget>[
|
||||
SizedBox(
|
||||
|
@ -137,10 +128,11 @@ class WalletViewScreen extends StatelessWidget {
|
|||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageNoTransit(builder: (context) {
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return ActivityScreen(
|
||||
address: address,
|
||||
avatar: defaultAvatar(50));
|
||||
avatar:
|
||||
cesiumPlusProvider.defaultAvatar(50));
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
@ -158,20 +150,20 @@ class WalletViewScreen extends StatelessWidget {
|
|||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
return FutureBuilder(
|
||||
future: sub.certState(defaultWallet.address, address),
|
||||
future: sub.certState(defaultWallet.address!, address),
|
||||
builder: (context, AsyncSnapshot<Map<String, int>> snapshot) {
|
||||
if (snapshot.data == null) return const SizedBox();
|
||||
String duration = '';
|
||||
log.d(
|
||||
'${getShortPubkey(address)} --- certDelay ${snapshot.data!['certDelay']} --- certRenewable ${snapshot.data!['certRenewable']}');
|
||||
log.d('certDelay ${snapshot.data!['certDelay']}');
|
||||
log.d('certRenewable ${snapshot.data!['certRenewable']}');
|
||||
|
||||
if (snapshot.data!['certDelay'] != null ||
|
||||
snapshot.data!['certRenewable'] != null) {
|
||||
final Duration durationSeconds = Duration(
|
||||
seconds: snapshot.data!['certDelay'] ??
|
||||
snapshot.data!['certRenewable']!);
|
||||
final seconds = durationSeconds.inSeconds;
|
||||
final minutes = durationSeconds.inMinutes;
|
||||
final int seconds = durationSeconds.inSeconds;
|
||||
final int minutes = durationSeconds.inMinutes;
|
||||
|
||||
if (seconds <= 0) {
|
||||
duration = 'seconds'.tr(args: ['0']);
|
||||
|
@ -180,8 +172,8 @@ class WalletViewScreen extends StatelessWidget {
|
|||
} else if (seconds <= 3600) {
|
||||
duration = 'minutes'.tr(args: [minutes.toString()]);
|
||||
} else if (seconds <= 86400) {
|
||||
final hours = durationSeconds.inHours;
|
||||
final minutesLeft = minutes - hours * 60;
|
||||
final int hours = durationSeconds.inHours;
|
||||
final int minutesLeft = minutes - hours * 60;
|
||||
String showMinutes = '';
|
||||
if (minutesLeft < 60) {}
|
||||
showMinutes =
|
||||
|
@ -189,10 +181,11 @@ class WalletViewScreen extends StatelessWidget {
|
|||
duration =
|
||||
'hours'.tr(args: [hours.toString(), showMinutes]);
|
||||
} else if (seconds <= 2592000) {
|
||||
final days = durationSeconds.inDays;
|
||||
final int days = durationSeconds.inDays;
|
||||
duration = 'days'.tr(args: [days.toString()]);
|
||||
} else {
|
||||
final months = (durationSeconds.inDays / 30).round();
|
||||
final int months =
|
||||
(durationSeconds.inDays / 30).round();
|
||||
duration = 'months'.tr(args: [months.toString()]);
|
||||
}
|
||||
}
|
||||
|
@ -220,18 +213,12 @@ class WalletViewScreen extends StatelessWidget {
|
|||
'assets/gecko_certify.png')),
|
||||
),
|
||||
onTap: () async {
|
||||
final bool? result =
|
||||
await confirmPopupCertification(
|
||||
context,
|
||||
'areYouSureYouWantToCertify1'
|
||||
.tr(),
|
||||
duniterIndexer
|
||||
.walletNameIndexer[
|
||||
address] ??
|
||||
"noIdentity".tr(),
|
||||
'areYouSureYouWantToCertify2'
|
||||
.tr(),
|
||||
getShortPubkey(address));
|
||||
final bool? result = await confirmPopup(
|
||||
context,
|
||||
"areYouSureYouWantToCertify".tr(
|
||||
args: [
|
||||
getShortPubkey(address)
|
||||
]));
|
||||
|
||||
if (result ?? false) {
|
||||
String? pin;
|
||||
|
@ -275,9 +262,7 @@ class WalletViewScreen extends StatelessWidget {
|
|||
),
|
||||
const SizedBox(height: 9),
|
||||
Text(
|
||||
toStatus == 0
|
||||
? "certify".tr()
|
||||
: "createIdentity".tr(),
|
||||
"certify".tr(),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: buttonFontSize,
|
||||
|
@ -437,7 +422,9 @@ void paymentPopup(BuildContext context, String toAddress) {
|
|||
log.d(pin);
|
||||
if (pin != null || myWalletProvider.pinCode != '') {
|
||||
// Payment workflow !
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
WalletsProfilesProvider walletViewProvider =
|
||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final acc = sub.getCurrentWallet();
|
||||
log.d(
|
||||
"fromAddress: ${acc.address!},destAddress: $toAddress, amount: ${double.parse(walletViewProvider.payAmount.text)}, password: $pin");
|
||||
|
@ -466,19 +453,16 @@ void paymentPopup(BuildContext context, String toAddress) {
|
|||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
final sub = Provider.of<SubstrateSdk>(homeContext, listen: false);
|
||||
final walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
|
||||
double fees = 0;
|
||||
return StatefulBuilder(
|
||||
builder: (BuildContext context, StateSetter setState) {
|
||||
if (walletViewProvider.payAmount.text != '' &&
|
||||
(double.parse(walletViewProvider.payAmount.text) +
|
||||
2 / balanceRatio) <=
|
||||
(walletOptions.balanceCache[defaultWallet.address] ?? 0) &&
|
||||
(balanceCache[defaultWallet.address] ?? 0) &&
|
||||
toAddress != defaultWallet.address) {
|
||||
if ((walletOptions.balanceCache[toAddress] == 0 ||
|
||||
walletOptions.balanceCache[toAddress] == null) &&
|
||||
if ((balanceCache[toAddress] == 0 ||
|
||||
balanceCache[toAddress] == null) &&
|
||||
double.parse(walletViewProvider.payAmount.text) <
|
||||
5 / balanceRatio) {
|
||||
canValidate = false;
|
||||
|
@ -573,7 +557,7 @@ void paymentPopup(BuildContext context, String toAddress) {
|
|||
child: Row(children: [
|
||||
Text(defaultWallet.name!),
|
||||
const Spacer(),
|
||||
Balance(address: defaultWallet.address, size: 20),
|
||||
balance(context, defaultWallet.address!, 20)
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
@ -637,11 +621,10 @@ void paymentPopup(BuildContext context, String toAddress) {
|
|||
autofocus: true,
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
keyboardType: const TextInputType.numberWithOptions(
|
||||
decimal: true),
|
||||
keyboardType: TextInputType.number,
|
||||
onChanged: (_) async {
|
||||
fees = await sub.txFees(
|
||||
defaultWallet.address,
|
||||
defaultWallet.address!,
|
||||
toAddress,
|
||||
double.parse(
|
||||
walletViewProvider.payAmount.text == ''
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/widgets/ud_unit_display.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class Balance extends StatelessWidget {
|
||||
const Balance(
|
||||
{Key? key,
|
||||
required this.address,
|
||||
required this.size,
|
||||
this.color = Colors.black,
|
||||
this.loadingColor = const Color(0xffd07316)})
|
||||
: super(key: key);
|
||||
final String address;
|
||||
final double size;
|
||||
final Color color;
|
||||
final Color loadingColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
return Column(children: <Widget>[
|
||||
Consumer<SubstrateSdk>(builder: (context, sdk, _) {
|
||||
return FutureBuilder(
|
||||
future: sdk.getBalance(address),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<Map<String, double>> globalBalance) {
|
||||
if (globalBalance.connectionState != ConnectionState.done ||
|
||||
globalBalance.hasError) {
|
||||
if (walletOptions.balanceCache[address] != null &&
|
||||
walletOptions.balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(walletOptions.balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: color)),
|
||||
const SizedBox(width: 5),
|
||||
UdUnitDisplay(size: size, color: color),
|
||||
]);
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: 15,
|
||||
width: 15,
|
||||
child: CircularProgressIndicator(
|
||||
color: loadingColor,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
walletOptions.balanceCache[address] =
|
||||
globalBalance.data!['transferableBalance']!;
|
||||
if (walletOptions.balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(
|
||||
walletOptions.balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
UdUnitDisplay(size: size, color: color),
|
||||
]);
|
||||
} else {
|
||||
return const Text('');
|
||||
}
|
||||
});
|
||||
}),
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,140 +0,0 @@
|
|||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/my_wallets.dart';
|
||||
import 'package:gecko/providers/search.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||
import 'package:gecko/screens/myWallets/wallets_home.dart';
|
||||
import 'package:gecko/screens/search.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class GeckoBottomAppBar extends StatelessWidget {
|
||||
const GeckoBottomAppBar({Key? key, this.actualRoute = ''}) : super(key: key);
|
||||
final String actualRoute;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
final historyProvider =
|
||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
final searchProvider = Provider.of<SearchProvider>(context, listen: false);
|
||||
|
||||
final size = MediaQuery.of(context).size;
|
||||
const bool showBottomBar = true;
|
||||
final lockAction = actualRoute == 'safeHome';
|
||||
|
||||
return Visibility(
|
||||
visible: showBottomBar,
|
||||
child: Container(
|
||||
color: yellowC,
|
||||
width: size.width,
|
||||
height: 80,
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
|
||||
const Spacer(),
|
||||
const SizedBox(width: 11),
|
||||
IconButton(
|
||||
key: keyAppBarSearch,
|
||||
iconSize: 40,
|
||||
icon: const Image(image: AssetImage('assets/loupe-noire.png')),
|
||||
onPressed: () {
|
||||
searchProvider.reload();
|
||||
Navigator.popUntil(
|
||||
context,
|
||||
ModalRoute.withName('/'),
|
||||
);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (homeContext) {
|
||||
return const SearchScreen();
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 22),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
key: keyAppBarQrcode,
|
||||
iconSize: 70,
|
||||
icon: const Image(image: AssetImage('assets/qrcode-scan.png')),
|
||||
onPressed: () async {
|
||||
Navigator.popUntil(
|
||||
context,
|
||||
ModalRoute.withName('/'),
|
||||
);
|
||||
historyProvider.scan(homeContext);
|
||||
},
|
||||
),
|
||||
const Spacer(),
|
||||
const SizedBox(width: 15),
|
||||
Stack(
|
||||
children: [
|
||||
if (lockAction)
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 0),
|
||||
child: Container(
|
||||
width: 75,
|
||||
height: 75,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border:
|
||||
Border.all(color: orangeC.withOpacity(0), width: 3),
|
||||
gradient: RadialGradient(
|
||||
radius: 0.5,
|
||||
colors: [
|
||||
yellowC,
|
||||
orangeC.withOpacity(0.1),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
key: keyAppBarChest,
|
||||
iconSize: 60,
|
||||
icon: const Image(image: AssetImage('assets/wallet.png')),
|
||||
onPressed: lockAction
|
||||
? null
|
||||
: () async {
|
||||
WalletData? defaultWallet =
|
||||
myWalletProvider.getDefaultWallet();
|
||||
String? pin;
|
||||
if (myWalletProvider.pinCode == '') {
|
||||
pin = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (homeContext) {
|
||||
return UnlockingWallet(wallet: defaultWallet);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (pin != null || myWalletProvider.pinCode != '') {
|
||||
Navigator.popUntil(
|
||||
context,
|
||||
ModalRoute.withName('/'),
|
||||
);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const WalletsHome();
|
||||
}),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/cesium_plus.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/screens/wallet_view.dart';
|
||||
|
||||
class CertTile extends StatelessWidget {
|
||||
const CertTile({
|
||||
Key? key,
|
||||
required this.listCerts,
|
||||
}) : super(key: key);
|
||||
|
||||
final List listCerts;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
int keyID = 0;
|
||||
const double avatarSize = 200;
|
||||
|
||||
return Column(
|
||||
children: listCerts.map((repository) {
|
||||
// log.d('bbbbbbbbbbbbbbbbbbbbbb: ' + repository.toString());
|
||||
|
||||
return Column(children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 0),
|
||||
child:
|
||||
// Row(children: [Column(children: [],)],)
|
||||
ListTile(
|
||||
key: keyTransaction(keyID++),
|
||||
contentPadding: const EdgeInsets.only(
|
||||
left: 20, right: 30, top: 15, bottom: 15),
|
||||
leading: ClipOval(
|
||||
child: defaultAvatar(avatarSize),
|
||||
),
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 5),
|
||||
child: Text(repository['name'],
|
||||
style: const TextStyle(fontSize: 20)),
|
||||
),
|
||||
subtitle: RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey[700],
|
||||
),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: repository['date'],
|
||||
),
|
||||
if (repository[2] != '')
|
||||
TextSpan(
|
||||
text: ' · ',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color: Colors.grey[550],
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: getShortPubkey(repository['address']),
|
||||
style: TextStyle(
|
||||
fontStyle: FontStyle.italic,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
dense: false,
|
||||
isThreeLine: false,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
homeContext,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return WalletViewScreen(
|
||||
address: repository['address'],
|
||||
username: repository['name'],
|
||||
);
|
||||
}),
|
||||
);
|
||||
}),
|
||||
),
|
||||
]);
|
||||
}).toList());
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class Certifications extends StatelessWidget {
|
||||
const Certifications(
|
||||
{Key? key,
|
||||
required this.address,
|
||||
required this.size,
|
||||
this.color = Colors.black})
|
||||
: super(key: key);
|
||||
final String address;
|
||||
final double size;
|
||||
final Color color;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(children: <Widget>[
|
||||
Consumer<SubstrateSdk>(builder: (context, sdk, _) {
|
||||
return FutureBuilder(
|
||||
future: sdk.getCertsCounter(address),
|
||||
builder: (BuildContext context, AsyncSnapshot<List<int>> certs) {
|
||||
// log.d(_certs.data);
|
||||
|
||||
return certs.data?[0] != 0 && certs.data != null
|
||||
? Row(
|
||||
children: [
|
||||
Image.asset('assets/medal.png', height: 20),
|
||||
const SizedBox(width: 1),
|
||||
Text(certs.data?[0].toString() ?? '0',
|
||||
style: const TextStyle(fontSize: 20)),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
"(${certs.data?[1].toString() ?? '0'})",
|
||||
style: const TextStyle(fontSize: 14),
|
||||
)
|
||||
],
|
||||
)
|
||||
: const Text('');
|
||||
});
|
||||
}),
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class CertsCounter extends StatelessWidget {
|
||||
const CertsCounter({Key? key, required this.address, this.isSent = false})
|
||||
: super(key: key);
|
||||
final String address;
|
||||
final bool isSent;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
return Text('(${sub.certsCounterCache[address]![isSent ? 1 : 0]})');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/queries_indexer.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/widgets/cert_tile.dart';
|
||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||
|
||||
class CertsReceived extends StatelessWidget {
|
||||
const CertsReceived({Key? key, required this.address}) : super(key: key);
|
||||
final String address;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenHeight = MediaQuery.of(context).size.height;
|
||||
final appBarHeight = AppBar().preferredSize.height;
|
||||
log.d(appBarHeight);
|
||||
final windowHeight = screenHeight - appBarHeight - 200;
|
||||
|
||||
final httpLink = HttpLink(
|
||||
'$indexerEndpoint/v1/graphql',
|
||||
);
|
||||
|
||||
final client = ValueNotifier(
|
||||
GraphQLClient(
|
||||
cache: GraphQLCache(store: HiveStore()),
|
||||
link: httpLink,
|
||||
),
|
||||
);
|
||||
return GraphQLProvider(
|
||||
client: client,
|
||||
child: Query(
|
||||
options: QueryOptions(
|
||||
document: gql(getCertsReceived),
|
||||
variables: <String, dynamic>{
|
||||
'address': address,
|
||||
},
|
||||
),
|
||||
builder: (QueryResult result, {fetchMore, refetch}) {
|
||||
if (result.isLoading && result.data == null) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
|
||||
if (result.hasException || result.data == null) {
|
||||
log.e('Error Indexer: ${result.exception}');
|
||||
return Column(children: <Widget>[
|
||||
const SizedBox(height: 50),
|
||||
Text(
|
||||
"noNetworkNoHistory".tr(),
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
]);
|
||||
} else if (result.data?['certification']?.isEmpty) {
|
||||
return Column(children: <Widget>[
|
||||
const SizedBox(height: 50),
|
||||
Text(
|
||||
"noDataToDisplay".tr(),
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
]);
|
||||
}
|
||||
// Build history list
|
||||
return SizedBox(
|
||||
height: windowHeight,
|
||||
child: ListView(
|
||||
key: keyListTransactions,
|
||||
children: <Widget>[certsView(result)],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget certsView(QueryResult result) {
|
||||
List listCerts = [];
|
||||
final List certsData = result.data!['certification'];
|
||||
|
||||
for (final cert in certsData) {
|
||||
final String issuerAddress = cert['issuer']['pubkey'];
|
||||
final String issuerName = cert['issuer']['name'];
|
||||
final date = DateTime.parse(cert['created_at']);
|
||||
final dp = DateTime(date.year, date.month, date.day);
|
||||
final dateForm = '${dp.day}-${dp.month}-${dp.year}';
|
||||
listCerts.add(
|
||||
{'address': issuerAddress, 'name': issuerName, 'date': dateForm});
|
||||
}
|
||||
|
||||
return result.data == null
|
||||
? Column(children: <Widget>[
|
||||
const SizedBox(height: 50),
|
||||
Text(
|
||||
"noTransactionToDisplay".tr(),
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
])
|
||||
: Column(children: <Widget>[
|
||||
CertTile(listCerts: listCerts),
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/queries_indexer.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/widgets/cert_tile.dart';
|
||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||
|
||||
class CertsSent extends StatelessWidget {
|
||||
const CertsSent({Key? key, required this.address}) : super(key: key);
|
||||
final String address;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenHeight = MediaQuery.of(context).size.height;
|
||||
final appBarHeight = AppBar().preferredSize.height;
|
||||
log.d(appBarHeight);
|
||||
final windowHeight = screenHeight - appBarHeight - 200;
|
||||
|
||||
final httpLink = HttpLink(
|
||||
'$indexerEndpoint/v1/graphql',
|
||||
);
|
||||
|
||||
final client = ValueNotifier(
|
||||
GraphQLClient(
|
||||
cache: GraphQLCache(store: HiveStore()),
|
||||
link: httpLink,
|
||||
),
|
||||
);
|
||||
return GraphQLProvider(
|
||||
client: client,
|
||||
child: Query(
|
||||
options: QueryOptions(
|
||||
document: gql(getCertsSent),
|
||||
variables: <String, dynamic>{
|
||||
'address': address,
|
||||
},
|
||||
),
|
||||
builder: (QueryResult result, {fetchMore, refetch}) {
|
||||
if (result.isLoading && result.data == null) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
|
||||
if (result.hasException || result.data == null) {
|
||||
log.e('Error Indexer: ${result.exception}');
|
||||
return Column(children: <Widget>[
|
||||
const SizedBox(height: 50),
|
||||
Text(
|
||||
"noNetworkNoHistory".tr(),
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
]);
|
||||
} else if (result.data?['certification']?.isEmpty) {
|
||||
return Column(children: <Widget>[
|
||||
const SizedBox(height: 50),
|
||||
Text(
|
||||
"noDataToDisplay".tr(),
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
]);
|
||||
}
|
||||
// Build history list
|
||||
return SizedBox(
|
||||
height: windowHeight,
|
||||
child: ListView(
|
||||
key: keyListTransactions,
|
||||
children: <Widget>[certsView(result)],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget certsView(QueryResult result) {
|
||||
List listCerts = [];
|
||||
final List certsData = result.data!['certification'];
|
||||
|
||||
for (final cert in certsData) {
|
||||
final String issuerAddress = cert['receiver']['pubkey'];
|
||||
final String issuerName = cert['receiver']['name'];
|
||||
final date = DateTime.parse(cert['created_at']);
|
||||
final dp = DateTime(date.year, date.month, date.day);
|
||||
final dateForm = '${dp.day}-${dp.month}-${dp.year}';
|
||||
|
||||
listCerts.add(
|
||||
{'address': issuerAddress, 'name': issuerName, 'date': dateForm});
|
||||
}
|
||||
|
||||
return result.data == null
|
||||
? Column(children: <Widget>[
|
||||
const SizedBox(height: 50),
|
||||
Text(
|
||||
"noTransactionToDisplay".tr(),
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
])
|
||||
: Column(children: <Widget>[
|
||||
CertTile(listCerts: listCerts),
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
|
||||
class BuildImage extends StatelessWidget {
|
||||
const BuildImage({
|
||||
Key? key,
|
||||
required this.assetName,
|
||||
required this.boxHeight,
|
||||
required this.imageWidth,
|
||||
}) : super(key: key);
|
||||
|
||||
final String assetName;
|
||||
final double boxHeight;
|
||||
final double imageWidth;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(0),
|
||||
width: 440,
|
||||
height: isTall ? boxHeight : boxHeight * 0.9,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
Color(0xffd2d4cf),
|
||||
Color(0xffeaeae7),
|
||||
],
|
||||
),
|
||||
border: Border.all(color: Colors.grey[900]!)),
|
||||
child: Image.asset('assets/onBoarding/$assetName', width: imageWidth));
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
import 'package:dots_indicator/dots_indicator.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
|
||||
class BuildProgressBar extends StatelessWidget {
|
||||
const BuildProgressBar({
|
||||
Key? key,
|
||||
required this.pagePosition,
|
||||
}) : super(key: key);
|
||||
|
||||
final double pagePosition;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DotsIndicator(
|
||||
dotsCount: 10,
|
||||
position: pagePosition,
|
||||
decorator: DotsDecorator(
|
||||
spacing: const EdgeInsets.symmetric(horizontal: 10),
|
||||
color: Colors.grey[300]!, // Inactive color
|
||||
activeColor: orangeC,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
|
||||
class BuildText extends StatelessWidget {
|
||||
const BuildText({
|
||||
Key? key,
|
||||
required this.text,
|
||||
this.size = 20,
|
||||
this.isMd = true,
|
||||
}) : super(key: key);
|
||||
|
||||
final String text;
|
||||
final double size;
|
||||
final bool isMd;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final mdStyle = MarkdownStyleSheet(
|
||||
p: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: Colors.black,
|
||||
letterSpacing: 0.3),
|
||||
textAlign: WrapAlignment.spaceBetween,
|
||||
);
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
width: 440,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white, border: Border.all(color: Colors.grey[900]!)),
|
||||
child: isMd
|
||||
? MarkdownBody(data: text, styleSheet: mdStyle)
|
||||
: Text(text,
|
||||
textAlign: TextAlign.justify,
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: Colors.black,
|
||||
letterSpacing: 0.3)),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,214 +0,0 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
|
||||
Future<bool?> confirmPopup(BuildContext context, String title) async {
|
||||
return showDialog<bool>(
|
||||
context: context,
|
||||
barrierDismissible: true, // user must tap button!
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
backgroundColor: backgroundColor,
|
||||
content: Text(
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
|
||||
),
|
||||
actions: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
key: keyConfirm,
|
||||
child: Text(
|
||||
"yes".tr(),
|
||||
style: const TextStyle(
|
||||
fontSize: 21,
|
||||
color: Color(0xffD80000),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context, true);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
TextButton(
|
||||
child: Text(
|
||||
"no".tr(),
|
||||
style: const TextStyle(fontSize: 21),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context, false);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 120)
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool?> confirmPopupCertification(BuildContext context, String question1,
|
||||
String username, String question2, String address) async {
|
||||
return showDialog<bool>(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
// actionsPadding: const EdgeInsets.all(0.0),
|
||||
backgroundColor: backgroundColor,
|
||||
content: SizedBox(
|
||||
height: 240,
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 15),
|
||||
Text(
|
||||
question1,
|
||||
textAlign: TextAlign.center,
|
||||
style:
|
||||
const TextStyle(fontSize: 20, fontWeight: FontWeight.w400),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
username,
|
||||
textAlign: TextAlign.center,
|
||||
style:
|
||||
const TextStyle(fontSize: 24, fontWeight: FontWeight.w500),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
question2,
|
||||
textAlign: TextAlign.center,
|
||||
style:
|
||||
const TextStyle(fontSize: 20, fontWeight: FontWeight.w400),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
address,
|
||||
textAlign: TextAlign.center,
|
||||
style:
|
||||
const TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const Text(
|
||||
'?',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w400),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
key: keyConfirm,
|
||||
child: Text(
|
||||
"yes".tr(),
|
||||
style: const TextStyle(
|
||||
fontSize: 25,
|
||||
color: Color(0xffD80000),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context, true);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 35),
|
||||
TextButton(
|
||||
child: Text(
|
||||
"no".tr(),
|
||||
style: const TextStyle(fontSize: 25),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context, false);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 120)
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> infoPopup(BuildContext context, String title) async {
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: true, // user must tap button!
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
backgroundColor: backgroundColor,
|
||||
content: Text(
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
|
||||
),
|
||||
actions: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
key: keyInfoPopup,
|
||||
child: const Text(
|
||||
"D'accord",
|
||||
style: TextStyle(
|
||||
fontSize: 21,
|
||||
color: Color(0xffD80000),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context, true);
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
bool isAddress(address) {
|
||||
final RegExp regExp = RegExp(
|
||||
r'^[a-zA-Z0-9]+$',
|
||||
caseSensitive: false,
|
||||
multiLine: false,
|
||||
);
|
||||
|
||||
if (regExp.hasMatch(address) == true &&
|
||||
address.length > 45 &&
|
||||
address.length < 52) {
|
||||
log.d("C'est une adresse !");
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Widget geckoAppBar() {
|
||||
// return AppBar(
|
||||
// toolbarHeight: 60 * ratio,
|
||||
// elevation: 0,
|
||||
// leading: IconButton(
|
||||
// icon: const Icon(Icons.arrow_back, color: Colors.black),
|
||||
// onPressed: () {
|
||||
// _walletOptions.isEditing = false;
|
||||
// _walletOptions.isBalanceBlur = false;
|
||||
// Navigator.pop(context);
|
||||
// }),
|
||||
// title: SizedBox(
|
||||
// height: 22,
|
||||
// child: Consumer<WalletOptionsProvider>(
|
||||
// builder: (context, walletProvider, _) {
|
||||
// return Text(_walletOptions.nameController.text);
|
||||
// }),
|
||||
// ),
|
||||
// );
|
||||
// }
|
|
@ -1,27 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class FaderTransition extends PageRouteBuilder {
|
||||
final Widget page;
|
||||
final bool isFast;
|
||||
|
||||
FaderTransition({required this.page, required this.isFast})
|
||||
: super(
|
||||
pageBuilder: (
|
||||
BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
) =>
|
||||
page,
|
||||
transitionsBuilder: (
|
||||
BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
Widget child,
|
||||
) =>
|
||||
FadeTransition(
|
||||
opacity:
|
||||
Tween(begin: 0.0, end: isFast ? 3.0 : 1.0).animate(animation),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/widgets/commons/build_image.dart';
|
||||
import 'package:gecko/widgets/commons/build_progress_bar.dart';
|
||||
import 'package:gecko/widgets/commons/build_text.dart';
|
||||
import 'package:gecko/widgets/commons/next_button.dart';
|
||||
|
||||
class InfoIntro extends StatelessWidget {
|
||||
const InfoIntro({
|
||||
Key? key,
|
||||
required this.text,
|
||||
required this.assetName,
|
||||
required this.buttonText,
|
||||
required this.nextScreen,
|
||||
required this.pagePosition,
|
||||
this.isMd = false,
|
||||
this.isFast = false,
|
||||
this.boxHeight = 440,
|
||||
this.imageWidth = 350,
|
||||
this.textSize = 20,
|
||||
}) : super(key: key);
|
||||
|
||||
final String text;
|
||||
final String assetName;
|
||||
final String buttonText;
|
||||
final Widget nextScreen;
|
||||
final double pagePosition;
|
||||
final bool isMd;
|
||||
final bool isFast;
|
||||
final double boxHeight;
|
||||
final double imageWidth;
|
||||
final double textSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(children: <Widget>[
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
BuildProgressBar(pagePosition: pagePosition),
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
|
||||
BuildText(text: text, size: textSize, isMd: isMd),
|
||||
|
||||
BuildImage(
|
||||
assetName: assetName, boxHeight: boxHeight, imageWidth: imageWidth),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: NextButton(
|
||||
text: buttonText, nextScreen: nextScreen, isFast: false),
|
||||
),
|
||||
),
|
||||
// const SizedBox(height: 40),
|
||||
SizedBox(height: isTall ? 40 : 20),
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/widgets/commons/fader_transition.dart';
|
||||
|
||||
class NextButton extends StatelessWidget {
|
||||
const NextButton({
|
||||
Key? key,
|
||||
required this.text,
|
||||
required this.nextScreen,
|
||||
required this.isFast,
|
||||
}) : super(key: key);
|
||||
|
||||
final String text;
|
||||
final Widget nextScreen;
|
||||
final bool isFast;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: 380 * ratio,
|
||||
height: 60 * ratio,
|
||||
child: ElevatedButton(
|
||||
key: keyGoNext,
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: Colors.white, backgroundColor: orangeC,
|
||||
elevation: 4, // foreground
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context, FaderTransition(page: nextScreen, isFast: isFast));
|
||||
},
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(fontSize: 23 * ratio, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class OfflineInfo extends StatelessWidget {
|
||||
const OfflineInfo({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenWidth = MediaQuery.of(homeContext).size.width;
|
||||
return Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
return Visibility(
|
||||
visible: !sub.nodeConnected,
|
||||
child: Positioned(
|
||||
top: 0,
|
||||
child: Container(
|
||||
height: 30,
|
||||
width: screenWidth,
|
||||
color: Colors.grey[800],
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'youAreOffline'.tr(),
|
||||
style: TextStyle(color: Colors.grey[50]),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class SmoothTransition extends PageRouteBuilder {
|
||||
final Widget page;
|
||||
SmoothTransition({required this.page})
|
||||
: super(
|
||||
pageBuilder: (
|
||||
BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
) =>
|
||||
TweenAnimationBuilder(
|
||||
duration: const Duration(seconds: 5),
|
||||
tween: Tween(begin: 200, end: 200),
|
||||
builder: (BuildContext context, dynamic value, Widget? child) {
|
||||
return page;
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/g1_wallets_list.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/cesium_plus.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:gecko/screens/wallet_view.dart';
|
||||
import 'package:gecko/widgets/balance.dart';
|
||||
import 'package:gecko/widgets/name_by_address.dart';
|
||||
|
||||
class ContactsList extends StatelessWidget {
|
||||
const ContactsList({
|
||||
Key? key,
|
||||
required this.myContacts,
|
||||
required this.avatarSize,
|
||||
required this.walletsProfilesClass,
|
||||
required this.duniterIndexer,
|
||||
}) : super(key: key);
|
||||
|
||||
final List<G1WalletsList> myContacts;
|
||||
final double avatarSize;
|
||||
final WalletsProfilesProvider walletsProfilesClass;
|
||||
final DuniterIndexer duniterIndexer;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
const SizedBox(height: 20),
|
||||
if (myContacts.isEmpty)
|
||||
Text('noContacts'.tr())
|
||||
else
|
||||
Expanded(
|
||||
child: ListView(children: <Widget>[
|
||||
for (G1WalletsList g1Wallet in myContacts)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5),
|
||||
child: ListTile(
|
||||
key: keySearchResult('keyID++'),
|
||||
horizontalTitleGap: 40,
|
||||
contentPadding: const EdgeInsets.all(5),
|
||||
leading: defaultAvatar(avatarSize),
|
||||
title: Row(children: <Widget>[
|
||||
Text(getShortPubkey(g1Wallet.address),
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Monospace',
|
||||
fontWeight: FontWeight.w500),
|
||||
textAlign: TextAlign.center),
|
||||
]),
|
||||
trailing: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 110,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
Balance(
|
||||
address: g1Wallet.address,
|
||||
size: 16),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
]),
|
||||
subtitle: Row(children: <Widget>[
|
||||
NameByAddress(
|
||||
wallet: WalletData(address: g1Wallet.address))
|
||||
]),
|
||||
dense: false,
|
||||
isThreeLine: false,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
walletsProfilesClass.address = g1Wallet.address;
|
||||
return WalletViewScreen(
|
||||
address: g1Wallet.address,
|
||||
username: duniterIndexer.walletNameIndexer[
|
||||
g1Wallet.address] ??
|
||||
'',
|
||||
avatar: g1WalletsBox
|
||||
.get(g1Wallet.address)
|
||||
?.avatar,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}),
|
||||
),
|
||||
]),
|
||||
)
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,117 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/cesium_plus.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:gecko/screens/certifications.dart';
|
||||
import 'package:gecko/widgets/balance.dart';
|
||||
import 'package:gecko/widgets/certifications.dart';
|
||||
import 'package:gecko/widgets/commons/offline_info.dart';
|
||||
import 'package:gecko/widgets/idty_status.dart';
|
||||
import 'package:gecko/widgets/page_route_no_transition.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class HeaderProfile extends StatelessWidget {
|
||||
const HeaderProfile({
|
||||
Key? key,
|
||||
required this.address,
|
||||
required this.username,
|
||||
}) : super(key: key);
|
||||
|
||||
final String address;
|
||||
final String? username;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const double avatarSize = 140;
|
||||
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
|
||||
final walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
|
||||
return Stack(children: <Widget>[
|
||||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
bool isAccountExist = walletOptions.balanceCache[address] != 0;
|
||||
return Container(
|
||||
height: 180,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
isAccountExist ? yellowC : Colors.grey[400]!,
|
||||
isAccountExist ? const Color(0xFFE7811A) : Colors.grey[600]!,
|
||||
],
|
||||
),
|
||||
));
|
||||
}),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 30, right: 40),
|
||||
child: Row(children: <Widget>[
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 10,
|
||||
color: yellowC,
|
||||
),
|
||||
Row(children: [
|
||||
GestureDetector(
|
||||
key: keyCopyAddress,
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: address));
|
||||
snackCopyKey(context);
|
||||
},
|
||||
child: Text(
|
||||
getShortPubkey(address),
|
||||
style: const TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 25),
|
||||
Balance(address: address, size: 22),
|
||||
const SizedBox(height: 10),
|
||||
InkWell(
|
||||
onTap: () => duniterIndexer.walletNameIndexer[address] != null
|
||||
? {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageNoTransit(builder: (context) {
|
||||
return CertificationsScreen(
|
||||
address: address,
|
||||
username: duniterIndexer
|
||||
.walletNameIndexer[address]!);
|
||||
}),
|
||||
),
|
||||
}
|
||||
: null,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
IdentityStatus(
|
||||
address: address,
|
||||
isOwner: false,
|
||||
color: Colors.black),
|
||||
Certifications(address: address, size: 14)
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
const Spacer(),
|
||||
Column(children: <Widget>[
|
||||
ClipOval(
|
||||
child: defaultAvatar(avatarSize),
|
||||
),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
const OfflineInfo(),
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,233 +0,0 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/queries_indexer.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/widgets/transaction_tile.dart';
|
||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class HistoryQuery extends StatelessWidget {
|
||||
const HistoryQuery({Key? key, required this.address}) : super(key: key);
|
||||
final String address;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
|
||||
|
||||
final ScrollController scrollController = ScrollController();
|
||||
FetchMoreOptions? opts;
|
||||
|
||||
int nPage = 1;
|
||||
int nRepositories = 20;
|
||||
|
||||
if (indexerEndpoint == '') {
|
||||
return Column(children: <Widget>[
|
||||
const SizedBox(height: 50),
|
||||
Text(
|
||||
"noNetworkNoHistory".tr(),
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
final httpLink = HttpLink(
|
||||
'$indexerEndpoint/v1beta1/relay',
|
||||
);
|
||||
|
||||
final client = ValueNotifier(
|
||||
GraphQLClient(
|
||||
cache: GraphQLCache(),
|
||||
link: httpLink,
|
||||
),
|
||||
);
|
||||
|
||||
return GraphQLProvider(
|
||||
client: client,
|
||||
child: Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Query(
|
||||
options: QueryOptions(
|
||||
document: gql(getHistoryByAddressQ),
|
||||
variables: <String, dynamic>{
|
||||
'address': address,
|
||||
'number': 20,
|
||||
'cursor': null
|
||||
},
|
||||
),
|
||||
builder: (QueryResult result, {fetchMore, refetch}) {
|
||||
if (result.isLoading && result.data == null) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: orangeC,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (result.hasException) {
|
||||
log.e('Error Indexer: ${result.exception}');
|
||||
return Column(children: <Widget>[
|
||||
const SizedBox(height: 50),
|
||||
Text(
|
||||
"noNetworkNoHistory".tr(),
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
]);
|
||||
} else if (result
|
||||
.data?['transaction_connection']?['edges'].isEmpty) {
|
||||
return Column(children: <Widget>[
|
||||
const SizedBox(height: 50),
|
||||
Text(
|
||||
"noDataToDisplay".tr(),
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
if (result.isNotLoading) {
|
||||
if (duniterIndexer.fetchMoreCursor == null) nPage = 1;
|
||||
|
||||
// log.d('nPage: $nPage');
|
||||
|
||||
if (nPage <= 3) {
|
||||
nRepositories = 20;
|
||||
} else if (nPage <= 6) {
|
||||
nRepositories = 40;
|
||||
} else if (nPage <= 12) {
|
||||
nRepositories = 80;
|
||||
} else {
|
||||
nRepositories = 120;
|
||||
}
|
||||
nPage++;
|
||||
opts = duniterIndexer.mergeQueryResult(
|
||||
result, opts, address, nRepositories);
|
||||
}
|
||||
|
||||
// Build history list
|
||||
return NotificationListener(
|
||||
child: Builder(
|
||||
builder: (context) => Expanded(
|
||||
child: ListView(
|
||||
key: keyListTransactions,
|
||||
controller: scrollController,
|
||||
children: <Widget>[historyView(context, result)],
|
||||
),
|
||||
),
|
||||
),
|
||||
onNotification: (dynamic t) {
|
||||
if (t is ScrollEndNotification &&
|
||||
scrollController.position.pixels >=
|
||||
scrollController.position.maxScrollExtent * 0.7 &&
|
||||
duniterIndexer.pageInfo!['hasNextPage'] &&
|
||||
result.isNotLoading) {
|
||||
fetchMore!(opts!);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget historyView(context, result) {
|
||||
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
|
||||
int keyID = 0;
|
||||
const double avatarSize = 200;
|
||||
String? lastDateDelimiter;
|
||||
bool? isDouble;
|
||||
bool isMigrationPassed = false;
|
||||
|
||||
return duniterIndexer.transBC == null
|
||||
? Column(children: <Widget>[
|
||||
const SizedBox(height: 50),
|
||||
Text(
|
||||
"noTransactionToDisplay".tr(),
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
])
|
||||
: Column(children: <Widget>[
|
||||
Column(
|
||||
children: duniterIndexer.transBC!.map((repository) {
|
||||
final answer =
|
||||
computeHistoryView(repository, lastDateDelimiter, isDouble);
|
||||
isDouble = lastDateDelimiter == answer['dateDelimiter'] ||
|
||||
answer['dateDelimiter'] == '';
|
||||
lastDateDelimiter = answer['dateDelimiter'];
|
||||
bool isMigrationTime = false;
|
||||
if (answer['isMigrationTime'] && !isMigrationPassed) {
|
||||
isMigrationPassed = true;
|
||||
isMigrationTime = true;
|
||||
}
|
||||
|
||||
return Column(children: <Widget>[
|
||||
if (isMigrationTime)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 30),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Image(
|
||||
image: AssetImage('assets/party.png'), height: 40),
|
||||
const SizedBox(width: 40),
|
||||
Text(
|
||||
'blockchainStart'.tr(),
|
||||
style: const TextStyle(
|
||||
fontSize: 25,
|
||||
color: Colors.blueAccent,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
const SizedBox(width: 40),
|
||||
const Image(
|
||||
image: AssetImage('assets/party.png'), height: 40),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (!isDouble!)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 30),
|
||||
child: Text(
|
||||
answer['dateDelimiter'],
|
||||
style: const TextStyle(
|
||||
fontSize: 23,
|
||||
color: orangeC,
|
||||
fontWeight: FontWeight.w300),
|
||||
),
|
||||
),
|
||||
TransactionTile(
|
||||
keyID: keyID,
|
||||
avatarSize: avatarSize,
|
||||
repository: repository,
|
||||
dateForm: answer['dateForm'],
|
||||
finalAmount: answer['finalAmount'],
|
||||
duniterIndexer: duniterIndexer,
|
||||
context: context),
|
||||
]);
|
||||
}).toList()),
|
||||
if (result.isLoading && duniterIndexer.pageInfo!['hasPreviousPage'])
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const <Widget>[
|
||||
CircularProgressIndicator(),
|
||||
],
|
||||
),
|
||||
if (!duniterIndexer.pageInfo!['hasNextPage'])
|
||||
Column(
|
||||
children: <Widget>[
|
||||
const SizedBox(height: 15),
|
||||
Text("historyStart".tr(),
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 20)),
|
||||
const SizedBox(height: 15)
|
||||
],
|
||||
)
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/widgets/commons/animated_text.dart';
|
||||
import 'package:gecko/widgets/name_by_address.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class IdentityStatus extends StatelessWidget {
|
||||
const IdentityStatus(
|
||||
{Key? key,
|
||||
required this.address,
|
||||
this.isOwner = false,
|
||||
this.color = Colors.black})
|
||||
: super(key: key);
|
||||
final String address;
|
||||
final bool isOwner;
|
||||
final Color color;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
|
||||
|
||||
return Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
return FutureBuilder(
|
||||
future: sub.idtyStatus(address),
|
||||
initialData: '',
|
||||
builder: (context, snapshot) {
|
||||
duniterIndexer.idtyStatusCache[address] = snapshot.data.toString();
|
||||
switch (snapshot.data.toString()) {
|
||||
case 'noid':
|
||||
{
|
||||
return showText('noIdentity'.tr());
|
||||
}
|
||||
case 'Created':
|
||||
{
|
||||
return showText('identityCreated'.tr());
|
||||
}
|
||||
case 'ConfirmedByOwner':
|
||||
{
|
||||
return isOwner
|
||||
? showText('identityConfirmed'.tr())
|
||||
: NameByAddress(
|
||||
wallet: WalletData(address: address),
|
||||
size: 20,
|
||||
color: Colors.grey[700]!,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontStyle: FontStyle.italic);
|
||||
}
|
||||
case 'Validated':
|
||||
{
|
||||
return isOwner
|
||||
? showText('memberValidated'.tr(), 18, true)
|
||||
: NameByAddress(
|
||||
wallet: WalletData(address: address),
|
||||
size: 20,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontStyle: FontStyle.normal);
|
||||
}
|
||||
case 'expired':
|
||||
{
|
||||
return showText('identityExpired'.tr());
|
||||
}
|
||||
}
|
||||
return SizedBox(
|
||||
child: showText('', 18, false, false),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
AnimatedFadeOutIn showText(String text,
|
||||
[double size = 18, bool bold = false, bool smooth = true]) {
|
||||
// log.d('$address $text');
|
||||
return AnimatedFadeOutIn<String>(
|
||||
data: text,
|
||||
duration: Duration(milliseconds: smooth ? 200 : 0),
|
||||
builder: (value) => Text(
|
||||
value,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: size,
|
||||
color: bold ? color : Colors.black,
|
||||
fontWeight: bold ? FontWeight.w500 : FontWeight.w400),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/g1_wallets_list.dart';
|
||||
import 'package:gecko/models/queries_indexer.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/widgets/wallet_name.dart';
|
||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:truncate/truncate.dart';
|
||||
|
||||
class NameByAddress extends StatelessWidget {
|
||||
const NameByAddress(
|
||||
{Key? key,
|
||||
required this.wallet,
|
||||
this.size = 20,
|
||||
this.color = Colors.black,
|
||||
this.fontWeight = FontWeight.w400,
|
||||
this.fontStyle = FontStyle.italic})
|
||||
: super(key: key);
|
||||
final WalletData wallet;
|
||||
final Color color;
|
||||
final double size;
|
||||
final FontWeight fontWeight;
|
||||
final FontStyle fontStyle;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
|
||||
|
||||
if (indexerEndpoint == '') {
|
||||
return WalletName(wallet: wallet, size: size, color: color);
|
||||
}
|
||||
|
||||
final httpLink = HttpLink(
|
||||
'$indexerEndpoint/v1/graphql',
|
||||
);
|
||||
|
||||
final client = ValueNotifier(
|
||||
GraphQLClient(
|
||||
cache: GraphQLCache(store: HiveStore()),
|
||||
link: httpLink,
|
||||
),
|
||||
);
|
||||
return GraphQLProvider(
|
||||
client: client,
|
||||
child: Query(
|
||||
options: QueryOptions(
|
||||
document: gql(
|
||||
getNameByAddressQ), // this is the query string you just created
|
||||
variables: {
|
||||
'address': wallet.address,
|
||||
},
|
||||
// pollInterval: const Duration(seconds: 10),
|
||||
),
|
||||
builder: (QueryResult result,
|
||||
{VoidCallback? refetch, FetchMore? fetchMore}) {
|
||||
if (result.hasException) {
|
||||
return Text(result.exception.toString());
|
||||
}
|
||||
|
||||
if (result.isLoading) {
|
||||
return const Text('Loading');
|
||||
}
|
||||
|
||||
duniterIndexer.walletNameIndexer[wallet.address] =
|
||||
result.data?['account_by_pk']?['identity']?['name'];
|
||||
|
||||
g1WalletsBox.put(
|
||||
wallet.address,
|
||||
G1WalletsList(
|
||||
address: wallet.address,
|
||||
username:
|
||||
duniterIndexer.walletNameIndexer[wallet.address]));
|
||||
|
||||
// log.d(g1WalletsBox.toMap().values.first.username);
|
||||
|
||||
if (duniterIndexer.walletNameIndexer[wallet.address] == null) {
|
||||
return WalletName(wallet: wallet, size: size, color: color);
|
||||
}
|
||||
|
||||
return Text(
|
||||
color == Colors.grey[700]!
|
||||
? '(${duniterIndexer.walletNameIndexer[wallet.address]!})'
|
||||
: truncate(
|
||||
duniterIndexer.walletNameIndexer[wallet.address]!, 20),
|
||||
style: TextStyle(
|
||||
fontSize: size,
|
||||
color: color,
|
||||
fontWeight: fontWeight,
|
||||
fontStyle: fontStyle,
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class PageNoTransit extends MaterialPageRoute {
|
||||
PageNoTransit({builder}) : super(builder: builder);
|
||||
|
||||
@override
|
||||
Duration get transitionDuration => const Duration(milliseconds: 0);
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/queries_indexer.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/cesium_plus.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/providers/search.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:gecko/screens/wallet_view.dart';
|
||||
import 'package:gecko/widgets/balance.dart';
|
||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class SearchIdentityQuery extends StatelessWidget {
|
||||
const SearchIdentityQuery({Key? key, required this.name}) : super(key: key);
|
||||
final String name;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
WalletsProfilesProvider walletsProfiles =
|
||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
|
||||
final searchProvider = Provider.of<SearchProvider>(context, listen: false);
|
||||
if (indexerEndpoint == '') {
|
||||
return const Text('Aucun résultat');
|
||||
}
|
||||
|
||||
log.d(indexerEndpoint);
|
||||
final httpLink = HttpLink(
|
||||
'$indexerEndpoint/v1/graphql',
|
||||
);
|
||||
|
||||
final client = ValueNotifier(
|
||||
GraphQLClient(
|
||||
cache: GraphQLCache(
|
||||
store: HiveStore()), // GraphQLCache(store: HiveStore())
|
||||
link: httpLink,
|
||||
),
|
||||
);
|
||||
return GraphQLProvider(
|
||||
client: client,
|
||||
child: Query(
|
||||
options: QueryOptions(
|
||||
document: gql(
|
||||
searchAddressByNameQ), // this is the query string you just created
|
||||
variables: {
|
||||
'name': name,
|
||||
},
|
||||
// pollInterval: const Duration(seconds: 10),
|
||||
),
|
||||
builder: (QueryResult result,
|
||||
{VoidCallback? refetch, FetchMore? fetchMore}) {
|
||||
if (result.hasException) {
|
||||
return Text(result.exception.toString());
|
||||
}
|
||||
|
||||
if (result.isLoading) {
|
||||
return Text('loading'.tr());
|
||||
}
|
||||
|
||||
final List identities = result.data?['search_identity'] ?? [];
|
||||
|
||||
if (identities.isEmpty) {
|
||||
return Text('noResult'.tr());
|
||||
}
|
||||
|
||||
for (Map profile in identities) {
|
||||
duniterIndexer.walletNameIndexer
|
||||
.putIfAbsent(profile['pubkey'], () => profile['name']);
|
||||
}
|
||||
|
||||
searchProvider.resultLenght = identities.length;
|
||||
// TODO: Find a way to reload a provider here, in Widget build...
|
||||
|
||||
double avatarSize = 55;
|
||||
return Expanded(
|
||||
child: ListView(children: <Widget>[
|
||||
for (Map profile in identities)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5),
|
||||
child: ListTile(
|
||||
key: keySearchResult(profile['pubkey']),
|
||||
horizontalTitleGap: 40,
|
||||
contentPadding: const EdgeInsets.all(5),
|
||||
leading: defaultAvatar(avatarSize),
|
||||
title: Row(children: <Widget>[
|
||||
Text(getShortPubkey(profile['pubkey']),
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Monospace',
|
||||
fontWeight: FontWeight.w500),
|
||||
textAlign: TextAlign.center),
|
||||
]),
|
||||
trailing: SizedBox(
|
||||
width: 110,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Balance(
|
||||
address: profile['pubkey'], size: 16),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
subtitle: Row(children: <Widget>[
|
||||
Text(profile['name'] ?? '',
|
||||
style: const TextStyle(
|
||||
fontSize: 18, fontWeight: FontWeight.w500),
|
||||
textAlign: TextAlign.center),
|
||||
]),
|
||||
dense: false,
|
||||
isThreeLine: false,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
walletsProfiles.address = profile['pubkey'];
|
||||
return WalletViewScreen(
|
||||
address: profile['pubkey'],
|
||||
username: name,
|
||||
avatar:
|
||||
g1WalletsBox.get(profile['pubkey'])?.avatar,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/g1_wallets_list.dart';
|
||||
import 'package:gecko/models/wallet_data.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/cesium_plus.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/providers/search.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallets_profiles.dart';
|
||||
import 'package:gecko/screens/wallet_view.dart';
|
||||
import 'package:gecko/widgets/balance.dart';
|
||||
import 'package:gecko/widgets/name_by_address.dart';
|
||||
import 'package:gecko/widgets/search_identity_query.dart';
|
||||
|
||||
class SearchResult extends StatelessWidget {
|
||||
const SearchResult({
|
||||
Key? key,
|
||||
required this.searchProvider,
|
||||
required this.duniterIndexer,
|
||||
required this.avatarSize,
|
||||
required this.walletsProfilesClass,
|
||||
}) : super(key: key);
|
||||
|
||||
final SearchProvider searchProvider;
|
||||
final DuniterIndexer duniterIndexer;
|
||||
final double avatarSize;
|
||||
final WalletsProfilesProvider walletsProfilesClass;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FutureBuilder(
|
||||
future: searchProvider.searchAddress(),
|
||||
builder: (context, AsyncSnapshot<List?> snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.data?.isEmpty ?? true) {
|
||||
return SearchIdentityQuery(
|
||||
name: searchProvider.searchController.text);
|
||||
// const Text('Aucun résultat');
|
||||
} else {
|
||||
return Expanded(
|
||||
child: ListView(children: <Widget>[
|
||||
for (G1WalletsList g1Wallet in snapshot.data ?? [])
|
||||
resultTile(g1Wallet, context),
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
return const Center(
|
||||
heightFactor: 5,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 3,
|
||||
backgroundColor: yellowC,
|
||||
color: orangeC,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Padding resultTile(G1WalletsList g1Wallet, BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5),
|
||||
child: ListTile(
|
||||
key: keySearchResult(g1Wallet.address),
|
||||
horizontalTitleGap: 40,
|
||||
contentPadding: const EdgeInsets.all(5),
|
||||
leading: defaultAvatar(avatarSize),
|
||||
title: Row(children: <Widget>[
|
||||
Text(getShortPubkey(g1Wallet.address),
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Monospace',
|
||||
fontWeight: FontWeight.w500),
|
||||
textAlign: TextAlign.center),
|
||||
]),
|
||||
trailing:
|
||||
Column(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
SizedBox(
|
||||
width: 110,
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.end, children: [
|
||||
Column(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Balance(address: g1Wallet.address, size: 16),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
]),
|
||||
subtitle: Row(children: <Widget>[
|
||||
NameByAddress(
|
||||
wallet: WalletData(address: g1Wallet.address),
|
||||
),
|
||||
]),
|
||||
dense: false,
|
||||
isThreeLine: false,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
walletsProfilesClass.address = g1Wallet.address;
|
||||
return WalletViewScreen(
|
||||
address: g1Wallet.address,
|
||||
username:
|
||||
duniterIndexer.walletNameIndexer[g1Wallet.address] ?? '',
|
||||
avatar: g1WalletsBox.get(g1Wallet.address)?.avatar,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class TemplateWidget extends StatelessWidget {
|
||||
const TemplateWidget(
|
||||
{Key? key, required this.address, this.color = Colors.black})
|
||||
: super(key: key);
|
||||
final String address;
|
||||
final Color color;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
return const Text('Hello Widget');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/cesium_plus.dart';
|
||||
import 'package:gecko/providers/duniter_indexer.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/screens/wallet_view.dart';
|
||||
import 'package:gecko/widgets/page_route_no_transition.dart';
|
||||
|
||||
class TransactionTile extends StatelessWidget {
|
||||
const TransactionTile({
|
||||
Key? key,
|
||||
required this.keyID,
|
||||
required this.avatarSize,
|
||||
required this.repository,
|
||||
required this.dateForm,
|
||||
required this.finalAmount,
|
||||
required this.duniterIndexer,
|
||||
required this.context,
|
||||
}) : super(key: key);
|
||||
|
||||
final int keyID;
|
||||
final double avatarSize;
|
||||
final List repository;
|
||||
final String dateForm;
|
||||
final String finalAmount;
|
||||
final DuniterIndexer duniterIndexer;
|
||||
final BuildContext context;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final newKey = keyID + 1;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 0),
|
||||
child: ListTile(
|
||||
key: keyTransaction(newKey),
|
||||
contentPadding:
|
||||
const EdgeInsets.only(left: 20, right: 30, top: 15, bottom: 15),
|
||||
leading: ClipOval(
|
||||
child: defaultAvatar(avatarSize),
|
||||
),
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 5),
|
||||
child: Text(getShortPubkey(repository[1]),
|
||||
style: const TextStyle(fontSize: 18, fontFamily: 'Monospace')),
|
||||
),
|
||||
subtitle: RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: 17,
|
||||
color: Colors.grey[700],
|
||||
),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: dateForm,
|
||||
),
|
||||
if (repository[2] != '')
|
||||
TextSpan(
|
||||
text: ' · ',
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
color: Colors.grey[550],
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: repository[2],
|
||||
style: TextStyle(
|
||||
fontStyle: FontStyle.italic,
|
||||
color: Colors.grey[600],
|
||||
fontSize: 19),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
trailing: Text(finalAmount,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: repository[4] == 'RECEIVED'
|
||||
? Colors.green[700]
|
||||
: Colors.blue[700]),
|
||||
textAlign: TextAlign.justify),
|
||||
dense: false,
|
||||
isThreeLine: false,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageNoTransit(builder: (context) {
|
||||
return WalletViewScreen(
|
||||
address: repository[1],
|
||||
username: repository[2] ?? '',
|
||||
);
|
||||
}),
|
||||
);
|
||||
// Navigator.pop(context);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
|
||||
class UdUnitDisplay extends StatelessWidget {
|
||||
const UdUnitDisplay({
|
||||
Key? key,
|
||||
required this.size,
|
||||
required this.color,
|
||||
}) : super(key: key);
|
||||
|
||||
final double size;
|
||||
final Color color;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||
return isUdUnit
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
'ud'.tr(args: ['']),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9, color: color),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
currencyName,
|
||||
style: TextStyle(
|
||||
fontSize: (isTall ? size : size * 0.9) * 0.7,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: color),
|
||||
),
|
||||
const SizedBox(height: 15)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
: Text(currencyName,
|
||||
style:
|
||||
TextStyle(fontSize: isTall ? size : size * 0.9, color: color));
|
||||
}
|
||||
}
|