UI: upgrade responsive_framework with breaking sizes

This commit is contained in:
poka 2023-12-10 01:20:23 +01:00
parent 6d284b7ff8
commit 2830a9d005
101 changed files with 2403 additions and 2574 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -159,8 +159,8 @@
"days": "{} days", "days": "{} days",
"months": "{} months", "months": "{} months",
"certify": "Certify this\nidentity", "certify": "Certify this\nidentity",
"from": "From:", "from": "From:{}",
"to": "To:", "to": "To:{}",
"amount": "Amount:", "amount": "Amount:",
"choiceOfSourceWallet": "Choose a source wallet", "choiceOfSourceWallet": "Choose a source wallet",
"extrinsicInProgress": "{} in progress", "extrinsicInProgress": "{} in progress",
@ -171,7 +171,7 @@
"cancel": "Cancel", "cancel": "Cancel",
"inBlockchainResult": "In {} blockchain", "inBlockchainResult": "In {} blockchain",
"search": "Search an identity\nor an address", "search": "Search an identity\nor an address",
"currencyNode": "{} node :", "currencyNode": "node",
"contactsManagementWithNbr": "My contacts ({})", "contactsManagementWithNbr": "My contacts ({})",
"contactsManagement": "My contacts", "contactsManagement": "My contacts",
"noContacts": "You don't have any contact", "noContacts": "You don't have any contact",
@ -182,7 +182,7 @@
"importDerivationsInProgress": "Import address {}/{}", "importDerivationsInProgress": "Import address {}/{}",
"youAreOffline": "You are offline...", "youAreOffline": "You are offline...",
"importG1v1": "Import old G1v1 account", "importG1v1": "Import old G1v1 account",
"selectDestWallet": "Select a target wallet:", "migrateToThisWallet": "Migrate to this wallet:",
"youMustWaitBeforeCashoutThisAccount": "You have to wait a few moment before migrate this account", "youMustWaitBeforeCashoutThisAccount": "You have to wait a few moment before migrate this account",
"thisAccountIsEmpty": "This account is empty", "thisAccountIsEmpty": "This account is empty",
"youCannotMigrateIdentityToExistingIdentity": "You cannot migrate an identity\nto an account that already has an identity", "youCannotMigrateIdentityToExistingIdentity": "You cannot migrate an identity\nto an account that already has an identity",

View File

@ -160,8 +160,8 @@
"days": "{} dias", "days": "{} dias",
"months": "{} meses", "months": "{} meses",
"certify": "Certificar esta\nidentidad", "certify": "Certificar esta\nidentidad",
"from": "De:", "from": "De:{}",
"to": "A:", "to": "A:{}",
"amount": "Importe:", "amount": "Importe:",
"choiceOfSourceWallet": "Elige un monedero de origen", "choiceOfSourceWallet": "Elige un monedero de origen",
"extrinsicInProgress": "{} en progreso", "extrinsicInProgress": "{} en progreso",
@ -172,7 +172,7 @@
"cancel": "Cancelar", "cancel": "Cancelar",
"inBlockchainResult": "En la blockchain {}", "inBlockchainResult": "En la blockchain {}",
"search": "Buscar una identidad\no una dirección", "search": "Buscar una identidad\no una dirección",
"currencyNode": "Nodo {} :", "currencyNode": "Nodo",
"contactsManagementWithNbr": "Mis contactos ({})", "contactsManagementWithNbr": "Mis contactos ({})",
"contactsManagement": "Mis contactos", "contactsManagement": "Mis contactos",
"noContacts": "No tienes ningún contacto", "noContacts": "No tienes ningún contacto",
@ -183,7 +183,7 @@
"importDerivationsInProgress": "Import address {}/{}", "importDerivationsInProgress": "Import address {}/{}",
"youAreOffline": "Estás desconectado...", "youAreOffline": "Estás desconectado...",
"importG1v1": "Importar la cuenta antigua de G1v1", "importG1v1": "Importar la cuenta antigua de G1v1",
"selectDestWallet": "Selecciona un monedero destino:", "migrateToThisWallet": "Migrate to this wallet:",
"youMustWaitBeforeCashoutThisAccount": "Tienes que esperar unos minutos antes de migrar esta cuenta", "youMustWaitBeforeCashoutThisAccount": "Tienes que esperar unos minutos antes de migrar esta cuenta",
"thisAccountIsEmpty": "Esta cuenta está vacía", "thisAccountIsEmpty": "Esta cuenta está vacía",
"youCannotMigrateIdentityToExistingIdentity": "No se puede migrar una identidad\na una cuenta que ya tiene una identidad", "youCannotMigrateIdentityToExistingIdentity": "No se puede migrar una identidad\na una cuenta que ya tiene una identidad",

View File

@ -159,8 +159,8 @@
"days": "{} jours", "days": "{} jours",
"months": "{} mois", "months": "{} mois",
"certify": "Certifier cette\nidentité", "certify": "Certifier cette\nidentité",
"from": "Depuis:", "from": "Depuis:{}",
"to": "Vers:", "to": "Vers:{}",
"amount": "Montant:", "amount": "Montant:",
"choiceOfSourceWallet": "Choix du portefeuille source", "choiceOfSourceWallet": "Choix du portefeuille source",
"extrinsicInProgress": "{} en cours", "extrinsicInProgress": "{} en cours",
@ -171,7 +171,7 @@
"cancel": "Annuler", "cancel": "Annuler",
"inBlockchainResult": "Dans la blockchain {}", "inBlockchainResult": "Dans la blockchain {}",
"search": "Rechercher une identité\nou une adresse", "search": "Rechercher une identité\nou une adresse",
"currencyNode": "Noeud {} :", "currencyNode": "Noeud",
"contactsManagementWithNbr": "Mes contacts ({})", "contactsManagementWithNbr": "Mes contacts ({})",
"contactsManagement": "Mes contacts", "contactsManagement": "Mes contacts",
"noContacts": "Vous n'avez aucun contact", "noContacts": "Vous n'avez aucun contact",
@ -182,7 +182,7 @@
"importDerivationsInProgress": "Importation de l'adresse {}/{}", "importDerivationsInProgress": "Importation de l'adresse {}/{}",
"youAreOffline": "Vous êtes hors ligne...", "youAreOffline": "Vous êtes hors ligne...",
"importG1v1": "Importer un ancien compte G1v1", "importG1v1": "Importer un ancien compte G1v1",
"selectDestWallet": "Sélectionnez un portefeuille cible:", "migrateToThisWallet": "Migrer vers ce portefeuille:",
"youMustWaitBeforeCashoutThisAccount": "Vous devez attendre quelques minutes\navant de pouvoir migrer ce compte", "youMustWaitBeforeCashoutThisAccount": "Vous devez attendre quelques minutes\navant de pouvoir migrer ce compte",
"thisAccountIsEmpty": "Ce compte est vide", "thisAccountIsEmpty": "Ce compte est vide",
"youCannotMigrateIdentityToExistingIdentity": "Vous ne pouvez pas migrer une identité\nvers un compte disposant déjà d'une identité", "youCannotMigrateIdentityToExistingIdentity": "Vous ne pouvez pas migrer une identité\nvers un compte disposant déjà d'une identité",

View File

@ -172,7 +172,7 @@
"cancel": "Annulla", "cancel": "Annulla",
"inBlockchainResult": "Nella blockchain {}", "inBlockchainResult": "Nella blockchain {}",
"search": "Cerca una identitá\no un indirizzo", "search": "Cerca una identitá\no un indirizzo",
"currencyNode": "Nodo {} :", "currencyNode": "Nodo",
"contactsManagementWithNbr": "I miei contatti ({})", "contactsManagementWithNbr": "I miei contatti ({})",
"contactsManagement": "I miei contatti", "contactsManagement": "I miei contatti",
"noContacts": "Non ci sono contatti salvati", "noContacts": "Non ci sono contatti salvati",
@ -181,7 +181,7 @@
"derivationsScanProgress": "Scannerizzando l'indirizzo {}/{}", "derivationsScanProgress": "Scannerizzando l'indirizzo {}/{}",
"youAreOffline": "Disconnesso...", "youAreOffline": "Disconnesso...",
"importG1v1": "Importa il conto antico da G1v1, versione precedente", "importG1v1": "Importa il conto antico da G1v1, versione precedente",
"selectDestWallet": "Seleziona un portafoglio di destinazione:", "migrateToThisWallet": "Seleziona un portafoglio di destinazione:",
"youMustWaitBeforeCashoutThisAccount": "Devi aspettare qualche minuto prima di migrare questo conto", "youMustWaitBeforeCashoutThisAccount": "Devi aspettare qualche minuto prima di migrare questo conto",
"thisAccountIsEmpty": "Questo conto é vuoto", "thisAccountIsEmpty": "Questo conto é vuoto",
"youCannotMigrateIdentityToExistingIdentity": "Non si puó migrare un'identitá\na un conto che ne ha giá una", "youCannotMigrateIdentityToExistingIdentity": "Non si puó migrare un'identitá\na un conto che ne ha giá una",

1
devtools_options.yaml Normal file
View File

@ -0,0 +1 @@
extensions:

View File

@ -11,7 +11,6 @@ import 'tests_utility.dart';
Future changeNode() async { Future changeNode() async {
const ipAddress = '10.0.2.2'; const ipAddress = '10.0.2.2';
log.d('ip address: $ipAddress');
await tapKey(keyDrawerMenu); await tapKey(keyDrawerMenu);
await tapKey(keyParameters); await tapKey(keyParameters);

View File

@ -11,9 +11,7 @@ import 'package:provider/provider.dart';
import 'dart:io' as io; import 'dart:io' as io;
import 'package:gecko/main.dart' as app; import 'package:gecko/main.dart' as app;
const bool isHumanReading = false; const isHumanReading = false;
// final bool isHumanReading =
// dotenv.env['isHumanReading'] == 'true' ? true : false;
Timeout testTimeout([int seconds = 120]) => Timeout testTimeout([int seconds = 120]) =>
Timeout(Duration(seconds: isHumanReading ? 600 : seconds)); Timeout(Duration(seconds: isHumanReading ? 600 : seconds));
final sub = Provider.of<SubstrateSdk>(homeContext, listen: false); final sub = Provider.of<SubstrateSdk>(homeContext, listen: false);
@ -57,7 +55,7 @@ Future pump(
{Duration duration = const Duration(milliseconds: 300), {Duration duration = const Duration(milliseconds: 300),
int number = 1}) async { int number = 1}) async {
for (int i = 0; i < number; i++) { for (int i = 0; i < number; i++) {
log.d("pump $i"); log.i("pump $i");
await tester.pump(duration = duration); await tester.pump(duration = duration);
} }
} }
@ -78,7 +76,7 @@ Future tapKey(Key buttonKey,
await tester.pumpAndSettle(Duration(milliseconds: duration)); await tester.pumpAndSettle(Duration(milliseconds: duration));
} }
final Finder finder = customFinder ?? find.byKey(buttonKey); final Finder finder = customFinder ?? find.byKey(buttonKey);
log.d('INTEGRATION TEST: Tap on ${finder.describeMatch(Plurality.zero)}}'); log.i('INTEGRATION TEST: Tap on ${finder.describeMatch(Plurality.zero)}}');
await tester.tap(selectLast ? finder.last : finder); await tester.tap(selectLast ? finder.last : finder);
humanRead(); humanRead();
} }
@ -106,7 +104,7 @@ Future<void> waitForButtonEnabled(Key key,
bool reverse = false}) async { bool reverse = false}) async {
final end = DateTime.now().add(timeout); final end = DateTime.now().add(timeout);
log.d('INTEGRATION TEST: Wait for $key to be enabled'); log.i('INTEGRATION TEST: Wait for $key to be enabled');
do { do {
if (DateTime.now().isAfter(end)) { if (DateTime.now().isAfter(end)) {
@ -121,7 +119,7 @@ Future<void> waitForButtonEnabled(Key key,
Future goBack() async { Future goBack() async {
final NavigatorState navigator = tester.state(find.byType(Navigator)); final NavigatorState navigator = tester.state(find.byType(Navigator));
log.d('INTEGRATION TEST: Go back'); log.i('INTEGRATION TEST: Go back');
navigator.pop(); navigator.pop();
await tester.pumpAndSettle(); await tester.pumpAndSettle();
humanRead(); humanRead();
@ -131,7 +129,7 @@ Future enterText(Key fieldKey, String textIn, [int duration = 200]) async {
if (duration != 0) { if (duration != 0) {
await tester.pumpAndSettle(Duration(milliseconds: duration)); await tester.pumpAndSettle(Duration(milliseconds: duration));
} }
log.d('INTEGRATION TEST: Enter text: $textIn'); log.i('INTEGRATION TEST: Enter text: $textIn');
await tester.enterText(find.byKey(fieldKey), textIn); await tester.enterText(find.byKey(fieldKey), textIn);
humanRead(); humanRead();
} }
@ -145,7 +143,7 @@ Future<void> waitFor(String text,
final end = DateTime.now().add(timeout); final end = DateTime.now().add(timeout);
Finder finder = exactMatch ? find.text(text) : find.textContaining(text); Finder finder = exactMatch ? find.text(text) : find.textContaining(text);
log.d('INTEGRATION TEST: Wait for: $text'); log.i('INTEGRATION TEST: Wait for: $text');
final searchType = reverse ? 'reversed text' : 'text'; final searchType = reverse ? 'reversed text' : 'text';
@ -182,7 +180,7 @@ Future<bool> isIconPresent(IconData icon,
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final finder = find.byIcon(icon); final finder = find.byIcon(icon);
humanRead(); humanRead();
return finder.evaluate().isEmpty ? false : true; return finder.evaluate().isNotEmpty;
} }
Future spawnBlock({int number = 1, int duration = 200, int? until}) async { Future spawnBlock({int number = 1, int duration = 200, int? until}) async {

View File

@ -22,15 +22,12 @@ late Box<G1WalletsList> g1WalletsBox;
late Box<G1WalletsList> contactsBox; late Box<G1WalletsList> contactsBox;
// late Box keystoreBox; // late Box keystoreBox;
late Directory imageDirectory; late Directory imageDirectory;
late bool isTall;
String cesiumPod = "https://g1.data.le-sou.org"; String cesiumPod = "https://g1.data.le-sou.org";
// String cesiumPod = "https://g1.data.presles.fr"; // String cesiumPod = "https://g1.data.presles.fr";
// String cesiumPod = "https://g1.data.e-is.pro"; // String cesiumPod = "https://g1.data.e-is.pro";
// Responsive ratios
late bool isTall;
late double ratio;
// Contexts // Contexts
late BuildContext homeContext; late BuildContext homeContext;

View File

@ -139,17 +139,14 @@ class Gecko extends StatelessWidget {
localizationsDelegates: context.localizationDelegates, localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales, supportedLocales: context.supportedLocales,
locale: context.locale, locale: context.locale,
builder: (context, widget) => ResponsiveWrapper.builder( builder: (context, child) => ResponsiveBreakpoints.builder(
BouncingScrollWrapper.builder(context, widget!), child: child!,
maxWidth: 1200, breakpoints: [
minWidth: 480, const Breakpoint(start: 0, end: 450, name: MOBILE),
defaultScale: true, const Breakpoint(start: 451, end: 800, name: TABLET),
breakpoints: [ const Breakpoint(start: 801, end: double.infinity, name: DESKTOP),
const ResponsiveBreakpoint.resize(480, name: MOBILE), ],
const ResponsiveBreakpoint.autoScale(800, name: TABLET), ),
const ResponsiveBreakpoint.resize(1000, name: DESKTOP),
],
background: Container(color: backgroundColor)),
title: 'Ğecko', title: 'Ğecko',
theme: ThemeData( theme: ThemeData(
appBarTheme: const AppBarTheme( appBarTheme: const AppBarTheme(

View File

@ -0,0 +1,43 @@
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
double scaleSize(double size) {
final scale = MediaQuery.of(homeContext).size.width / 375;
return size * scale;
}
TextStyle scaledTextStyle({
double fontSize = 16,
double? height,
FontStyle? fontStyle,
FontWeight? fontWeight,
Color? color,
List<Shadow>? shadows,
String? fontFamily,
double? letterSpacing,
}) {
return TextStyle(
fontSize: scaleSize(fontSize),
height: height,
fontWeight: fontWeight,
fontStyle: fontStyle,
color: color,
shadows: shadows,
fontFamily: fontFamily,
letterSpacing: letterSpacing,
);
}
class ScaledSizedBox extends SizedBox {
ScaledSizedBox({
Key? key,
double? width,
double? height,
Widget? child,
}) : super(
key: key,
width: width != null ? scaleSize(width) : null,
height: height != null ? scaleSize(height) : null,
child: child,
);
}

View File

@ -28,6 +28,7 @@ final keyDragAndDrop = GlobalKey(debugLabel: 'keyDragAndDrop');
// Wallet options // Wallet options
const keyCopyAddress = Key('keyCopyAddress'); const keyCopyAddress = Key('keyCopyAddress');
const keyCopyPubkey = Key('keyCopyPubkey');
const keyOpenActivity = Key('keyOpenActivity'); const keyOpenActivity = Key('keyOpenActivity');
const keyManageMembership = Key('keyManageMembership'); const keyManageMembership = Key('keyManageMembership');
const keySetDefaultWallet = Key('keySetDefaultWallet'); const keySetDefaultWallet = Key('keySetDefaultWallet');

View File

@ -4,6 +4,7 @@ import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -194,8 +195,6 @@ class CesiumPlusProvider with ChangeNotifier {
List queryOptions = List queryOptions =
await _buildQuerySetAvatar(pubkeyV1, address, avatarString); await _buildQuerySetAvatar(pubkeyV1, address, avatarString);
log.d(queryOptions[0]);
log.d(jsonDecode(queryOptions[1]));
late Response response; late Response response;
try { try {
@ -211,7 +210,6 @@ class CesiumPlusProvider with ChangeNotifier {
.timeout( .timeout(
const Duration(seconds: 15), const Duration(seconds: 15),
); );
log.d(response.data);
return response.statusCode == 200; return response.statusCode == 200;
} catch (e) { } catch (e) {
log.e(e); log.e(e);
@ -260,4 +258,4 @@ class CesiumPlusProvider with ChangeNotifier {
} }
Image defaultAvatar(double size) => Image defaultAvatar(double size) =>
Image.asset(('assets/icon_user.png'), height: size); Image.asset(('assets/icon_user.png'), height: scaleSize(size));

View File

@ -3,6 +3,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/chest_data.dart'; import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
@ -42,7 +43,6 @@ class ChestProvider with ChangeNotifier {
List<String> getChestWallets(ChestData chest) { List<String> getChestWallets(ChestData chest) {
List<String> toDelete = []; List<String> toDelete = [];
log.d(chest.key);
walletBox.toMap().forEach((key, WalletData value) { walletBox.toMap().forEach((key, WalletData value) {
if (value.chest == chest.key) { if (value.chest == chest.key) {
toDelete.add(value.address); toDelete.add(value.address);
@ -54,19 +54,27 @@ class ChestProvider with ChangeNotifier {
Future<bool?> _confirmDeletingChest(context, String? walletName) async { Future<bool?> _confirmDeletingChest(context, String? walletName) async {
return showDialog<bool>( return showDialog<bool>(
context: context, context: context,
barrierDismissible: true, // user must tap button! barrierDismissible: true,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: Text('areYouSureToDeleteWallet'.tr(args: [walletName!])), title: Text(
'areYouSureToDeleteWallet'.tr(args: [walletName!]),
style: scaledTextStyle(fontSize: 17),
),
actions: <Widget>[ actions: <Widget>[
TextButton( TextButton(
child: Text("no".tr(), key: keyCancel), child: Text("no".tr(),
style:
scaledTextStyle(fontSize: 17, color: Colors.blueAccent),
key: keyCancel),
onPressed: () { onPressed: () {
Navigator.pop(context, false); Navigator.pop(context, false);
}, },
), ),
TextButton( TextButton(
child: Text("yes".tr(), key: keyConfirm), child: Text("yes".tr(),
style: scaledTextStyle(fontSize: 17, color: Colors.red),
key: keyConfirm),
onPressed: () { onPressed: () {
Navigator.pop(context, true); Navigator.pop(context, true);
}, },

View File

@ -30,7 +30,7 @@ class DuniterIndexer with ChangeNotifier {
final request = await client.postUrl(Uri.parse('$endpoint/v1/graphql')); final request = await client.postUrl(Uri.parse('$endpoint/v1/graphql'));
final response = await request.close(); final response = await request.close();
if (response.statusCode != 200) { if (response.statusCode != 200) {
log.d('INDEXER IS OFFLINE'); log.w('INDEXER IS OFFLINE');
indexerEndpoint = ''; indexerEndpoint = '';
isLoadingIndexer = false; isLoadingIndexer = false;
notifyListeners(); notifyListeners();
@ -46,7 +46,7 @@ class DuniterIndexer with ChangeNotifier {
return true; return true;
} }
} catch (e) { } catch (e) {
log.d('INDEXER IS OFFLINE'); log.w('INDEXER IS OFFLINE');
indexerEndpoint = ''; indexerEndpoint = '';
isLoadingIndexer = false; isLoadingIndexer = false;
notifyListeners(); notifyListeners();
@ -54,21 +54,6 @@ class DuniterIndexer with ChangeNotifier {
} }
} }
// Future checkIndexerEndpointBackground() async {
// final oldEndpoint = indexerEndpoint;
// while (true) {
// await Future.delayed(const Duration(seconds: 30));
// final isValid = await checkIndexerEndpoint(oldEndpoint);
// if (!isValid) {
// log.d('INDEXER IS OFFILINE');
// indexerEndpoint = '';
// } else {
// // log.d('Indexer is online');
// indexerEndpoint = oldEndpoint;
// }
// }
// }
Future<String> getValidIndexerEndpoint() async { Future<String> getValidIndexerEndpoint() async {
// await configBox.delete('indexerEndpoint'); // await configBox.delete('indexerEndpoint');
@ -77,7 +62,6 @@ class DuniterIndexer with ChangeNotifier {
.then((jsonStr) => jsonDecode(jsonStr)); .then((jsonStr) => jsonDecode(jsonStr));
// _listEndpoints.shuffle(); // _listEndpoints.shuffle();
log.d(listIndexerEndpoints);
listIndexerEndpoints.add('Personnalisé'); listIndexerEndpoints.add('Personnalisé');
if (configBox.containsKey('customIndexer')) { if (configBox.containsKey('customIndexer')) {
@ -140,7 +124,7 @@ class DuniterIndexer with ChangeNotifier {
} }
} while (statusCode != 200); } while (statusCode != 200);
log.i('INDEXER: $indexerEndpoint'); log.i('Indexer: $indexerEndpoint');
return indexerEndpoint; return indexerEndpoint;
} }
@ -203,7 +187,7 @@ class DuniterIndexer with ChangeNotifier {
if (fetchMoreCursor != null) { if (fetchMoreCursor != null) {
transBC = parseHistory(blockchainTX, pubkey); transBC = parseHistory(blockchainTX, pubkey);
} else { } else {
log.i("###### DEBUG H - Début de l'historique"); log.d("Activity start of $pubkey");
} }
return opts; return opts;
@ -222,7 +206,7 @@ Future<bool> isIdtyExist(String name) async {
'name': name, 'name': name,
}; };
final result = await _execQuery(isIdtyExistQ, variables); final result = await _execQuery(isIdtyExistQ, variables);
return result.data!['identity']?.isEmpty ?? false ? false : true; return result.data!['identity']?.isNotEmpty ?? false;
} }
Future<DateTime> getBlockStart() async { Future<DateTime> getBlockStart() async {
@ -311,12 +295,6 @@ Map computeHistoryView(repository, String address) {
bool isMigrationTime = bool isMigrationTime =
startBlockchainInitialized && date.compareTo(startBlockchainTime) < 0; startBlockchainInitialized && date.compareTo(startBlockchainTime) < 0;
//TODO: Migration date and transaction migration doesn't match, add this event to v2s indexer.
// log.d('debug date transaction: $date');
// log.d('debug date identity migration: ${sub.oldOwnerKeys[address]?[1]}');
// isChangeOwnerkeyTime = date.compareTo(sub.oldOwnerKeys[address]?[1] ?? DateTime(2000)) < 0;
return { return {
'finalAmount': finalAmount, 'finalAmount': finalAmount,
'isMigrationTime': isMigrationTime, 'isMigrationTime': isMigrationTime,

View File

@ -85,10 +85,8 @@ class GenerateWalletsProvider with ChangeNotifier {
final expectedWord = mnemo.split(' ')[nbrWord]; final expectedWord = mnemo.split(' ')[nbrWord];
final normInputWord = unorm.nfkd(inputWord); final normInputWord = unorm.nfkd(inputWord);
log.i("Is $expectedWord equal to input $normInputWord ?");
if (expectedWord == normInputWord || if (expectedWord == normInputWord ||
(kDebugMode && inputWord == 'triche')) { (kDebugMode && inputWord == 'triche')) {
log.d('Word is OK');
isAskedWordValid = true; isAskedWordValid = true;
askedWordColor = Colors.green[600]; askedWordColor = Colors.green[600];
// walletNameFocus.nextFocus(); // walletNameFocus.nextFocus();
@ -155,7 +153,6 @@ class GenerateWalletsProvider with ChangeNotifier {
String walletPubkey = cesiumWallet.pubkey; String walletPubkey = cesiumWallet.pubkey;
cesiumPubkey.text = walletPubkey; cesiumPubkey.text = walletPubkey;
log.d(walletPubkey);
} }
void cesiumIDisVisible() { void cesiumIDisVisible() {
@ -202,7 +199,7 @@ class GenerateWalletsProvider with ChangeNotifier {
if (bip39Words(appLang).contains(word.toLowerCase())) { if (bip39Words(appLang).contains(word.toLowerCase())) {
for (var bipWord in bip39Words(appLang)) { for (var bipWord in bip39Words(appLang)) {
if (bipWord.startsWith(word)) { if (bipWord.startsWith(word)) {
isValid = nbrMatch == 0 ? true : false; isValid = nbrMatch == 0;
if (checkRedondance) nbrMatch = nbrMatch + 1; if (checkRedondance) nbrMatch = nbrMatch + 1;
} }
} }
@ -357,7 +354,6 @@ class GenerateWalletsProvider with ChangeNotifier {
notifyListeners(); notifyListeners();
} }
log.d(scanedWalletNumber);
scanStatus = ScanDerivationsStatus.none; scanStatus = ScanDerivationsStatus.none;
scanedWalletNumber = scanedValidWalletNumber = -1; scanedWalletNumber = scanedValidWalletNumber = -1;
notifyListeners(); notifyListeners();
@ -375,8 +371,6 @@ class GenerateWalletsProvider with ChangeNotifier {
onTimeout: () => {}, onTimeout: () => {},
); );
log.d(
"${addressData.address!}: ${balance['transferableBalance']} $currencyName");
if (balance['transferableBalance'] != 0) { if (balance['transferableBalance'] != 0) {
String walletName = 'myRootWallet'.tr(); String walletName = 'myRootWallet'.tr();
await sub.importAccount(mnemonic: generatedMnemonic!, password: pin.text); await sub.importAccount(mnemonic: generatedMnemonic!, password: pin.text);

View File

@ -109,7 +109,6 @@ class HomeProvider with ChangeNotifier {
configBox.put('endpoint', listEndpoints); configBox.put('endpoint', listEndpoints);
} }
log.i('ENDPOINT: $listEndpoints');
return listEndpoints; return listEndpoints;
} }

View File

@ -26,30 +26,22 @@ class MyWalletsProvider with ChangeNotifier {
return configBox.get('currentChest'); return configBox.get('currentChest');
} }
bool checkIfWalletExist() { bool isWalletsExists() => chestBox.isNotEmpty;
if (chestBox.isEmpty) {
// log.i('No wallets detected');
return false;
} else {
return true;
}
}
Future<List<WalletData>> readAllWallets([int? chest]) async { Future<List<WalletData>> readAllWallets([int? chest]) async {
final sub = Provider.of<SubstrateSdk>(homeContext, listen: false); final sub = Provider.of<SubstrateSdk>(homeContext, listen: false);
chest = chest ?? configBox.get('currentChest') ?? 0; chest = chest ?? getCurrentChest();
listWallets.clear(); listWallets.clear();
final wallets = walletBox.toMap().values.toList(); final wallets = walletBox.toMap().values.toList();
Map<String, WalletData> walletsToScan = {}; Map<String, WalletData> walletsToScan = {};
for (var walletFromBox in wallets) { for (var walletFromBox in wallets) {
if (walletFromBox.chest == chest) { if (walletFromBox.chest != chest) {
// log.d('${walletFromBox.number} - ${walletFromBox.name}'); continue;
if (walletFromBox.identityStatus == IdtyStatus.unknown) { }
walletsToScan.putIfAbsent( if (walletFromBox.identityStatus == IdtyStatus.unknown) {
walletFromBox.address, (() => walletFromBox)); walletsToScan.putIfAbsent(walletFromBox.address, (() => walletFromBox));
} else { } else {
listWallets.add(walletFromBox); listWallets.add(walletFromBox);
}
} }
} }
@ -221,7 +213,7 @@ class MyWalletsProvider with ChangeNotifier {
if (listWallets.isEmpty) { if (listWallets.isEmpty) {
newDerivationNbr = 2; newDerivationNbr = 2;
} else { } else {
WalletData lastWallet = listWallets.reduce( final lastWallet = listWallets.reduce(
(curr, next) => curr.derivation! > next.derivation! ? curr : next); (curr, next) => curr.derivation! > next.derivation! ? curr : next);
if (lastWallet.derivation == -1) { if (lastWallet.derivation == -1) {
@ -237,7 +229,7 @@ class MyWalletsProvider with ChangeNotifier {
} }
int lockPin = 0; int lockPin = 0;
Future resetPinCode([int minutes = 15]) async { Future debounceResetPinCode([int minutes = 15]) async {
lockPin++; lockPin++;
final actualLock = lockPin; final actualLock = lockPin;
await Future.delayed( await Future.delayed(

View File

@ -5,73 +5,14 @@ import 'package:gecko/providers/wallets_profiles.dart';
class SearchProvider with ChangeNotifier { class SearchProvider with ChangeNotifier {
TextEditingController searchController = TextEditingController(); TextEditingController searchController = TextEditingController();
List searchResult = []; List searchResult = [];
final cacheDuring = 20 * 60 * 1000; //First number is minutes
int cacheTime = 0;
int resultLenght = 0; int resultLenght = 0;
void reload() { void reload() {
notifyListeners(); notifyListeners();
} }
// Future<List> searchBlockchain() async {
// searchResult.clear();
// int searchTime = DateTime.now().millisecondsSinceEpoch;
// WalletsProfilesProvider _walletProfiles = WalletsProfilesProvider('pubkey');
// if (cacheTime + cacheDuring <= searchTime) {
// g1WalletsBox.clear();
// // final url = Uri.parse('https://g1-stats.axiom-team.fr/data/forbes.json');
// // final response = await http.get(url);
// var dio = Dio();
// late Response response;
// try {
// response = await dio.get(
// 'https://g1-stats.axiom-team.fr/data/forbes.json',
// options: Options(
// sendTimeout: 5000,
// receiveTimeout: 10000,
// ),
// );
// // response = await http.post((Uri.parse(queryOptions[0])),
// // body: queryOptions[1], headers: queryOptions[2]);
// } catch (e) {
// log.e(e);
// }
// List<G1WalletsList> _listWallets = _parseG1Wallets(response.data)!;
// Map<String?, G1WalletsList> _mapWallets = {
// for (var e in _listWallets) e.pubkey: e
// };
// await g1WalletsBox.putAll(_mapWallets);
// cacheTime = DateTime.now().millisecondsSinceEpoch;
// }
// g1WalletsBox.toMap().forEach((key, value) {
// if ((value.id != null &&
// value.id!.username != null &&
// value.id!.username!
// .toLowerCase()
// .contains(searchController.text)) ||
// value.pubkey!.contains(searchController.text)) {
// searchResult.add(value);
// return;
// }
// });
// if (searchResult.isEmpty &&
// _walletProfiles.isPubkey(searchController.text)) {
// searchResult = [G1WalletsList(pubkey: searchController.text)];
// }
// return searchResult;
// }
Future<List<G1WalletsList>> searchAddress() async { Future<List<G1WalletsList>> searchAddress() async {
final walletProfiles = WalletsProfilesProvider('pubkey'); if (isAddress(searchController.text)) {
if (walletProfiles.isAddress(searchController.text)) {
G1WalletsList wallet = G1WalletsList(address: searchController.text); G1WalletsList wallet = G1WalletsList(address: searchController.text);
return [wallet]; return [wallet];
} else { } else {
@ -79,11 +20,3 @@ class SearchProvider with ChangeNotifier {
} }
} }
} }
// List<G1WalletsList>? _parseG1Wallets(var responseBody) {
// final parsed = responseBody.cast<Map<String, dynamic>>();
// return parsed
// .map<G1WalletsList>((json) => G1WalletsList.fromJson(json))
// .toList();
// }

View File

@ -40,8 +40,8 @@ class SubstrateSdk with ChangeNotifier {
String? transactionStatus; String? transactionStatus;
final int initSs58 = 42; final int initSs58 = 42;
Map<String, int> currencyParameters = {}; Map<String, int> currencyParameters = {};
TextEditingController csSalt = TextEditingController(); final csSalt = TextEditingController();
TextEditingController csPassword = TextEditingController(); final csPassword = TextEditingController();
String g1V1NewAddress = ''; String g1V1NewAddress = '';
String g1V1OldPubkey = ''; String g1V1OldPubkey = '';
bool isCesiumIDVisible = false; bool isCesiumIDVisible = false;
@ -140,35 +140,12 @@ class SubstrateSdk with ChangeNotifier {
final myWallets = final myWallets =
Provider.of<MyWalletsProvider>(homeContext, listen: false); Provider.of<MyWalletsProvider>(homeContext, listen: false);
final messageToSign = Uint8List.fromList(document.codeUnits); final messageToSign = Uint8List.fromList(document.codeUnits);
// final pubkeyV1 = json.decode(document)['issuer'];
// final address = await pubkeyV1ToAddress(pubkeyV1);
// final walletData = myWallets.getWalletDataByAddress(address);
// final derivationPath =
// walletData!.derivation == null ? '' : "//${walletData.derivation}";
// final seed = await getSeed(address, myWallets.pinCode);
// final addressEd25519 = await importAccount(
// mnemonic: seed,
// password: 'AAAAA',
// cryptoType: CryptoType.ed25519,
// derivePath: derivationPath);
// final pubkeyEd25519 = await addressToPubkeyB58(addressEd25519);
final signatureString = final signatureString =
await _signMessage(messageToSign, address, myWallets.pinCode); await _signMessage(messageToSign, address, myWallets.pinCode);
final signatureInt = HEX.decode(signatureString.substring(2)); final signatureInt = HEX.decode(signatureString.substring(2));
final signature64 = base64Encode(signatureInt); final signature64 = base64Encode(signatureInt);
// await deleteAccounts([addressEd25519]);
// log.d("""
// $addressEd25519
// $pubkeyEd25519
// $derivationPath
// $signature64
// """);
return signature64; return signature64;
} }
@ -232,7 +209,7 @@ class SubstrateSdk with ChangeNotifier {
Future<bool> hasAccountConsumers(String address) async { Future<bool> hasAccountConsumers(String address) async {
final accountInfo = await _getStorage('system.account("$address")'); final accountInfo = await _getStorage('system.account("$address")');
final consumers = accountInfo['consumers']; final consumers = accountInfo['consumers'];
return consumers == 0 ? false : true; return !(consumers == 0);
} }
Future<int> getUdValue() async { Future<int> getUdValue() async {
@ -355,9 +332,6 @@ class SubstrateSdk with ChangeNotifier {
} }
} }
// log.d(
// "debug computeUnclaimUds: ${pastReevals.reversed} --- $firstEligibleUd --- $currentUdIndex");
return totalAmount; return totalAmount;
} }
@ -462,7 +436,7 @@ class SubstrateSdk with ChangeNotifier {
if (idtyIndex == -1) return false; if (idtyIndex == -1) return false;
final isSmith = await _getStorage('smithMembership.membership($idtyIndex)'); final isSmith = await _getStorage('smithMembership.membership($idtyIndex)');
return isSmith == null ? false : true; return !(isSmith == null);
} }
Future<String> getGenesisHash() async { Future<String> getGenesisHash() async {
@ -471,8 +445,6 @@ class SubstrateSdk with ChangeNotifier {
wrapPromise: false, wrapPromise: false,
) ?? ) ??
[]; [];
// log.d('genesisHash: $genesisHash');
// log.d('genesisHash: ${HEX.decode(genesisHash.substring(2))}');
return genesisHash; return genesisHash;
} }
@ -497,23 +469,23 @@ class SubstrateSdk with ChangeNotifier {
} }
Future initCurrencyParameters() async { Future initCurrencyParameters() async {
try { const currencyParametersNames = {
currencyParameters['ss58'] = 'ss58': 'system.ss58Prefix.words',
await _getStorageConst('system.ss58Prefix.words'); 'minCertForMembership': 'wot.minCertForMembership.words',
currencyParameters['minCertForMembership'] = 'newAccountPrice': 'account.newAccountPrice.words',
await _getStorageConst('wot.minCertForMembership.words'); 'existentialDeposit': 'balances.existentialDeposit.words',
currencyParameters['newAccountPrice'] = 'certPeriod': 'cert.certPeriod.words',
await _getStorageConst('account.newAccountPrice.words'); 'certMaxByIssuer': 'cert.maxByIssuer.words',
currencyParameters['existentialDeposit'] = 'certValidityPeriod': 'cert.validityPeriod.words',
await _getStorageConst('balances.existentialDeposit.words'); };
currencyParameters['certPeriod'] =
await _getStorageConst('cert.certPeriod.words'); for (var param in currencyParametersNames.keys) {
currencyParameters['certMaxByIssuer'] = try {
await _getStorageConst('cert.maxByIssuer.words'); currencyParameters[param] =
currencyParameters['certValidityPeriod'] = await _getStorageConst(currencyParametersNames[param]!);
await _getStorageConst('cert.validityPeriod.words'); } catch (e) {
} catch (e) { log.e('error while getting param $param :: $e');
log.i('error while getting storageVals (network?) :: $e'); }
} }
log.i('currencyParameters: $currencyParameters'); log.i('currencyParameters: $currencyParameters');
} }
@ -603,7 +575,7 @@ class SubstrateSdk with ChangeNotifier {
// final dateText = await sdk.webView! // final dateText = await sdk.webView!
// .evalJavascript('api.tx($dateTextByte)', wrapPromise: false); // .evalJavascript('api.tx($dateTextByte)', wrapPromise: false);
// log.d('aaaaaaaaaaaaaaaaaaaaa: $dateText'); // log.d('Blockchain start: $dateText');
return DateFormat(); return DateFormat();
} }
@ -654,12 +626,10 @@ class SubstrateSdk with ChangeNotifier {
notifyListeners(); notifyListeners();
if (resNode != null) { if (resNode != null) {
nodeConnected = true; nodeConnected = true;
// await getSs58Prefix();
// Subscribe bloc number // Subscribe bloc number
sdk.api.setting.subscribeBestNumber((res) { sdk.api.setting.subscribeBestNumber((res) {
blocNumber = int.parse(res.toString()); blocNumber = int.parse(res.toString());
// log.d(sdk.api.connectedNode?.endpoint);
if (sdk.api.connectedNode?.endpoint == null) { if (sdk.api.connectedNode?.endpoint == null) {
nodeConnected = false; nodeConnected = false;
homeProvider.changeMessage("networkLost".tr(), 0); homeProvider.changeMessage("networkLost".tr(), 0);
@ -673,6 +643,7 @@ class SubstrateSdk with ChangeNotifier {
// Currency parameters // Currency parameters
await initCurrencyParameters(); await initCurrencyParameters();
// Indexer Blockchain start // Indexer Blockchain start
getBlockStart(); getBlockStart();
@ -681,15 +652,14 @@ class SubstrateSdk with ChangeNotifier {
"wellConnectedToNode" "wellConnectedToNode"
.tr(args: [getConnectedEndpoint()!.split('/')[2]]), .tr(args: [getConnectedEndpoint()!.split('/')[2]]),
5); 5);
// snackNode(ctx, true);
} else { } else {
nodeConnected = false; nodeConnected = false;
notifyListeners(); notifyListeners();
homeProvider.changeMessage("noDuniterEndointAvailable".tr(), 0); homeProvider.changeMessage("noDuniterEndointAvailable".tr(), 0);
if (!myWalletProvider.checkIfWalletExist()) snackNode(homeContext, false); if (!myWalletProvider.isWalletsExists()) snackNode(homeContext, false);
} }
log.d(sdk.api.connectedNode?.endpoint); log.i('Connected to node: ${sdk.api.connectedNode?.endpoint}');
} }
List<NetworkParams> getDuniterBootstrap() { List<NetworkParams> getDuniterBootstrap() {
@ -741,7 +711,6 @@ class SubstrateSdk with ChangeNotifier {
notifyListeners(); notifyListeners();
}); });
if (json == null) return ''; if (json == null) return '';
// log.d(json);
try { try {
await sdk.api.keyring.addAccount( await sdk.api.keyring.addAccount(
keyring, keyring,
@ -798,7 +767,7 @@ class SubstrateSdk with ChangeNotifier {
final myWalletProvider = final myWalletProvider =
Provider.of<MyWalletsProvider>(context, listen: false); Provider.of<MyWalletsProvider>(context, listen: false);
keyring.setCurrent(account); keyring.setCurrent(account);
myWalletProvider.resetPinCode(); myWalletProvider.debounceResetPinCode();
return await sdk.api.keyring.changePassword(keyring, passOld, passNew); return await sdk.api.keyring.changePassword(keyring, passOld, passNew);
} }
@ -1036,7 +1005,7 @@ class SubstrateSdk with ChangeNotifier {
toIdtyStatus == IdtyStatus.confirmed) { toIdtyStatus == IdtyStatus.confirmed) {
if (toCerts![0] >= currencyParameters['minCertForMembership']! - 1 && if (toCerts![0] >= currencyParameters['minCertForMembership']! - 1 &&
toIdtyStatus != IdtyStatus.validated) { toIdtyStatus != IdtyStatus.validated) {
log.i('Batch cert and membership validation'); log.d('Batch cert and membership validation');
txInfo = TxInfoData( txInfo = TxInfoData(
'utility', 'utility',
'batchAll', 'batchAll',
@ -1109,8 +1078,6 @@ class SubstrateSdk with ChangeNotifier {
await _signMessage(messageToSign, destAddress, destPassword); await _signMessage(messageToSign, destAddress, destPassword);
final newKeySigType = '{"Sr25519": "$newKeySig"}'; final newKeySigType = '{"Sr25519": "$newKeySig"}';
// messageToSign: [105, 99, 111, 107, 7, 193, 18, 255, 106, 185, 215, 208, 213, 49, 235, 229, 159, 152, 179, 83, 24, 178, 129, 59, 22, 85, 87, 115, 128, 129, 157, 56, 214, 24, 45, 153, 21, 0, 0, 0, 181, 82, 178, 99, 198, 4, 156, 190, 78, 35, 102, 137, 255, 7, 162, 31, 16, 79, 255, 132, 130, 237, 230, 222, 176, 88, 245, 217, 237, 78, 196, 239]
log.d(""" log.d("""
fromAddress: $fromAddress fromAddress: $fromAddress
destAddress: $destAddress destAddress: $destAddress
@ -1210,7 +1177,6 @@ newKeySig: $newKeySigType""");
password: password, password: password,
); );
log.d('g1migration idtyStatus: $idtyStatus');
if (idtyStatus != IdtyStatus.none) { if (idtyStatus != IdtyStatus.none) {
await migrateIdentity( await migrateIdentity(
fromAddress: keypair.address!, fromAddress: keypair.address!,

View File

@ -58,7 +58,6 @@ class WalletOptionsProvider with ChangeNotifier {
final myWalletProvider = final myWalletProvider =
Provider.of<MyWalletsProvider>(context, listen: false); Provider.of<MyWalletsProvider>(context, listen: false);
final defaultWallet = myWalletProvider.getDefaultWallet(); final defaultWallet = myWalletProvider.getDefaultWallet();
log.d(defaultWallet.address);
sub.pay( sub.pay(
fromAddress: wallet.address, fromAddress: wallet.address,
destAddress: defaultWallet.address, destAddress: defaultWallet.address,
@ -118,9 +117,6 @@ class WalletOptionsProvider with ChangeNotifier {
log.w('No image selected.'); log.w('No image selected.');
return ''; return '';
} }
// await imageFile.copy(newPath);
log.i(newPath);
return newPath; return newPath;
} else { } else {
log.w('No image selected.'); log.w('No image selected.');

View File

@ -5,6 +5,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/g1_wallets_list.dart'; import 'package:gecko/models/g1_wallets_list.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/screens/wallet_view.dart'; import 'package:gecko/screens/wallet_view.dart';
import 'package:jdenticon_dart/jdenticon_dart.dart'; import 'package:jdenticon_dart/jdenticon_dart.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
@ -36,6 +37,7 @@ class WalletsProfilesProvider with ChangeNotifier {
return 'false'; return 'false';
} }
if (isAddress(barcode.rawContent)) { if (isAddress(barcode.rawContent)) {
address = barcode.rawContent;
Navigator.popUntil( Navigator.popUntil(
context, context,
ModalRoute.withName('/'), ModalRoute.withName('/'),
@ -55,51 +57,6 @@ class WalletsProfilesProvider with ChangeNotifier {
return barcode.rawContent; return barcode.rawContent;
} }
// Future<String> pay(BuildContext context, {int? derivation}) async {
// MyWalletsProvider _myWalletProvider =
// Provider.of<MyWalletsProvider>(context, listen: false);
// int? currentChest = configBox.get('currentChest');
// String result;
// derivation ??=
// _myWalletProvider.getDefaultWallet(currentChest)!.derivation!;
// result = await Gva(node: endPointGVA).pay(
// recipient: pubkey!,
// amount: double.parse(payAmount.text),
// mnemonic: _myWalletProvider.mnemonic,
// comment: payComment.text,
// derivation: derivation,
// lang: appLang);
// return result;
// }
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 !");
this.address = address;
return true;
} else {
return false;
}
}
// poka: Do99s6wQR2JLfhirPdpAERSjNbmjjECzGxHNJMiNKT3P
// Pi: D2meevcAHFTS2gQMvmRW5Hzi25jDdikk4nC4u1FkwRaU // For debug
// Boris: JE6mkuzSpT3ePciCPRTpuMT9fqPUVVLJz2618d33p7tn
// Matograine portefeuille: 9p5nHsES6xujFR7pw2yGy4PLKKHgWsMvsDHaHF64Uj25.
// Lion simone: 78jhpprYkMNF6i5kQPXfkAVBpd2aqcpieNsXTSW4c21f
void resetdHistory() { void resetdHistory() {
notifyListeners(); notifyListeners();
} }
@ -108,21 +65,6 @@ class WalletsProfilesProvider with ChangeNotifier {
return Jdenticon.toSvg(pubkey); return Jdenticon.toSvg(pubkey);
} }
// Future<num> getBalance(String _pubkey) async {
// final url = Uri.parse(
// '$endPointGVA?query={%20balance(script:%20%22$_pubkey%22)%20{%20amount%20base%20}%20}');
// final response = await http.get(url);
// final result = json.decode(response.body);
// if (result['data']['balance'] == null) {
// balance = 0.0;
// } else {
// balance = removeDecimalZero(result['data']['balance']['amount'] / 100);
// }
// return balance;
// }
Future<num?> getBalance(String? pubkey) async { Future<num?> getBalance(String? pubkey) async {
while (_balance == null) { while (_balance == null) {
await Future.delayed(const Duration(milliseconds: 50)); await Future.delayed(const Duration(milliseconds: 50));
@ -136,14 +78,12 @@ class WalletsProfilesProvider with ChangeNotifier {
} }
Future addContact(G1WalletsList profile) async { Future addContact(G1WalletsList profile) async {
// log.d(profile.username);
if (isContact(profile.address)) { if (isContact(profile.address)) {
await contactsBox.delete(profile.address); await contactsBox.delete(profile.address);
snackMessage(homeContext, snackMessage(homeContext,
message: 'removedFromcontacts'.tr(), duration: 4); message: 'removedFromcontacts'.tr(), duration: 4);
} else { } else {
await contactsBox.put(profile.address, profile); await contactsBox.put(profile.address, profile);
// drawStar(Size(50, 50));
snackMessage(homeContext, message: 'addedToContacts'.tr(), duration: 4); snackMessage(homeContext, message: 'addedToContacts'.tr(), duration: 4);
} }
notifyListeners(); notifyListeners();
@ -154,12 +94,28 @@ class WalletsProfilesProvider with ChangeNotifier {
} }
} }
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) {
return true;
} else {
return false;
}
}
snackMessage(context, snackMessage(context,
{required String message, int duration = 2, double fontSize = 16}) { {required String message, int duration = 2, double fontSize = 16}) {
final snackBar = SnackBar( final snackBar = SnackBar(
backgroundColor: Colors.grey[900], backgroundColor: Colors.grey[900],
padding: const EdgeInsets.all(20), padding: EdgeInsets.all(scaleSize(19)),
content: Text(message, style: TextStyle(fontSize: fontSize)), content: Text(message, style: scaledTextStyle(fontSize: fontSize)),
duration: Duration(seconds: duration)); duration: Duration(seconds: duration));
ScaffoldMessenger.of(context).showSnackBar(snackBar); ScaffoldMessenger.of(context).showSnackBar(snackBar);
} }
@ -167,9 +123,9 @@ snackMessage(context,
snackCopyKey(context) { snackCopyKey(context) {
final snackBar = SnackBar( final snackBar = SnackBar(
backgroundColor: Colors.grey[900], backgroundColor: Colors.grey[900],
padding: const EdgeInsets.all(20), padding: EdgeInsets.all(scaleSize(19)),
content: Text("thisAddressHasBeenCopiedToClipboard".tr(), content: Text("thisAddressHasBeenCopiedToClipboard".tr(),
style: const TextStyle(fontSize: 16)), style: scaledTextStyle(fontSize: 16)),
duration: const Duration(seconds: 2)); duration: const Duration(seconds: 2));
ScaffoldMessenger.of(context).showSnackBar(snackBar); ScaffoldMessenger.of(context).showSnackBar(snackBar);
} }
@ -177,9 +133,9 @@ snackCopyKey(context) {
snackCopySeed(context) { snackCopySeed(context) {
final snackBar = SnackBar( final snackBar = SnackBar(
backgroundColor: Colors.grey[900], backgroundColor: Colors.grey[900],
padding: const EdgeInsets.all(20), padding: EdgeInsets.all(scaleSize(19)),
content: Text("thisMnemonicHasBeenCopiedToClipboard".tr(), content: Text("thisMnemonicHasBeenCopiedToClipboard".tr(),
style: const TextStyle(fontSize: 17)), style: scaledTextStyle(fontSize: 16)),
duration: const Duration(seconds: 4)); duration: const Duration(seconds: 4));
ScaffoldMessenger.of(context).showSnackBar(snackBar); ScaffoldMessenger.of(context).showSnackBar(snackBar);
} }

View File

@ -2,6 +2,7 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/duniter_indexer.dart';
@ -12,8 +13,7 @@ import 'package:gecko/widgets/history_query.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class ActivityScreen extends StatefulWidget { class ActivityScreen extends StatefulWidget {
const ActivityScreen( const ActivityScreen({required this.address, this.username})
{required this.address, this.username})
: super(key: keyActivityScreen); : super(key: keyActivityScreen);
final String address; final String address;
final String? username; final String? username;
@ -42,10 +42,10 @@ class _ActivityScreenState extends State<ActivityScreen> {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
elevation: 0, elevation: 0,
toolbarHeight: 60 * ratio, toolbarHeight: scaleSize(57),
title: SizedBox( title: Text(
height: 22, 'accountActivity'.tr(),
child: Text('accountActivity'.tr()), style: scaledTextStyle(fontSize: 20),
), ),
), ),
bottomNavigationBar: const GeckoBottomAppBar(), bottomNavigationBar: const GeckoBottomAppBar(),

View File

@ -2,10 +2,11 @@ import 'package:accordion/controllers.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/widgets/certs_received.dart'; import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/widgets/certs_list.dart';
import 'package:gecko/widgets/certs_counter.dart'; import 'package:gecko/widgets/certs_counter.dart';
import 'package:gecko/widgets/certs_sent.dart';
import 'package:accordion/accordion.dart'; import 'package:accordion/accordion.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
class CertificationsScreen extends StatelessWidget { class CertificationsScreen extends StatelessWidget {
const CertificationsScreen( const CertificationsScreen(
@ -18,41 +19,39 @@ class CertificationsScreen extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('certificationsOf'.tr(args: [username])),
elevation: 0,
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text('certificationsOf'.tr(args: [username])),
)),
body: SafeArea( body: SafeArea(
child: Accordion( child: Accordion(
paddingListTop: 10, paddingListTop: 7,
paddingListBottom: 10, paddingListBottom: 10,
maxOpenSections: 1, maxOpenSections: 1,
headerBackgroundColorOpened: orangeC, headerBackgroundColorOpened: orangeC,
scaleWhenAnimating: true, scaleWhenAnimating: true,
openAndCloseAnimation: true, openAndCloseAnimation: true,
headerPadding: headerPadding: EdgeInsets.symmetric(
const EdgeInsets.symmetric(vertical: 7, horizontal: 15), vertical: scaleSize(6), horizontal: scaleSize(14)),
sectionOpeningHapticFeedback: SectionHapticFeedback.heavy, sectionOpeningHapticFeedback: SectionHapticFeedback.heavy,
sectionClosingHapticFeedback: SectionHapticFeedback.light, sectionClosingHapticFeedback: SectionHapticFeedback.light,
children: [ children: [
AccordionSection( AccordionSection(
isOpen: true, isOpen: true,
leftIcon: leftIcon: Icon(
const Icon(Icons.insights_rounded, color: Colors.black), Icons.insights_rounded,
color: Colors.black,
size: scaleSize(20),
),
headerBackgroundColor: yellowC, headerBackgroundColor: yellowC,
headerBackgroundColorOpened: orangeC, headerBackgroundColorOpened: orangeC,
header: Row(children: [ header: Row(children: [
Text( Text(
'received'.tr(), 'received'.tr(),
style: const TextStyle(fontSize: 20), style: scaledTextStyle(fontSize: 17),
), ),
const SizedBox(width: 5), ScaledSizedBox(width: 5),
CertsCounter(address: address) CertsCounter(address: address)
]), ]),
content: CertsReceived(address: address), content: CertsList(
address: address, direction: CertDirection.sent),
contentHorizontalPadding: 0, contentHorizontalPadding: 0,
contentBorderWidth: 1, contentBorderWidth: 1,
), ),
@ -65,13 +64,16 @@ class CertificationsScreen extends StatelessWidget {
header: Row(children: [ header: Row(children: [
Text( Text(
'sent'.tr(), 'sent'.tr(),
style: const TextStyle(fontSize: 20), style: scaledTextStyle(fontSize: 17),
), ),
const SizedBox(width: 5), ScaledSizedBox(width: 5),
CertsCounter(address: address, isSent: true) CertsCounter(address: address, isSent: true)
]), ]),
content: CertsSent(address: address), content: CertsList(
contentHorizontalPadding: 20, address: address,
direction: CertDirection.sent,
),
contentHorizontalPadding: 0,
contentBorderWidth: 1, contentBorderWidth: 1,
// onOpenSection: () => print('onOpenSection ...'), // onOpenSection: () => print('onOpenSection ...'),
// onCloseSection: () => print('onCloseSection ...'), // onCloseSection: () => print('onCloseSection ...'),

View File

@ -1,6 +1,7 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -14,11 +15,7 @@ class DebugScreen extends StatelessWidget {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: AppBar(
toolbarHeight: 60 * ratio, toolbarHeight: scaleSize(57), title: const Text('Debug screen')),
title: const SizedBox(
height: 22,
child: Text('Debug screen'),
)),
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
const SizedBox(height: 40), const SizedBox(height: 40),

View File

@ -5,6 +5,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/chest_data.dart'; import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/g1_wallets_list.dart'; import 'package:gecko/models/g1_wallets_list.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/cesium_plus.dart'; import 'package:gecko/providers/cesium_plus.dart';
import 'package:gecko/providers/chest_provider.dart'; import 'package:gecko/providers/chest_provider.dart';
@ -45,7 +46,7 @@ class _HomeScreenState extends State<HomeScreen> {
final csProvider = final csProvider =
Provider.of<CesiumPlusProvider>(context, listen: false); Provider.of<CesiumPlusProvider>(context, listen: false);
final bool isWalletsExists = myWalletProvider.checkIfWalletExist(); final bool isWalletsExists = myWalletProvider.isWalletsExists();
// Check if versionData non compatible, drop everything // Check if versionData non compatible, drop everything
if (configBox.get('dataVersion') == null) { if (configBox.get('dataVersion') == null) {
@ -88,7 +89,7 @@ class _HomeScreenState extends State<HomeScreen> {
Connectivity() Connectivity()
.onConnectivityChanged .onConnectivityChanged
.listen((ConnectivityResult result) async { .listen((ConnectivityResult result) async {
log.d('Network changed: $result'); log.i('Network changed: $result');
if (result == ConnectivityResult.none) { if (result == ConnectivityResult.none) {
sub.nodeConnected = false; sub.nodeConnected = false;
await sub.sdk.api.setting.unsubscribeBestNumber(); await sub.sdk.api.setting.unsubscribeBestNumber();
@ -114,19 +115,16 @@ class _HomeScreenState extends State<HomeScreen> {
final myWalletProvider = Provider.of<MyWalletsProvider>(context); final myWalletProvider = Provider.of<MyWalletsProvider>(context);
Provider.of<ChestProvider>(context); Provider.of<ChestProvider>(context);
final bool isWalletsExists = myWalletProvider.checkIfWalletExist(); final isWalletsExists = myWalletProvider.isWalletsExists();
isTall = false; isTall = (MediaQuery.of(context).size.height /
ratio = 1; MediaQuery.of(context).size.width) >
if (MediaQuery.of(context).size.height >= 930) { 1.75;
isTall = true;
ratio = 1.125;
}
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
drawer: MainDrawer(isWalletsExists: isWalletsExists), drawer: MainDrawer(isWalletsExists: isWalletsExists),
backgroundColor: const Color(0xffF9F9F1), backgroundColor: yellowC,
body: isWalletsExists ? geckHome(context) : welcomeHome(context)); body: isWalletsExists ? geckHome(context) : welcomeHome(context));
} }
} }
@ -146,42 +144,43 @@ Widget geckHome(context) {
Column(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Column(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
Stack(children: <Widget>[ Stack(children: <Widget>[
Positioned( Positioned(
top: statusBarHeight + 10, top: statusBarHeight + scaleSize(10),
left: 15, left: scaleSize(15),
child: Builder( child: Builder(
builder: (context) => IconButton( builder: (context) => IconButton(
key: keyDrawerMenu, key: keyDrawerMenu,
icon: const Icon( icon: Icon(
Icons.menu, Icons.menu,
color: Colors.white, color: Colors.black,
size: 35, size: scaleSize(35),
), ),
onPressed: () => Scaffold.of(context).openDrawer(), onPressed: () => Scaffold.of(context).openDrawer(),
), ),
), ),
), ),
const Align( Align(
child: child: Image(
Image(image: AssetImage('assets/home/header.png'), height: 210), image: const AssetImage('assets/home/header.png'),
height: scaleSize(165)),
), ),
]), ]),
Padding( Padding(
padding: EdgeInsets.only(top: 15 * ratio), padding: const EdgeInsets.only(top: 15),
child: child:
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
DefaultTextStyle( DefaultTextStyle(
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: scaledTextStyle(
color: Colors.white, color: Colors.white,
fontSize: 24, fontSize: 19,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
shadows: <Shadow>[ shadows: <Shadow>[
Shadow( const Shadow(
offset: Offset(0, 0), offset: Offset(0, 0),
blurRadius: 20, blurRadius: 20,
color: Colors.black, color: Colors.black,
), ),
Shadow( const Shadow(
offset: Offset(0, 0), offset: Offset(0, 0),
blurRadius: 20, blurRadius: 20,
color: Colors.black, color: Colors.black,
@ -198,7 +197,7 @@ Widget geckHome(context) {
), ),
]), ]),
), ),
const SizedBox(height: 15), ScaledSizedBox(height: 15),
Expanded( Expanded(
flex: 1, flex: 1,
child: Container( child: Container(
@ -233,37 +232,38 @@ Widget welcomeHome(context) {
Column(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Column(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
Stack(children: <Widget>[ Stack(children: <Widget>[
Positioned( Positioned(
top: statusBarHeight + 10, top: statusBarHeight + scaleSize(10),
left: 15, left: scaleSize(15),
child: Builder( child: Builder(
builder: (context) => IconButton( builder: (context) => IconButton(
key: keyDrawerMenu, key: keyDrawerMenu,
icon: const Icon( icon: Icon(
Icons.menu, Icons.menu,
color: Colors.white, color: Colors.black,
size: 35, size: scaleSize(35),
), ),
onPressed: () => Scaffold.of(context).openDrawer(), onPressed: () => Scaffold.of(context).openDrawer(),
), ),
), ),
), ),
const Align( Align(
child: child: Image(
Image(image: AssetImage('assets/home/header.png'), height: 210), image: const AssetImage('assets/home/header.png'),
height: scaleSize(165)),
), ),
]), ]),
Padding( Padding(
padding: EdgeInsets.only(top: 1 * ratio), padding: const EdgeInsets.only(top: 1),
child: child:
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
Text( Text(
"fastAppDescription".tr(args: [currencyName]), "fastAppDescription".tr(args: [currencyName]),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: scaledTextStyle(
color: Colors.white, color: Colors.white,
fontSize: 24, fontSize: 20,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
shadows: <Shadow>[ shadows: const <Shadow>[
Shadow( Shadow(
offset: Offset(0, 0), offset: Offset(0, 0),
blurRadius: 20, blurRadius: 20,
@ -296,34 +296,29 @@ Widget welcomeHome(context) {
child: ConstrainedBox( child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 480), constraints: const BoxConstraints(maxWidth: 480),
child: Column(children: <Widget>[ child: Column(children: <Widget>[
const Spacer(), const Spacer(flex: 4),
Row(children: <Widget>[ Row(children: <Widget>[
Expanded( Expanded(
child: Stack(children: <Widget>[ child: Stack(children: <Widget>[
const Padding( Padding(
padding: EdgeInsets.only(top: 55), padding: EdgeInsets.only(top: scaleSize(55)),
child: Image( child: Image(
image: AssetImage('assets/home/gecko-bienvenue.png'), image: const AssetImage(
height: 220, 'assets/home/gecko-bienvenue.png'),
height: scaleSize(180),
), ),
), ),
Positioned( Positioned(
left: 180, left: scaleSize(160),
child: BubbleSpeak(text: "noLizard".tr()), top: 10,
), child: BubbleSpeakWithTail(text: "noLizard".tr()),
const Positioned(
left: 200,
top: 60,
child: Image(
image: AssetImage('assets/home/bout_de_bulle.png'),
),
), ),
]), ]),
), ),
]), ]),
SizedBox( ScaledSizedBox(
width: 410, width: 330,
height: 70, height: 60,
child: ElevatedButton( child: ElevatedButton(
key: keyOnboardingNewChest, key: keyOnboardingNewChest,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
@ -342,19 +337,21 @@ Widget welcomeHome(context) {
}, },
child: Text( child: Text(
'createWallet'.tr(), 'createWallet'.tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 24, fontWeight: FontWeight.w600), fontSize: 21,
fontWeight: FontWeight.w600,
color: Colors.white),
), ),
), ),
), ),
SizedBox(height: 25 * ratio), ScaledSizedBox(height: scaleSize(25)),
SizedBox( ScaledSizedBox(
width: 410, width: 330,
height: 70, height: 60,
child: OutlinedButton( child: OutlinedButton(
key: keyRestoreChest, key: keyRestoreChest,
style: OutlinedButton.styleFrom( style: OutlinedButton.styleFrom(
side: const BorderSide(width: 4, color: orangeC)), side: BorderSide(width: scaleSize(4), color: orangeC)),
onPressed: () { onPressed: () {
Navigator.push( Navigator.push(
context, context,
@ -367,14 +364,14 @@ Widget welcomeHome(context) {
}, },
child: Text( child: Text(
"restoreWallet".tr(), "restoreWallet".tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 24, fontSize: 21,
color: orangeC, color: orangeC,
fontWeight: FontWeight.w600), fontWeight: FontWeight.w600),
), ),
), ),
), ),
SizedBox(height: isTall ? 100 : 50) const Spacer(flex: 3),
]), ]),
), ),
), ),

View File

@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:durt/durt.dart'; import 'package:durt/durt.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
@ -48,11 +49,8 @@ class _ChangePinScreenState extends State<ChangePinScreen> {
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: AppBar( appBar: AppBar(
elevation: 1, elevation: 1,
toolbarHeight: 60 * ratio, toolbarHeight: scaleSize(57),
title: SizedBox( title: Text(widget.walletName!),
height: 22,
child: Text(widget.walletName!),
),
), ),
body: Center( body: Center(
child: SafeArea( child: SafeArea(

View File

@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/chest_data.dart'; import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
@ -15,6 +16,7 @@ import 'package:gecko/screens/myWallets/show_seed.dart';
import 'package:gecko/screens/myWallets/unlocking_wallet.dart'; import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'package:gecko/widgets/bottom_app_bar.dart'; import 'package:gecko/widgets/bottom_app_bar.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class ChestOptions extends StatelessWidget { class ChestOptions extends StatelessWidget {
@ -31,28 +33,13 @@ class ChestOptions extends StatelessWidget {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: AppBar( appBar: GeckoAppBar(currentChest.name!),
elevation: 1,
toolbarHeight: 60 * ratio,
// leading: IconButton(
// icon: const Icon(Icons.arrow_back, color: Colors.black),
// onPressed: () {
// // Navigator.popUntil(
// // context,
// // ModalRoute.withName('/mywallets'),
// // );
// Navigator.pop(context);
// }),
title: SizedBox(
height: 22,
child: Text(currentChest.name!),
)),
bottomNavigationBar: const GeckoBottomAppBar(), bottomNavigationBar: const GeckoBottomAppBar(),
body: Stack(children: [ body: Stack(children: [
Builder( Builder(
builder: (ctx) => SafeArea( builder: (ctx) => SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 30 * ratio), ScaledSizedBox(height: 20),
InkWell( InkWell(
key: keyShowSeed, key: keyShowSeed,
onTap: () async { onTap: () async {
@ -82,26 +69,29 @@ class ChestOptions extends StatelessWidget {
); );
} }
}, },
child: SizedBox( child: ScaledSizedBox(
height: 50, height: 60,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
const SizedBox(width: 20), ScaledSizedBox(width: 20),
Image.asset( Image.asset(
'assets/onBoarding/phrase_de_restauration_flou.png', 'assets/onBoarding/phrase_de_restauration_flou.png',
width: 60, width: scaleSize(60),
), ),
const SizedBox(width: 15), ScaledSizedBox(width: 13),
Text( ScaledSizedBox(
'displayMnemonic'.tr(), width: 270,
style: const TextStyle( child: Text(
fontSize: 20, 'displayMnemonic'.tr(),
color: orangeC, style: scaledTextStyle(
fontSize: 17,
color: orangeC,
),
), ),
), ),
]), ]),
), ),
), ),
SizedBox(height: 10 * ratio), ScaledSizedBox(height: 2),
Consumer<SubstrateSdk>(builder: (context, sub, _) { Consumer<SubstrateSdk>(builder: (context, sub, _) {
return InkWell( return InkWell(
key: keyChangePin, key: keyChangePin,
@ -126,19 +116,19 @@ class ChestOptions extends StatelessWidget {
// } // }
// } // }
// : null, // : null,
child: SizedBox( child: ScaledSizedBox(
height: 50, height: 60,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
const SizedBox(width: 26), ScaledSizedBox(width: 30),
Image.asset( Image.asset(
'assets/chests/secret_code.png', 'assets/chests/secret_code.png',
height: 25, height: scaleSize(22),
), ),
const SizedBox(width: 18), ScaledSizedBox(width: 18),
Text( Text(
'changePassword'.tr(), 'changePassword'.tr(),
style: TextStyle( style: scaledTextStyle(
fontSize: 20, fontSize: 17,
color: sub.nodeConnected color: sub.nodeConnected
? Colors.grey[500] ? Colors.grey[500]
: Colors.grey[500]), : Colors.grey[500]),
@ -146,7 +136,7 @@ class ChestOptions extends StatelessWidget {
])), ])),
); );
}), }),
SizedBox(height: 10 * ratio), ScaledSizedBox(height: 2),
Consumer<SubstrateSdk>(builder: (context, sub, _) { Consumer<SubstrateSdk>(builder: (context, sub, _) {
return InkWell( return InkWell(
key: keycreateRootDerivation, key: keycreateRootDerivation,
@ -162,19 +152,19 @@ class ChestOptions extends StatelessWidget {
); );
} }
: null, : null,
child: SizedBox( child: ScaledSizedBox(
height: 50, height: 60,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
const SizedBox(width: 35), ScaledSizedBox(width: 37),
const Icon( Icon(
Icons.manage_accounts, Icons.manage_accounts,
size: 33, size: scaleSize(31),
), ),
const SizedBox(width: 25), ScaledSizedBox(width: 23),
Text( Text(
'createDerivation'.tr(), 'createDerivation'.tr(),
style: TextStyle( style: scaledTextStyle(
fontSize: 20, fontSize: 17,
color: sub.nodeConnected color: sub.nodeConnected
? Colors.black ? Colors.black
: Colors.grey[500]), : Colors.grey[500]),
@ -183,26 +173,26 @@ class ChestOptions extends StatelessWidget {
), ),
); );
}), }),
SizedBox(height: 10 * ratio), ScaledSizedBox(height: 2),
InkWell( InkWell(
key: keyDeleteChest, key: keyDeleteChest,
onTap: () async { onTap: () async {
await chestProvider.deleteChest(context, currentChest); await chestProvider.deleteChest(context, currentChest);
}, },
child: SizedBox( child: ScaledSizedBox(
height: 50, height: 60,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
const SizedBox(width: 28), ScaledSizedBox(width: 32),
Image.asset( Image.asset(
'assets/walletOptions/trash.png', 'assets/walletOptions/trash.png',
height: 45, height: scaleSize(38),
), ),
const SizedBox(width: 20), ScaledSizedBox(width: 22),
Text( Text(
'deleteChest'.tr(), 'deleteChest'.tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 20, fontSize: 17,
color: Color(0xffD80000), color: const Color(0xffD80000),
), ),
), ),
]), ]),

View File

@ -3,6 +3,7 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
@ -34,14 +35,10 @@ class _ChooseChestState extends State<ChooseChest> {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: AppBar(
toolbarHeight: 60 * ratio, toolbarHeight: scaleSize(57), title: Text('selectMyChest'.tr())),
title: SizedBox(
height: 22,
child: Text('selectMyChest'.tr()),
)),
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 160 * ratio), const SizedBox(height: 160),
CarouselSlider( CarouselSlider(
carouselController: buttonCarouselController, carouselController: buttonCarouselController,
options: CarouselOptions( options: CarouselOptions(
@ -102,7 +99,7 @@ class _ChooseChestState extends State<ChooseChest> {
); );
}).toList(), }).toList(),
), ),
SizedBox(height: 80 * ratio), const SizedBox(height: 80),
SizedBox( SizedBox(
width: 400, width: 400,
height: 70, height: 70,

View File

@ -4,9 +4,11 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/screens/myWallets/unlocking_wallet.dart'; import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class CustomDerivation extends StatefulWidget { class CustomDerivation extends StatefulWidget {
@ -48,28 +50,27 @@ class _CustomDerivationState extends State<CustomDerivation> {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('createCustomDerivation'.tr()),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text('createCustomDerivation'.tr()),
)),
body: Center( body: Center(
child: SafeArea( child: SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
const Spacer(), const Spacer(),
Text( Text(
'chooseDerivation'.tr(), 'chooseDerivation'.tr(),
style: scaledTextStyle(fontSize: 17),
), ),
const SizedBox(height: 20), ScaledSizedBox(height: 20),
SizedBox( ScaledSizedBox(
width: 100, width: 100,
child: DropdownButton<String>( child: DropdownButton<String>(
value: dropdownValue, value: dropdownValue,
menuMaxHeight: 300, menuMaxHeight: 300,
icon: const Icon(Icons.arrow_downward), icon: Icon(
Icons.arrow_downward,
size: scaleSize(20),
),
elevation: 16, elevation: 16,
style: const TextStyle(color: orangeC), style: scaledTextStyle(color: orangeC),
underline: Container( underline: Container(
height: 2, height: 2,
color: orangeC, color: orangeC,
@ -83,14 +84,14 @@ class _CustomDerivationState extends State<CustomDerivation> {
.map<DropdownMenuItem<String>>((String value) { .map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>( return DropdownMenuItem<String>(
value: value, value: value,
child: SizedBox( child: ScaledSizedBox(
width: 75, width: 75,
child: Row(children: [ child: Row(children: [
const Spacer(), const Spacer(),
Text( Text(
value, value,
style: const TextStyle( style: scaledTextStyle(
fontSize: 20, color: Colors.black), fontSize: 17, color: Colors.black),
), ),
const Spacer(), const Spacer(),
]), ]),
@ -99,13 +100,14 @@ class _CustomDerivationState extends State<CustomDerivation> {
), ),
), ),
const Spacer(flex: 1), const Spacer(flex: 1),
SizedBox( ScaledSizedBox(
width: 410, width: 240,
height: 70, height: 55,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
foregroundColor: Colors.white, elevation: 4, foregroundColor: Colors.white,
backgroundColor: orangeC, // foreground elevation: 4,
backgroundColor: orangeC,
), ),
onPressed: () async { onPressed: () async {
WalletData? defaultWallet = WalletData? defaultWallet =
@ -141,8 +143,10 @@ class _CustomDerivationState extends State<CustomDerivation> {
}, },
child: Text( child: Text(
'validate'.tr(), 'validate'.tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 24, fontWeight: FontWeight.w600), fontSize: 19,
fontWeight: FontWeight.w600,
color: Colors.white),
), ),
), ),
), ),

View File

@ -7,6 +7,7 @@ import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
@ -15,6 +16,7 @@ import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/screens/myWallets/unlocking_wallet.dart'; import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'package:gecko/screens/transaction_in_progress.dart'; import 'package:gecko/screens/transaction_in_progress.dart';
import 'package:gecko/widgets/certifications.dart'; import 'package:gecko/widgets/certifications.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
import 'package:gecko/widgets/idty_status.dart'; import 'package:gecko/widgets/idty_status.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -32,20 +34,13 @@ class ImportG1v1 extends StatelessWidget {
bool canValidate = false; bool canValidate = false;
String validationStatus = ''; String validationStatus = '';
log.d(myWalletProvider.listWallets);
return PopScope( return PopScope(
onPopInvoked: (_) { onPopInvoked: (_) {
resetScreen(context); resetScreen(context);
}, },
child: Scaffold( child: Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('importOldAccount'.tr()),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text('importOldAccount'.tr()),
)),
body: SafeArea( body: SafeArea(
child: Consumer<SubstrateSdk>(builder: (context, sub, _) { child: Consumer<SubstrateSdk>(builder: (context, sub, _) {
return FutureBuilder( return FutureBuilder(
@ -53,15 +48,15 @@ class ImportG1v1 extends StatelessWidget {
sub.g1V1NewAddress, selectedWallet.address), sub.g1V1NewAddress, selectedWallet.address),
builder: (BuildContext context, AsyncSnapshot<List> status) { builder: (BuildContext context, AsyncSnapshot<List> status) {
if (status.data == null) { if (status.data == null) {
return const Column(children: [ return Column(children: [
SizedBox(height: 80), ScaledSizedBox(height: 80),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
SizedBox( ScaledSizedBox(
height: 35, height: 35,
width: 35, width: 35,
child: CircularProgressIndicator( child: const CircularProgressIndicator(
color: orangeC, color: orangeC,
strokeWidth: 4, strokeWidth: 4,
), ),
@ -106,7 +101,7 @@ class ImportG1v1 extends StatelessWidget {
final unit = isUdUnit ? 'ud'.tr(args: ['']) : currencyName; final unit = isUdUnit ? 'ud'.tr(args: ['']) : currencyName;
return Column(children: <Widget>[ return Column(children: <Widget>[
const SizedBox(height: 20), ScaledSizedBox(height: 10),
TextFormField( TextFormField(
key: keyCesiumId, key: keyCesiumId,
autofocus: true, autofocus: true,
@ -117,15 +112,18 @@ class ImportG1v1 extends StatelessWidget {
} }
debounce = Timer( debounce = Timer(
const Duration(milliseconds: debouneTime), () { const Duration(milliseconds: debouneTime), () {
sub.reload(); if (sub.csSalt.text != '' &&
sub.csToV2Address( sub.csPassword.text != '') {
sub.csSalt.text, sub.csPassword.text); sub.reload();
sub.csToV2Address(
sub.csSalt.text, sub.csPassword.text);
}
}); });
}, },
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
controller: sub.csSalt, controller: sub.csSalt,
obscureText: !sub obscureText: !sub.isCesiumIDVisible,
.isCesiumIDVisible, //This will obscure text dynamically style: scaledTextStyle(fontSize: 16),
decoration: InputDecoration( decoration: InputDecoration(
hintText: 'enterCesiumId'.tr(), hintText: 'enterCesiumId'.tr(),
suffixIcon: IconButton( suffixIcon: IconButton(
@ -135,6 +133,7 @@ class ImportG1v1 extends StatelessWidget {
? Icons.visibility_off ? Icons.visibility_off
: Icons.visibility, : Icons.visibility,
color: Colors.black, color: Colors.black,
size: scaleSize(22),
), ),
onPressed: () { onPressed: () {
sub.cesiumIDisVisible(); sub.cesiumIDisVisible();
@ -142,7 +141,7 @@ class ImportG1v1 extends StatelessWidget {
), ),
), ),
), ),
const SizedBox(height: 20), ScaledSizedBox(height: 7),
TextFormField( TextFormField(
key: keyCesiumPassword, key: keyCesiumPassword,
autofocus: true, autofocus: true,
@ -154,15 +153,18 @@ class ImportG1v1 extends StatelessWidget {
debounce = Timer( debounce = Timer(
const Duration(milliseconds: debouneTime), () { const Duration(milliseconds: debouneTime), () {
sub.g1V1NewAddress = ''; sub.g1V1NewAddress = '';
sub.reload(); if (sub.csSalt.text != '' &&
sub.csToV2Address( sub.csPassword.text != '') {
sub.csSalt.text, sub.csPassword.text); sub.reload();
sub.csToV2Address(
sub.csSalt.text, sub.csPassword.text);
}
}); });
}, },
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
controller: sub.csPassword, controller: sub.csPassword,
obscureText: !sub obscureText: !sub.isCesiumIDVisible,
.isCesiumIDVisible, //This will obscure text dynamically style: scaledTextStyle(fontSize: 16),
decoration: InputDecoration( decoration: InputDecoration(
hintText: 'enterCesiumPassword'.tr(), hintText: 'enterCesiumPassword'.tr(),
suffixIcon: IconButton( suffixIcon: IconButton(
@ -171,6 +173,7 @@ class ImportG1v1 extends StatelessWidget {
? Icons.visibility_off ? Icons.visibility_off
: Icons.visibility, : Icons.visibility,
color: Colors.black, color: Colors.black,
size: scaleSize(22),
), ),
onPressed: () { onPressed: () {
sub.cesiumIDisVisible(); sub.cesiumIDisVisible();
@ -178,45 +181,75 @@ class ImportG1v1 extends StatelessWidget {
), ),
), ),
), ),
const SizedBox(height: 20), ScaledSizedBox(height: 20),
GestureDetector( Visibility(
key: keyCopyAddress, visible: sub.g1V1OldPubkey != '',
onTap: () { child: Row(
Clipboard.setData( mainAxisAlignment: MainAxisAlignment.center,
ClipboardData(text: sub.g1V1OldPubkey)); children: [
snackCopyKey(context); Column(
}, children: [
child: Text( GestureDetector(
sub.g1V1OldPubkey, key: keyCopyPubkey,
style: const TextStyle( onTap: () {
fontSize: 16, Clipboard.setData(
fontWeight: FontWeight.w600, ClipboardData(text: sub.g1V1OldPubkey));
), snackCopyKey(context);
},
child: Text(
'v1: ${getShortPubkey(sub.g1V1OldPubkey)}',
style: scaledTextStyle(
fontSize: 17,
fontWeight: FontWeight.w600,
fontFamily: 'Monospace'),
),
),
ScaledSizedBox(height: 5),
GestureDetector(
key: keyCopyAddress,
onTap: () {
Clipboard.setData(
ClipboardData(text: sub.g1V1OldPubkey));
snackCopyKey(context);
},
child: Text(
'v2: ${getShortPubkey(sub.g1V1NewAddress)}',
style: scaledTextStyle(
fontSize: 17,
fontWeight: FontWeight.w600,
fontFamily: 'Monospace'),
),
),
],
),
ScaledSizedBox(width: 30),
Column(
children: [
Text(
'${balance['transferableBalance']} $unit',
style: scaledTextStyle(fontSize: 16),
),
IdentityStatus(
address: sub.g1V1NewAddress,
isOwner: false,
color: Colors.black),
ScaledSizedBox(width: 10),
Certifications(
address: sub.g1V1NewAddress, size: 14)
],
),
],
), ),
), ),
const SizedBox(height: 20), ScaledSizedBox(height: 20),
Text( Text(
'${balance['transferableBalance']} $unit', 'migrateToThisWallet'.tr(),
style: const TextStyle(fontSize: 17), style: scaledTextStyle(fontSize: 17),
), ),
Row( ScaledSizedBox(height: 5),
mainAxisAlignment: MainAxisAlignment.center,
children: [
IdentityStatus(
address: sub.g1V1NewAddress,
isOwner: false,
color: Colors.black),
const SizedBox(width: 10),
Certifications(address: sub.g1V1NewAddress, size: 14)
],
),
const SizedBox(height: 30),
Text('selectDestWallet'.tr()),
const SizedBox(height: 5),
DropdownButtonHideUnderline( DropdownButtonHideUnderline(
key: keySelectWallet, key: keySelectWallet,
child: DropdownButton( child: DropdownButton(
// alignment: AlignmentDirectional.topStart,
value: selectedWallet, value: selectedWallet,
icon: const Icon(Icons.keyboard_arrow_down), icon: const Icon(Icons.keyboard_arrow_down),
items: myWalletProvider.listWallets.map((wallet) { items: myWalletProvider.listWallets.map((wallet) {
@ -225,7 +258,7 @@ class ImportG1v1 extends StatelessWidget {
value: wallet, value: wallet,
child: Text( child: Text(
wallet.name!, wallet.name!,
style: const TextStyle(fontSize: 18), style: scaledTextStyle(fontSize: 17),
), ),
); );
}).toList(), }).toList(),
@ -235,15 +268,16 @@ class ImportG1v1 extends StatelessWidget {
}, },
), ),
), ),
const SizedBox(height: 30), ScaledSizedBox(height: 10),
SizedBox( ScaledSizedBox(
width: 380 * ratio, width: 320,
height: 60 * ratio, height: 50,
child: ElevatedButton( child: ElevatedButton(
key: keyConfirm, key: keyConfirm,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
foregroundColor: Colors.white, elevation: 4, foregroundColor: Colors.white,
backgroundColor: orangeC, // foreground elevation: 4,
backgroundColor: orangeC,
), ),
onPressed: canValidate onPressed: canValidate
? () async { ? () async {
@ -270,7 +304,7 @@ class ImportG1v1 extends StatelessWidget {
balance: balance, balance: balance,
idtyStatus: idtyStatus); idtyStatus: idtyStatus);
Navigator.pop(context); Navigator.pop(context);
Navigator.push( await Navigator.push(
context, context,
MaterialPageRoute(builder: (context) { MaterialPageRoute(builder: (context) {
return TransactionInProgress( return TransactionInProgress(
@ -286,17 +320,17 @@ class ImportG1v1 extends StatelessWidget {
: null, : null,
child: Text( child: Text(
'migrateAccount'.tr(), 'migrateAccount'.tr(),
style: TextStyle( style: scaledTextStyle(
fontSize: 23 * ratio, fontSize: 20, fontWeight: FontWeight.w600),
fontWeight: FontWeight.w600),
), ),
), ),
), ),
const SizedBox(height: 10), ScaledSizedBox(height: 10),
Text( Text(
validationStatus, validationStatus,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 15, color: Colors.grey[600]), style: scaledTextStyle(
fontSize: 14, color: Colors.grey[600]),
) )
]); ]);
}); });
@ -312,5 +346,6 @@ class ImportG1v1 extends StatelessWidget {
sub.csSalt.text = ''; sub.csSalt.text = '';
sub.csPassword.text = ''; sub.csPassword.text = '';
sub.g1V1NewAddress = ''; sub.g1V1NewAddress = '';
sub.g1V1OldPubkey = '';
} }
} }

View File

@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
@ -12,6 +13,7 @@ import 'package:gecko/widgets/commons/common_elements.dart';
import 'package:gecko/screens/myWallets/migrate_identity.dart'; import 'package:gecko/screens/myWallets/migrate_identity.dart';
import 'package:gecko/screens/myWallets/unlocking_wallet.dart'; import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'package:gecko/screens/transaction_in_progress.dart'; import 'package:gecko/screens/transaction_in_progress.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
// import 'package:gecko/models/wallet_data.dart'; // import 'package:gecko/models/wallet_data.dart';
// import 'package:gecko/providers/my_wallets.dart'; // import 'package:gecko/providers/my_wallets.dart';
@ -31,44 +33,39 @@ class ManageMembership extends StatelessWidget {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('manageMembership'.tr()),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: const Text('manageMembership').tr(),
)),
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
const SizedBox(height: 20), ScaledSizedBox(height: 20),
migrateIdentity(context), migrateIdentity(context),
const SizedBox(height: 10), ScaledSizedBox(height: 10),
FutureBuilder( FutureBuilder(
future: sub.isSmith(address), future: sub.isSmith(address),
builder: (BuildContext context, AsyncSnapshot<bool> isSmith) { builder: (BuildContext context, AsyncSnapshot<bool> isSmith) {
if (isSmith.data ?? false) { if (isSmith.data ?? false) {
return SizedBox( return ScaledSizedBox(
height: 75, height: 75,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
const SizedBox(width: 20), ScaledSizedBox(width: 17),
Image.asset( Image.asset(
'assets/skull_Icon.png', 'assets/skull_Icon.png',
color: Colors.grey[500], color: Colors.grey[500],
height: 30, height: scaleSize(28),
), ),
const SizedBox(width: 16), ScaledSizedBox(width: 12),
Column( Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text('revokeMyIdentity'.tr(), Text('revokeMyIdentity'.tr(),
style: TextStyle( style: scaledTextStyle(
fontSize: 20, fontSize: 18,
color: Colors.grey[500])), color: Colors.grey[500])),
const SizedBox(height: 2), ScaledSizedBox(height: 2),
Text("youCannotRevokeThisIdentity".tr(), Text("youCannotRevokeThisIdentity".tr(),
style: TextStyle( style: scaledTextStyle(
fontSize: 14, fontSize: 13,
color: Colors.grey[500])), color: Colors.grey[500])),
]), ]),
], ],
@ -77,7 +74,6 @@ class ManageMembership extends StatelessWidget {
return revokeMyIdentity(context); return revokeMyIdentity(context);
} }
}) })
// const SizedBox(height: 20),
]), ]),
)); ));
} }
@ -93,13 +89,13 @@ class ManageMembership extends StatelessWidget {
}), }),
); );
}, },
child: const SizedBox( child: ScaledSizedBox(
height: 60, height: 55,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 16), ScaledSizedBox(width: 16),
Icon(Icons.change_circle_outlined, size: 35), Icon(Icons.change_circle_outlined, size: scaleSize(32)),
SizedBox(width: 11.5), ScaledSizedBox(width: 11.5),
Text('Migrer mon identité', style: TextStyle(fontSize: 20)), Text('Migrer mon identité', style: scaledTextStyle(fontSize: 18)),
]), ]),
), ),
); );
@ -109,7 +105,6 @@ class ManageMembership extends StatelessWidget {
return InkWell( return InkWell(
key: keyRevokeIdty, key: keyRevokeIdty,
onTap: () async { onTap: () async {
// TODOO: Generate revoke document, and understand extrinsic identity.revokeIdentity options
final answer = await confirmPopup(context, final answer = await confirmPopup(context,
'Êtes-vous certains de vouloir révoquer définitivement cette identité ?') ?? 'Êtes-vous certains de vouloir révoquer définitivement cette identité ?') ??
false; false;
@ -119,10 +114,6 @@ class ManageMembership extends StatelessWidget {
Provider.of<MyWalletsProvider>(context, listen: false); Provider.of<MyWalletsProvider>(context, listen: false);
final sub = Provider.of<SubstrateSdk>(context, listen: false); final sub = Provider.of<SubstrateSdk>(context, listen: false);
// MyWalletsProvider mw = MyWalletsProvider();
// final wallet = mw.getWalletDataByAddress(address);
// await sub.setCurrentWallet(wallet!);
WalletData? defaultWallet = myWalletProvider.getDefaultWallet(); WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
String? pin; String? pin;
if (myWalletProvider.pinCode == '') { if (myWalletProvider.pinCode == '') {
@ -151,16 +142,16 @@ class ManageMembership extends StatelessWidget {
); );
} }
}, },
child: SizedBox( child: ScaledSizedBox(
height: 60, height: 55,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
const SizedBox(width: 20), ScaledSizedBox(width: 20),
Image.asset( Image.asset(
'assets/skull_Icon.png', 'assets/skull_Icon.png',
height: 30, height: scaleSize(28),
), ),
const SizedBox(width: 16), ScaledSizedBox(width: 16),
const Text('Révoquer mon adhésion', style: TextStyle(fontSize: 20)), Text('Révoquer mon adhésion', style: scaledTextStyle(fontSize: 18)),
]), ]),
), ),
); );

View File

@ -5,6 +5,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/duniter_indexer.dart';
@ -13,6 +14,7 @@ import 'package:gecko/providers/substrate_sdk.dart';
import 'package:gecko/providers/wallet_options.dart'; import 'package:gecko/providers/wallet_options.dart';
import 'package:gecko/screens/myWallets/unlocking_wallet.dart'; import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'package:gecko/screens/transaction_in_progress.dart'; import 'package:gecko/screens/transaction_in_progress.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class MigrateIdentityScreen extends StatelessWidget { class MigrateIdentityScreen extends StatelessWidget {
@ -42,20 +44,20 @@ class MigrateIdentityScreen extends StatelessWidget {
String validationStatus = ''; String validationStatus = '';
final mdStyle = MarkdownStyleSheet( final mdStyle = MarkdownStyleSheet(
p: const TextStyle(fontSize: 18, color: Colors.black, letterSpacing: 0.3), p: scaledTextStyle(fontSize: 17, color: Colors.black, letterSpacing: 0.3),
textAlign: WrapAlignment.center, textAlign: WrapAlignment.center,
); );
if (walletsList.length < 2) { if (walletsList.length < 2) {
return const Column( return Column(
children: [ children: [
SizedBox(height: 80), ScaledSizedBox(height: 80),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text( Text(
'Vous devez avoir au moins 2 portefeuilles\npour effecter cette opération', 'Vous devez avoir au moins 2 portefeuilles\npour effecter cette opération',
style: TextStyle(fontSize: 20), style: scaledTextStyle(fontSize: 17),
) )
], ],
) )
@ -65,12 +67,7 @@ class MigrateIdentityScreen extends StatelessWidget {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('migrateIdentity'.tr()),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text('importOldAccount'.tr()),
)),
body: SafeArea( body: SafeArea(
child: Consumer<SubstrateSdk>(builder: (context, sub, _) { child: Consumer<SubstrateSdk>(builder: (context, sub, _) {
return FutureBuilder( return FutureBuilder(
@ -78,31 +75,27 @@ class MigrateIdentityScreen extends StatelessWidget {
fromAddress, selectedWallet.address), fromAddress, selectedWallet.address),
builder: (BuildContext context, AsyncSnapshot<List> status) { builder: (BuildContext context, AsyncSnapshot<List> status) {
if (status.data == null) { if (status.data == null) {
return const Column(children: [ return Column(children: [
SizedBox(height: 80), ScaledSizedBox(height: 80),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [ Row(mainAxisAlignment: MainAxisAlignment.center, children: [
SizedBox( ScaledSizedBox(
height: 35, height: scaleSize(32),
width: 35, width: scaleSize(32),
child: CircularProgressIndicator( child: CircularProgressIndicator(
color: orangeC, color: orangeC,
strokeWidth: 4, strokeWidth: scaleSize(4),
), ),
), ),
]), ]),
]); ]);
} }
// log.d('statusData: ${status.data}');
final Map balance = status.data?[0] ?? {}; final Map balance = status.data?[0] ?? {};
final IdtyStatus idtyStatus = status.data?[1]; final IdtyStatus idtyStatus = status.data?[1];
final IdtyStatus myIdtyStatus = status.data?[2]; final IdtyStatus myIdtyStatus = status.data?[2];
final bool hasConsumer = status.data?[3] ?? false; final bool hasConsumer = status.data?[3] ?? false;
final bool isSmith = status.data?[4] ?? false; final bool isSmith = status.data?[4] ?? false;
// log.d('hasconsumer: $hasConsumer');
if (isSmith) { if (isSmith) {
canValidate = false; canValidate = false;
validationStatus = 'smithCantMigrateIdentity'.tr(); validationStatus = 'smithCantMigrateIdentity'.tr();
@ -122,24 +115,19 @@ class MigrateIdentityScreen extends StatelessWidget {
: 'thisAccountIsEmpty'.tr(); : 'thisAccountIsEmpty'.tr();
} }
log.d(
'tatatata: ${sub.g1V1NewAddress}, ${selectedWallet.address}, $balance, $idtyStatus, $myIdtyStatus');
final walletsList = myWalletProvider.listWallets.toList(); final walletsList = myWalletProvider.listWallets.toList();
walletsList walletsList
.removeWhere((element) => element.address == fromAddress); .removeWhere((element) => element.address == fromAddress);
// walletsList.add(WalletData(address: 'custom', name: 'custom'));
final bool isUdUnit = configBox.get('isUdUnit') ?? false; final bool isUdUnit = configBox.get('isUdUnit') ?? false;
final unit = isUdUnit ? 'ud'.tr(args: ['']) : currencyName; final unit = isUdUnit ? 'ud'.tr(args: ['']) : currencyName;
return Column(children: <Widget>[ return Column(children: <Widget>[
const Row(children: []), const Row(children: []),
const SizedBox(height: 20), ScaledSizedBox(height: 18),
ScaledSizedBox(
SizedBox( width: 320,
width: 400,
child: MarkdownBody( child: MarkdownBody(
data: 'areYouSureMigrateIdentity'.tr(args: [ data: 'areYouSureMigrateIdentity'.tr(args: [
duniterIndexer.walletNameIndexer[fromAddress] ?? duniterIndexer.walletNameIndexer[fromAddress] ??
@ -148,30 +136,13 @@ class MigrateIdentityScreen extends StatelessWidget {
]), ]),
styleSheet: mdStyle), styleSheet: mdStyle),
), ),
// Text( ScaledSizedBox(height: 55),
// 'areYouSureMigrateIdentity'.tr(args: [ Text('migrateToThisWallet'.tr(),
// duniterIndexer style: scaledTextStyle(fontSize: 17)),
// .walletNameIndexer[fromAddress]!, ScaledSizedBox(height: 5),
// '$balance $currencyName'
// ]),
// textAlign: TextAlign.center,
// ),
const SizedBox(height: 20),
Text(
sub.g1V1NewAddress,
style: const TextStyle(
fontSize: 14.0,
color: Colors.black,
fontWeight: FontWeight.bold,
fontFamily: 'Monospace'),
),
const SizedBox(height: 30),
Text('selectDestWallet'.tr()),
const SizedBox(height: 5),
DropdownButtonHideUnderline( DropdownButtonHideUnderline(
key: keySelectWallet, key: keySelectWallet,
child: DropdownButton( child: DropdownButton(
// alignment: AlignmentDirectional.topStart,
value: selectedWallet, value: selectedWallet,
icon: const Icon(Icons.keyboard_arrow_down), icon: const Icon(Icons.keyboard_arrow_down),
items: walletsList.map((wallet) { items: walletsList.map((wallet) {
@ -180,7 +151,7 @@ class MigrateIdentityScreen extends StatelessWidget {
value: wallet, value: wallet,
child: Text( child: Text(
wallet.name!, wallet.name!,
style: const TextStyle(fontSize: 18), style: scaledTextStyle(fontSize: 17),
), ),
); );
}).toList(), }).toList(),
@ -190,19 +161,19 @@ class MigrateIdentityScreen extends StatelessWidget {
}, },
), ),
), ),
const SizedBox(height: 30), const Spacer(flex: 2),
SizedBox( ScaledSizedBox(
width: 380 * ratio, width: 320,
height: 60 * ratio, height: 55,
child: ElevatedButton( child: ElevatedButton(
key: keyConfirm, key: keyConfirm,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
foregroundColor: Colors.white, elevation: 4, foregroundColor: Colors.white,
backgroundColor: orangeC, // foreground elevation: 4,
backgroundColor: orangeC,
), ),
onPressed: canValidate onPressed: canValidate
? () async { ? () async {
log.d('GOOO');
WalletData? defaultWallet = WalletData? defaultWallet =
myWalletProvider.getDefaultWallet(); myWalletProvider.getDefaultWallet();
@ -219,38 +190,47 @@ class MigrateIdentityScreen extends StatelessWidget {
); );
} }
sub.migrateIdentity( if (myWalletProvider.pinCode != '') {
fromAddress: fromAddress, sub.migrateIdentity(
destAddress: selectedWallet.address, fromAddress: fromAddress,
fromPassword: pin ?? myWalletProvider.pinCode, destAddress: selectedWallet.address,
destPassword: pin ?? myWalletProvider.pinCode, fromPassword:
withBalance: true, pin ?? myWalletProvider.pinCode,
fromBalance: balance); destPassword:
Navigator.push( pin ?? myWalletProvider.pinCode,
context, withBalance: true,
MaterialPageRoute(builder: (context) { fromBalance: balance);
return TransactionInProgress( Navigator.push(
transType: 'identityMigration', context,
fromAddress: getShortPubkey(fromAddress), MaterialPageRoute(builder: (context) {
toAddress: getShortPubkey( return TransactionInProgress(
selectedWallet.address)); transType: 'identityMigration',
}), fromAddress:
); getShortPubkey(fromAddress),
toAddress: getShortPubkey(
selectedWallet.address));
}),
);
}
} }
: null, : null,
child: Text( child: Text(
'migrateIdentity'.tr(), 'migrateIdentity'.tr(),
style: TextStyle( style: scaledTextStyle(
fontSize: 23 * ratio, fontWeight: FontWeight.w600), fontSize: 20,
fontWeight: FontWeight.w600,
color: Colors.white),
), ),
), ),
), ),
const SizedBox(height: 10), ScaledSizedBox(height: 10),
Text( Text(
validationStatus, validationStatus,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 15, color: Colors.grey[600]), style:
) scaledTextStyle(fontSize: 15, color: Colors.grey[600]),
),
const Spacer(),
]); ]);
}); });
}), }),

View File

@ -5,6 +5,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/generate_wallets.dart'; import 'package:gecko/providers/generate_wallets.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
@ -12,6 +13,7 @@ import 'package:gecko/screens/onBoarding/7.dart';
import 'package:gecko/screens/onBoarding/9.dart'; import 'package:gecko/screens/onBoarding/9.dart';
import 'package:gecko/widgets/commons/fader_transition.dart'; import 'package:gecko/widgets/commons/fader_transition.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
// import 'package:gecko/models/home.dart'; // import 'package:gecko/models/home.dart';
// import 'package:provider/provider.dart'; // import 'package:provider/provider.dart';
@ -36,18 +38,13 @@ class RestoreChest extends StatelessWidget {
}, },
child: Scaffold( child: Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('restoreAChest'.tr()),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text('restoreAChest'.tr()),
)),
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [
Column(children: <Widget>[ Column(children: <Widget>[
SizedBox(height: isTall ? 30 : 15), ScaledSizedBox(height: isTall ? 20 : 3),
bubbleSpeak('toRestoreEnterMnemonic'.tr()), bubbleSpeak('toRestoreEnterMnemonic'.tr()),
SizedBox(height: isTall ? 30 : 15), ScaledSizedBox(height: isTall ? 20 : 5),
Column(children: <Widget>[ Column(children: <Widget>[
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
@ -57,7 +54,7 @@ class RestoreChest extends StatelessWidget {
arrayCell(context, genW.cellController2), arrayCell(context, genW.cellController2),
arrayCell(context, genW.cellController3), arrayCell(context, genW.cellController3),
]), ]),
const SizedBox(height: 15), ScaledSizedBox(height: isTall ? 10 : 3),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[ children: <Widget>[
@ -66,7 +63,7 @@ class RestoreChest extends StatelessWidget {
arrayCell(context, genW.cellController6), arrayCell(context, genW.cellController6),
arrayCell(context, genW.cellController7), arrayCell(context, genW.cellController7),
]), ]),
const SizedBox(height: 15), ScaledSizedBox(height: isTall ? 10 : 3),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[ children: <Widget>[
@ -81,9 +78,9 @@ class RestoreChest extends StatelessWidget {
Expanded( Expanded(
child: Align( child: Align(
alignment: Alignment.center, alignment: Alignment.center,
child: SizedBox( child: ScaledSizedBox(
width: 410, width: 340,
height: 70, height: 55,
child: ElevatedButton( child: ElevatedButton(
key: keyGoNext, key: keyGoNext,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
@ -110,8 +107,10 @@ class RestoreChest extends StatelessWidget {
}, },
child: Text( child: Text(
'restoreThisChest'.tr(), 'restoreThisChest'.tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 24, fontWeight: FontWeight.w600), fontSize: 20,
fontWeight: FontWeight.w600,
color: Colors.white),
), ),
), ),
), ),
@ -119,10 +118,10 @@ class RestoreChest extends StatelessWidget {
)) ))
else else
Column(children: [ Column(children: [
const SizedBox(height: 20), ScaledSizedBox(height: 20),
SizedBox( ScaledSizedBox(
width: 190, width: 210,
height: 60, height: 55,
child: ElevatedButton( child: ElevatedButton(
key: keyPastMnemonic, key: keyPastMnemonic,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
@ -135,16 +134,15 @@ class RestoreChest extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
const Icon( Icon(
Icons.content_paste_go, Icons.content_paste_go,
size: 27, size: scaleSize(28),
), ),
// const SizedBox(width: 10),
Text( Text(
'pasteFromClipboard'.tr(), 'pasteFromClipboard'.tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: scaledTextStyle(
fontSize: 17, fontWeight: FontWeight.w400), fontSize: 16, fontWeight: FontWeight.w400),
), ),
], ],
)), )),
@ -161,7 +159,7 @@ class RestoreChest extends StatelessWidget {
Widget bubbleSpeak(String text) { Widget bubbleSpeak(String text) {
return Bubble( return Bubble(
margin: const BubbleEdges.symmetric(horizontal: 20), margin: const BubbleEdges.symmetric(horizontal: 20),
padding: BubbleEdges.all(isTall ? 25 : 15), padding: BubbleEdges.all(scaleSize(15)),
borderWidth: 1, borderWidth: 1,
borderColor: Colors.black, borderColor: Colors.black,
radius: Radius.zero, radius: Radius.zero,
@ -170,8 +168,8 @@ class RestoreChest extends StatelessWidget {
text, text,
key: keyBubbleSpeak, key: keyBubbleSpeak,
textAlign: TextAlign.justify, textAlign: TextAlign.justify,
style: const TextStyle( style: scaledTextStyle(
color: Colors.black, fontSize: 19, fontWeight: FontWeight.w400), color: Colors.black, fontSize: 17, fontWeight: FontWeight.w400),
), ),
); );
} }
@ -181,8 +179,8 @@ class RestoreChest extends StatelessWidget {
Provider.of<GenerateWalletsProvider>(context); Provider.of<GenerateWalletsProvider>(context);
return Container( return Container(
width: 102, width: scaleSize(87),
height: 40 * ratio, height: scaleSize(37),
// ), // ),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: Colors.grey), border: Border.all(color: Colors.grey),
@ -213,7 +211,7 @@ class RestoreChest extends StatelessWidget {
} }
}, },
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(fontSize: 20), style: scaledTextStyle(fontSize: 17),
), ),
); );
} }
@ -221,7 +219,7 @@ class RestoreChest extends StatelessWidget {
Future<bool?> badMnemonicPopup(BuildContext context) async { Future<bool?> badMnemonicPopup(BuildContext context) async {
return showDialog<bool>( return showDialog<bool>(
context: context, context: context,
barrierDismissible: true, // user must tap button! barrierDismissible: true,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: const Text('Phrase incorrecte'), title: const Text('Phrase incorrecte'),

View File

@ -3,12 +3,14 @@ import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
import 'package:gecko/providers/wallets_profiles.dart'; import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/widgets/commons/build_text.dart'; import 'package:gecko/widgets/commons/build_text.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
import 'package:pdf/pdf.dart'; import 'package:pdf/pdf.dart';
import 'package:printing/printing.dart'; import 'package:printing/printing.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -33,12 +35,7 @@ class ShowSeed extends StatelessWidget {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('myMnemonic'.tr()),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text('myMnemonic'.tr()),
)),
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
const Spacer(flex: 1), const Spacer(flex: 1),
@ -48,10 +45,10 @@ class ShowSeed extends StatelessWidget {
builder: (BuildContext context, AsyncSnapshot<String?> seed) { builder: (BuildContext context, AsyncSnapshot<String?> seed) {
if (seed.connectionState != ConnectionState.done || if (seed.connectionState != ConnectionState.done ||
seed.hasError) { seed.hasError) {
return const SizedBox( return ScaledSizedBox(
height: 15, height: 15,
width: 15, width: 15,
child: CircularProgressIndicator( child: const CircularProgressIndicator(
color: orangeC, color: orangeC,
strokeWidth: 2, strokeWidth: 2,
), ),
@ -64,74 +61,82 @@ class ShowSeed extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Column(children: [ Column(children: [
BuildText(text: 'keepYourMnemonicSecret'.tr()), BuildText(
SizedBox(height: 35 * ratio), text: 'keepYourMnemonicSecret'.tr(), size: 16),
ScaledSizedBox(height: 35),
sentanceArray(context, seed.data!.split(' ')), sentanceArray(context, seed.data!.split(' ')),
const SizedBox(height: 20), ScaledSizedBox(height: 20),
SizedBox( Row(
height: 40, children: [
child: ElevatedButton( ScaledSizedBox(
style: ElevatedButton.styleFrom( height: 39,
foregroundColor: Colors.black, child: ElevatedButton(
shape: RoundedRectangleBorder( style: ElevatedButton.styleFrom(
borderRadius: BorderRadius.circular(8), foregroundColor: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
backgroundColor: orangeC,
elevation: 1,
),
onPressed: () {
Clipboard.setData(
ClipboardData(text: seed.data!));
snackCopySeed(context);
},
child: Row(children: <Widget>[
Image.asset(
'assets/walletOptions/copy-white.png',
height: scaleSize(24),
),
ScaledSizedBox(width: 7),
Text(
'copy'.tr(),
style: scaledTextStyle(
fontSize: 14, color: Colors.grey[50]),
)
]),
), ),
backgroundColor: orangeC,
elevation: 1, // foreground
), ),
onPressed: () { ScaledSizedBox(width: 50),
Clipboard.setData( GestureDetector(
ClipboardData(text: seed.data!)); onTap: () {
snackCopySeed(context); Navigator.push(
}, context,
child: Row(children: <Widget>[ MaterialPageRoute(builder: (context) {
Image.asset( return PrintWallet(seed.data);
'assets/walletOptions/copy-white.png', }),
height: 25, );
},
child: Image.asset(
'assets/printer.png',
height: scaleSize(38),
), ),
const SizedBox(width: 7), ),
Text( ],
'copy'.tr(),
style: TextStyle(
fontSize: 15, color: Colors.grey[50]),
)
]),
),
),
const SizedBox(height: 30),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return PrintWallet(seed.data);
}),
);
},
child: Image.asset(
'assets/printer.png',
height: 42 * ratio,
),
), ),
]), ]),
]); ]);
}), }),
const Spacer(flex: 2), const Spacer(flex: 3),
SizedBox( ScaledSizedBox(
width: 380 * ratio, width: 240,
height: 60 * ratio, height: 55,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
foregroundColor: Colors.white, elevation: 4, foregroundColor: Colors.white,
backgroundColor: orangeC, // foreground elevation: 4,
backgroundColor: orangeC,
), ),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
child: Text( child: Text(
'close'.tr(), 'close'.tr(),
style: TextStyle( style: scaledTextStyle(
fontSize: 23 * ratio, fontWeight: FontWeight.w600), fontSize: 19,
fontWeight: FontWeight.w600,
color: Colors.white),
), ),
), ),
), ),
@ -141,61 +146,55 @@ class ShowSeed extends StatelessWidget {
} }
Widget sentanceArray(BuildContext context, List mnemonic) { Widget sentanceArray(BuildContext context, List mnemonic) {
return Padding( return Container(
padding: const EdgeInsets.symmetric(horizontal: 3), constraints: BoxConstraints(maxWidth: scaleSize(360)),
child: Container( decoration: BoxDecoration(
constraints: const BoxConstraints(maxWidth: 450), border: Border.all(color: Colors.black),
decoration: BoxDecoration( color: const Color(0xffeeeedd),
border: Border.all(color: Colors.black), borderRadius: const BorderRadius.all(
color: const Color(0xffeeeedd), Radius.circular(10),
borderRadius: const BorderRadius.all( )),
Radius.circular(10), padding: EdgeInsets.all(scaleSize(14)),
)), child: Column(
padding: const EdgeInsets.all(20), mainAxisAlignment: MainAxisAlignment.center,
child: Column( mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max, children: <Widget>[
crossAxisAlignment: CrossAxisAlignment.center, Row(children: <Widget>[
children: <Widget>[ arrayCell(mnemonic[0], 1),
Row(children: <Widget>[ arrayCell(mnemonic[1], 2),
arrayCell(mnemonic[0], 1), arrayCell(mnemonic[2], 3),
arrayCell(mnemonic[1], 2), arrayCell(mnemonic[3], 4),
arrayCell(mnemonic[2], 3), ]),
arrayCell(mnemonic[3], 4), ScaledSizedBox(height: 15),
]), Row(children: <Widget>[
const SizedBox(height: 15), arrayCell(mnemonic[4], 5),
Row(children: <Widget>[ arrayCell(mnemonic[5], 6),
arrayCell(mnemonic[4], 5), arrayCell(mnemonic[6], 7),
arrayCell(mnemonic[5], 6), arrayCell(mnemonic[7], 8),
arrayCell(mnemonic[6], 7), ]),
arrayCell(mnemonic[7], 8), ScaledSizedBox(height: 15),
]), Row(children: <Widget>[
const SizedBox(height: 15), arrayCell(mnemonic[8], 9),
Row(children: <Widget>[ arrayCell(mnemonic[9], 10),
arrayCell(mnemonic[8], 9), arrayCell(mnemonic[10], 11),
arrayCell(mnemonic[9], 10), arrayCell(mnemonic[11], 12),
arrayCell(mnemonic[10], 11), ]),
arrayCell(mnemonic[11], 12), ]));
]),
])),
);
} }
Widget arrayCell(dataWord, int nbr) { Widget arrayCell(dataWord, int nbr) {
log.d(nbr); return ScaledSizedBox(
width: 82,
return SizedBox(
width: 100,
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Text( Text(
nbr.toString(), nbr.toString(),
style: style: scaledTextStyle(fontSize: 11, color: const Color(0xff6b6b52)),
TextStyle(fontSize: 13 * ratio, color: const Color(0xff6b6b52)),
), ),
Text( Text(
dataWord, dataWord,
key: keyMnemonicWord(dataWord), key: keyMnemonicWord(dataWord),
style: TextStyle(fontSize: 17 * ratio, color: Colors.black), style: scaledTextStyle(fontSize: 16, color: Colors.black),
), ),
]), ]),
); );
@ -219,13 +218,10 @@ class PrintWallet extends StatelessWidget {
}), }),
backgroundColor: yellowC, backgroundColor: yellowC,
foregroundColor: Colors.black, foregroundColor: Colors.black,
toolbarHeight: 60 * ratio, toolbarHeight: scaleSize(57),
title: SizedBox( title: Text(
height: 22, 'printMyMnemonic'.tr(),
child: Text( style: scaledTextStyle(fontWeight: FontWeight.w600),
'printMyMnemonic'.tr(),
style: const TextStyle(fontWeight: FontWeight.w600),
),
), ),
), ),
body: PdfPreview( body: PdfPreview(

View File

@ -5,6 +5,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:gecko/models/chest_data.dart'; import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
@ -58,15 +59,15 @@ class UnlockingWallet extends StatelessWidget {
children: <Widget>[ children: <Widget>[
Stack(children: <Widget>[ Stack(children: <Widget>[
Positioned( Positioned(
top: 10, //statusBarHeight + 10, top: 10,
left: 15, left: 15,
child: Builder( child: Builder(
builder: (context) => IconButton( builder: (context) => IconButton(
key: keyPopButton, key: keyPopButton,
icon: const Icon( icon: Icon(
Icons.arrow_back, Icons.arrow_back,
color: Colors.black, color: Colors.black,
size: 30, size: scaleSize(28),
), ),
onPressed: () { onPressed: () {
myWalletProvider.isPinValid = false; myWalletProvider.isPinValid = false;
@ -77,52 +78,55 @@ class UnlockingWallet extends StatelessWidget {
), ),
), ),
Column(children: <Widget>[ Column(children: <Widget>[
SizedBox(height: isTall ? 100 : 20), ScaledSizedBox(height: isTall ? 80 : 65),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
currentChest.imageFile == null currentChest.imageFile == null
? Image.asset( ? Image.asset(
'assets/chests/${currentChest.imageName}', 'assets/chests/${currentChest.imageName}',
width: isTall ? 130 : 100, width: scaleSize(95),
) )
: Image.file( : Image.file(
currentChest.imageFile!, currentChest.imageFile!,
width: isTall ? 130 : 100, width: scaleSize(127),
), ),
const SizedBox(width: 5), ScaledSizedBox(width: 5),
SizedBox( ScaledSizedBox(
width: 250, width: 250,
child: Text( child: Text(
currentChest.name!, currentChest.name!,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: scaledTextStyle(
fontSize: 25, fontSize: 22,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w700), fontWeight: FontWeight.w700),
)), )),
]), ]),
SizedBox(height: 30 * ratio), ScaledSizedBox(height: isTall ? 30 : 15),
SizedBox( ScaledSizedBox(
width: 400, width: 350,
child: Text( child: Text(
'toUnlockEnterPassword'.tr(), 'toUnlockEnterPassword'.tr(),
style: const TextStyle( textAlign: TextAlign.center,
fontSize: 19, style: scaledTextStyle(
fontSize: 16,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w400), fontWeight: FontWeight.w400),
)), )),
SizedBox(height: 30 * ratio), ScaledSizedBox(height: isTall ? 30 : 15),
if (!myWalletProvider.isPinValid && if (!myWalletProvider.isPinValid &&
!myWalletProvider.isPinLoading) !myWalletProvider.isPinLoading)
Text( Text(
"thisIsNotAGoodCode".tr(), "thisIsNotAGoodCode".tr(),
style: const TextStyle( style: scaledTextStyle(
color: Colors.red, fontWeight: FontWeight.w500), color: Colors.red,
fontWeight: FontWeight.w500,
fontSize: 16),
), ),
SizedBox(height: 10 * ratio), ScaledSizedBox(height: isTall ? 8 : 0),
pinForm(context, pinLenght), pinForm(context, pinLenght),
SizedBox(height: 3 * ratio), ScaledSizedBox(height: 8),
if (canUnlock) if (canUnlock)
Consumer<WalletOptionsProvider>( Consumer<WalletOptionsProvider>(
builder: (context, sub, _) { builder: (context, sub, _) {
@ -132,49 +136,50 @@ class UnlockingWallet extends StatelessWidget {
walletOptions.changePinCacheChoice(); walletOptions.changePinCacheChoice();
}, },
child: Row(children: [ child: Row(children: [
const SizedBox(height: 30), ScaledSizedBox(height: 30),
const Spacer(), const Spacer(),
Icon( Icon(
configBox.get('isCacheChecked') configBox.get('isCacheChecked')
? Icons.check_box ? Icons.check_box
: Icons.check_box_outline_blank, : Icons.check_box_outline_blank,
color: orangeC, color: orangeC,
size: scaleSize(22),
), ),
const SizedBox(width: 8), ScaledSizedBox(width: 8),
Text( Text(
'rememberPassword'.tr(), 'rememberPassword'.tr(),
style: TextStyle( style: scaledTextStyle(
fontSize: 16, color: Colors.grey[700]), fontSize: 15, color: Colors.grey[700]),
), ),
const Spacer() const Spacer()
]), ]),
); );
}), }),
const SizedBox(height: 10), // const ScaledSizedBox(height: 10),
// if (canUnlock) // if (canUnlock)
InkWell( // InkWell(
key: keyChangeChest, // key: keyChangeChest,
onTap: () { // onTap: () {
// Navigator.push( // // Navigator.push(
// context, // // context,
// MaterialPageRoute(builder: (context) { // // MaterialPageRoute(builder: (context) {
// return const ChooseChest(); // // return const ChooseChest();
// }), // // }),
// ); // // );
}, // },
child: SizedBox( // child: ScaledSizedBox(
width: 400, // width: 400,
height: 50, // height: 50,
child: Center( // child: Center(
child: Text( // child: Text(
'changeChest'.tr(), // 'changeChest'.tr(),
style: const TextStyle( // style: const scaledTextStyle(
fontSize: 22, // fontSize: 22,
color: Colors.grey, // orangeC // color: Colors.grey, // orangeC
fontWeight: FontWeight.w600), // fontWeight: FontWeight.w600),
), // ),
), // ),
)), // )),
]), ]),
]), ]),
]), ]),
@ -193,21 +198,22 @@ class UnlockingWallet extends StatelessWidget {
// return Text( // return Text(
// 'Impossible de retrouver votre\nportefeuille par défaut.\nID: ${defaultWallet.id()}', // 'Impossible de retrouver votre\nportefeuille par défaut.\nID: ${defaultWallet.id()}',
// textAlign: TextAlign.center, // textAlign: TextAlign.center,
// style: const TextStyle( // style: const scaledTextStyle(
// color: Colors.redAccent, fontWeight: FontWeight.w500), // color: Colors.redAccent, fontWeight: FontWeight.w500),
// ); // );
// } // }
return Form( return Form(
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(vertical: 5 * ratio, horizontal: 30), padding: EdgeInsets.symmetric(
vertical: scaleSize(3), horizontal: scaleSize(isTall ? 30 : 15)),
child: PinCodeTextField( child: PinCodeTextField(
key: keyPinForm, key: keyPinForm,
textCapitalization: TextCapitalization.characters, textCapitalization: TextCapitalization.characters,
focusNode: pinFocus, focusNode: pinFocus,
autoFocus: true, autoFocus: true,
appContext: context, appContext: context,
pastedTextStyle: TextStyle( pastedTextStyle: scaledTextStyle(
color: Colors.green.shade600, color: Colors.green.shade600,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@ -216,6 +222,7 @@ class UnlockingWallet extends StatelessWidget {
obscuringCharacter: '*', obscuringCharacter: '*',
animationType: AnimationType.slide, animationType: AnimationType.slide,
animationDuration: const Duration(milliseconds: 40), animationDuration: const Duration(milliseconds: 40),
useHapticFeedback: true,
validator: (v) { validator: (v) {
if (v!.length < pinLenght) { if (v!.length < pinLenght) {
return "yourPasswordLengthIsX".tr(args: [pinLenght.toString()]); return "yourPasswordLengthIsX".tr(args: [pinLenght.toString()]);
@ -228,13 +235,13 @@ class UnlockingWallet extends StatelessWidget {
borderWidth: 4, borderWidth: 4,
shape: PinCodeFieldShape.box, shape: PinCodeFieldShape.box,
borderRadius: BorderRadius.circular(5), borderRadius: BorderRadius.circular(5),
fieldHeight: 50 * ratio, fieldHeight: scaleSize(47),
fieldWidth: 50, fieldWidth: scaleSize(47),
activeFillColor: Colors.black, activeFillColor: Colors.black,
), ),
showCursor: kDebugMode ? false : true, showCursor: !kDebugMode,
cursorColor: Colors.black, cursorColor: Colors.black,
textStyle: const TextStyle(fontSize: 27, height: 1.6), textStyle: scaledTextStyle(fontSize: 25, height: 1.6),
backgroundColor: const Color(0xffF9F9F1), backgroundColor: const Color(0xffF9F9F1),
enableActiveFill: false, enableActiveFill: false,
controller: enterPin, controller: enterPin,
@ -263,7 +270,7 @@ class UnlockingWallet extends StatelessWidget {
myWalletProvider.isPinValid = true; myWalletProvider.isPinValid = true;
myWalletProvider.isPinLoading = false; myWalletProvider.isPinLoading = false;
pinColor = Colors.green[400]; pinColor = Colors.green[400];
myWalletProvider.resetPinCode(); myWalletProvider.debounceResetPinCode();
Navigator.pop(context, pin.toUpperCase()); Navigator.pop(context, pin.toUpperCase());
} }
}, },

View File

@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/duniter_indexer.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
@ -23,7 +24,6 @@ import 'package:gecko/widgets/idty_status.dart';
import 'package:gecko/widgets/name_by_address.dart'; import 'package:gecko/widgets/name_by_address.dart';
import 'package:gecko/widgets/page_route_no_transition.dart'; import 'package:gecko/widgets/page_route_no_transition.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart';
class WalletOptions extends StatelessWidget { class WalletOptions extends StatelessWidget {
@ -49,8 +49,6 @@ class WalletOptions extends StatelessWidget {
final isWalletNameIndexed = final isWalletNameIndexed =
duniterIndexer.walletNameIndexer[walletOptions.address.text] != null; duniterIndexer.walletNameIndexer[walletOptions.address.text] != null;
log.d("Wallet options: $currentChest:${wallet.derivation}");
return PopScope( return PopScope(
onPopInvoked: (_) { onPopInvoked: (_) {
walletOptions.isEditing = false; walletOptions.isEditing = false;
@ -61,18 +59,18 @@ class WalletOptions extends StatelessWidget {
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: AppBar( appBar: AppBar(
toolbarHeight: 60 * ratio, toolbarHeight: scaleSize(57),
elevation: 0, elevation: 0,
title: SizedBox( title: Consumer<WalletOptionsProvider>(
height: 22, builder: (context, walletProvider, _) {
child: Consumer<WalletOptionsProvider>( return Text(
builder: (context, walletProvider, _) { isWalletNameIndexed
return Text(isWalletNameIndexed
? duniterIndexer ? duniterIndexer
.walletNameIndexer[walletOptions.address.text]! .walletNameIndexer[walletOptions.address.text]!
: wallet.name!); : wallet.name!,
}), style: scaledTextStyle(fontSize: 20),
), );
}),
actions: [ actions: [
InkWell( InkWell(
onTap: () { onTap: () {
@ -88,7 +86,7 @@ class WalletOptions extends StatelessWidget {
child: QrImageWidget( child: QrImageWidget(
data: walletOptions.address.text, data: walletOptions.address.text,
version: QrVersions.auto, version: QrVersions.auto,
size: 80, size: scaleSize(70),
), ),
), ),
], ],
@ -99,7 +97,7 @@ class WalletOptions extends StatelessWidget {
builder: (ctx) => SafeArea( builder: (ctx) => SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Container( Container(
height: isTall ? 5 : 0, height: 5,
color: yellowC, color: yellowC,
), ),
Consumer<WalletOptionsProvider>( Consumer<WalletOptionsProvider>(
@ -116,14 +114,15 @@ class WalletOptions extends StatelessWidget {
)), )),
child: Row(children: <Widget>[ child: Row(children: <Widget>[
const Spacer(flex: 1), const Spacer(flex: 1),
ScaledSizedBox(width: 15),
avatar(walletProvider), avatar(walletProvider),
const Spacer(flex: 1), const Spacer(flex: 1),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Stack(children: [ Stack(children: [
SizedBox( ScaledSizedBox(
width: 250, width: 230,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -131,7 +130,7 @@ class WalletOptions extends StatelessWidget {
builder: (context, walletProvider, _) { builder: (context, walletProvider, _) {
return NameByAddress( return NameByAddress(
wallet: wallet, wallet: wallet,
size: 29, size: 24,
color: Colors.black, color: Colors.black,
fontWeight: wallet.identityStatus == fontWeight: wallet.identityStatus ==
IdtyStatus.validated IdtyStatus.validated
@ -142,7 +141,7 @@ class WalletOptions extends StatelessWidget {
], ],
), ),
), ),
const SizedBox(width: 10), ScaledSizedBox(width: 10),
if (duniterIndexer if (duniterIndexer
.walletNameIndexer[wallet.address] == .walletNameIndexer[wallet.address] ==
null) null)
@ -161,16 +160,16 @@ class WalletOptions extends StatelessWidget {
walletOptions.isEditing walletOptions.isEditing
? 'assets/walletOptions/android-checkmark.png' ? 'assets/walletOptions/android-checkmark.png'
: 'assets/walletOptions/edit.png', : 'assets/walletOptions/edit.png',
width: 25, width: scaleSize(23),
height: 25), height: scaleSize(23)),
), ),
), ),
), ),
]), ]),
SizedBox(height: isTall ? 5 : 0), ScaledSizedBox(height: 5),
Balance( Balance(
address: walletProvider.address.text, size: 24), address: walletProvider.address.text, size: 20),
const SizedBox(width: 30), ScaledSizedBox(width: 30),
InkWell( InkWell(
onTap: () => sub.certsCounterCache[ onTap: () => sub.certsCounterCache[
walletProvider.address.text] != walletProvider.address.text] !=
@ -200,10 +199,10 @@ class WalletOptions extends StatelessWidget {
color: orangeC), color: orangeC),
Certifications( Certifications(
address: walletProvider.address.text, address: walletProvider.address.text,
size: 20) size: 17)
]), ]),
), ),
SizedBox(height: 10 * ratio), ScaledSizedBox(height: 10),
]), ]),
const Spacer(flex: 2), const Spacer(flex: 2),
]), ]),
@ -214,24 +213,7 @@ class WalletOptions extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
// InkWell( ScaledSizedBox(height: 25),
// onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(builder: (context) {
// return QrCodeFullscreen(
// _walletOptions.address.text,
// );
// }),
// );
// },
// child: QrImageWidget(
// data: _walletOptions.address.text,
// version: QrVersions.auto,
// size: isTall ? 150 : 80,
// ),
// ),
SizedBox(height: 30 * ratio),
Consumer<WalletOptionsProvider>( Consumer<WalletOptionsProvider>(
builder: (context, walletProvider, _) { builder: (context, walletProvider, _) {
final defaultWallet = final defaultWallet =
@ -242,24 +224,24 @@ class WalletOptions extends StatelessWidget {
return Column(children: [ return Column(children: [
confirmIdentityButton(walletProvider), confirmIdentityButton(walletProvider),
pubkeyWidget(walletProvider, ctx), pubkeyWidget(walletProvider, ctx),
SizedBox(height: 10 * ratio), ScaledSizedBox(height: 11),
activityWidget( activityWidget(
context, historyProvider, walletProvider), context, historyProvider, walletProvider),
SizedBox(height: 12 * ratio), ScaledSizedBox(height: 11),
setDefaultWalletWidget( setDefaultWalletWidget(
context, context,
walletProvider, walletProvider,
myWalletProvider, myWalletProvider,
walletOptions, walletOptions,
currentChest), currentChest),
SizedBox(height: 17 * ratio), ScaledSizedBox(height: 11),
Column(children: [ Column(children: [
if (!walletProvider.isDefaultWallet && if (!walletProvider.isDefaultWallet &&
!wallet.isMembre()) !wallet.isMembre())
deleteWallet( deleteWallet(
context, walletProvider, currentChest) context, walletProvider, currentChest)
else else
const SizedBox(), ScaledSizedBox(),
if (wallet.isMembre()) if (wallet.isMembre())
const ManageMembershipButton() const ManageMembershipButton()
]) ])
@ -294,11 +276,11 @@ class WalletOptions extends StatelessWidget {
child: wallet.imageCustomPath == null || wallet.imageCustomPath == '' child: wallet.imageCustomPath == null || wallet.imageCustomPath == ''
? Image.asset( ? Image.asset(
'assets/avatars/${wallet.imageDefaultPath}', 'assets/avatars/${wallet.imageDefaultPath}',
width: 110, width: scaleSize(122),
) )
: Container( : Container(
width: 150, width: scaleSize(122),
height: 150, height: scaleSize(122),
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.transparent, color: Colors.transparent,
@ -321,7 +303,7 @@ class WalletOptions extends StatelessWidget {
}, },
child: Image.asset( child: Image.asset(
'assets/walletOptions/camera.png', 'assets/walletOptions/camera.png',
height: 40, height: scaleSize(38),
), ),
), ),
), ),
@ -338,9 +320,9 @@ class WalletOptions extends StatelessWidget {
(BuildContext context, AsyncSnapshot<List<IdtyStatus>> snapshot) { (BuildContext context, AsyncSnapshot<List<IdtyStatus>> snapshot) {
if (snapshot.data!.first == IdtyStatus.created) { if (snapshot.data!.first == IdtyStatus.created) {
return Column(children: [ return Column(children: [
SizedBox( ScaledSizedBox(
width: 320, width: 310,
height: 60, height: 55,
child: ElevatedButton( child: ElevatedButton(
key: keyConfirmIdentity, key: keyConfirmIdentity,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
@ -358,24 +340,24 @@ class WalletOptions extends StatelessWidget {
}, },
child: Text( child: Text(
'confirmMyIdentity'.tr(), 'confirmMyIdentity'.tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 21, fontWeight: FontWeight.w600), fontSize: 21, fontWeight: FontWeight.w600),
), ),
), ),
), ),
const SizedBox(height: 7), ScaledSizedBox(height: 7),
Text( Text(
"someoneCreatedYourIdentity".tr(args: [currencyName]), "someoneCreatedYourIdentity".tr(args: [currencyName]),
style: TextStyle( style: scaledTextStyle(
fontSize: 16, fontSize: 16,
color: Colors.grey[600], color: Colors.grey[600],
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
), ),
), ),
const SizedBox(height: 40), ScaledSizedBox(height: 40),
]); ]);
} else { } else {
return const SizedBox(); return ScaledSizedBox();
} }
}); });
}); });
@ -389,24 +371,24 @@ class WalletOptions extends StatelessWidget {
Clipboard.setData(ClipboardData(text: walletProvider.address.text)); Clipboard.setData(ClipboardData(text: walletProvider.address.text));
snackCopyKey(ctx); snackCopyKey(ctx);
}, },
child: SizedBox( child: ScaledSizedBox(
height: 50, height: 50,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
const SizedBox(width: 30), ScaledSizedBox(width: 26),
Image.asset( Image.asset(
'assets/walletOptions/key.png', 'assets/walletOptions/key.png',
height: 45, height: scaleSize(42),
), ),
const SizedBox(width: 20), ScaledSizedBox(width: 19),
Text(shortPubkey, Text(shortPubkey,
style: const TextStyle( style: scaledTextStyle(
fontSize: 22, fontSize: 19,
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
fontFamily: 'Monospace', fontFamily: 'Monospace',
color: Colors.black)), color: Colors.black)),
const SizedBox(width: 15), const Spacer(),
SizedBox( ScaledSizedBox(
height: 40, height: 35,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
foregroundColor: Colors.black, foregroundColor: Colors.black,
@ -414,7 +396,7 @@ class WalletOptions extends StatelessWidget {
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
backgroundColor: orangeC, backgroundColor: orangeC,
elevation: 1, // foreground elevation: 1,
), ),
onPressed: () { onPressed: () {
Clipboard.setData( Clipboard.setData(
@ -424,16 +406,12 @@ class WalletOptions extends StatelessWidget {
child: Row(children: <Widget>[ child: Row(children: <Widget>[
Image.asset( Image.asset(
'assets/walletOptions/copy-white.png', 'assets/walletOptions/copy-white.png',
height: 25, height: scaleSize(23),
), ),
const SizedBox(width: 7),
Text(
'copy'.tr(),
style: TextStyle(fontSize: 15, color: Colors.grey[50]),
)
]), ]),
), ),
), ),
const Spacer(),
]), ]),
), ),
); );
@ -446,7 +424,6 @@ class WalletOptions extends StatelessWidget {
return InkWell( return InkWell(
key: keyOpenActivity, key: keyOpenActivity,
onTap: () { onTap: () {
// _historyProvider.nPage = 1;
Navigator.push( Navigator.push(
context, context,
PageNoTransit(builder: (context) { PageNoTransit(builder: (context) {
@ -454,18 +431,16 @@ class WalletOptions extends StatelessWidget {
}), }),
); );
}, },
child: SizedBox( child: ScaledSizedBox(
height: 50, height: 50,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
const SizedBox(width: 30), ScaledSizedBox(width: 26),
Image.asset( Image.asset(
'assets/walletOptions/clock.png', 'assets/walletOptions/clock.png',
height: 45, height: scaleSize(42),
), ),
const SizedBox(width: 22), ScaledSizedBox(width: 20),
Text("displayActivity".tr(), Text("displayActivity".tr(), style: scaledTextStyle(fontSize: 18)),
style:
const TextStyle(fontSize: 20, fontWeight: FontWeight.w500)),
]), ]),
), ),
); );
@ -487,28 +462,34 @@ class WalletOptions extends StatelessWidget {
await setDefaultWallet(context, currentChest); await setDefaultWallet(context, currentChest);
} }
: null, : null,
child: SizedBox( child: ScaledSizedBox(
height: 50, height: 60,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
const SizedBox(width: 31), ScaledSizedBox(width: isTall ? 28 : 23),
CircleAvatar( ScaledSizedBox(
backgroundColor: height: 42,
Colors.grey[walletProvider.isDefaultWallet ? 300 : 500], child: CircleAvatar(
child: Image.asset( backgroundColor:
'assets/walletOptions/android-checkmark.png', Colors.grey[walletProvider.isDefaultWallet ? 300 : 500],
height: 25, child: Image.asset(
'assets/walletOptions/android-checkmark.png',
height: scaleSize(23),
),
), ),
), ),
const SizedBox(width: 22), ScaledSizedBox(width: isTall ? 21 : 18),
Text( ScaledSizedBox(
walletProvider.isDefaultWallet width: 250,
? 'thisWalletIsDefault'.tr() child: Text(
: 'defineWalletAsDefault'.tr(), walletProvider.isDefaultWallet
style: TextStyle( ? 'thisWalletIsDefault'.tr()
fontSize: 20, : 'defineWalletAsDefault'.tr(),
color: walletProvider.isDefaultWallet style: scaledTextStyle(
? Colors.grey[500] fontSize: 18,
: Colors.black)), color: walletProvider.isDefaultWallet
? Colors.grey[500]
: Colors.black)),
),
]), ]),
), ),
); );
@ -522,8 +503,6 @@ class WalletOptions extends StatelessWidget {
final walletOptions = final walletOptions =
Provider.of<WalletOptionsProvider>(context, listen: false); Provider.of<WalletOptionsProvider>(context, listen: false);
// WalletData defaultWallet = _myWalletProvider.getDefaultWallet()!;
// defaultWallet = wallet;
await sub.setCurrentWallet(wallet); await sub.setCurrentWallet(wallet);
await myWalletProvider.readAllWallets(currentChest); await myWalletProvider.readAllWallets(currentChest);
myWalletProvider.reload(); myWalletProvider.reload();
@ -539,8 +518,6 @@ class WalletOptions extends StatelessWidget {
final defaultWallet = myWalletProvider.getDefaultWallet(); final defaultWallet = myWalletProvider.getDefaultWallet();
final bool isDefaultWallet = final bool isDefaultWallet =
walletOptions.address.text == defaultWallet.address; walletOptions.address.text == defaultWallet.address;
// return Consumer<MyWalletsProvider>(
// builder: (context, _myWalletProvider, _) {
return FutureBuilder( return FutureBuilder(
future: sub.hasAccountConsumers(wallet.address), future: sub.hasAccountConsumers(wallet.address),
builder: (BuildContext context, AsyncSnapshot<bool> hasConsumers) { builder: (BuildContext context, AsyncSnapshot<bool> hasConsumers) {
@ -568,17 +545,17 @@ class WalletOptions extends StatelessWidget {
: null, : null,
child: canDelete child: canDelete
? Row(children: <Widget>[ ? Row(children: <Widget>[
const SizedBox(width: 30), ScaledSizedBox(width: 27),
Image.asset( Image.asset(
'assets/walletOptions/trash.png', 'assets/walletOptions/trash.png',
height: 45, height: scaleSize(42),
), ),
const SizedBox(width: 19), ScaledSizedBox(width: 19),
Text('deleteThisWallet'.tr(), Text('deleteThisWallet'.tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 20, color: Color(0xffD80000))), fontSize: 18, color: const Color(0xffD80000))),
]) ])
: const SizedBox(width: 30), : ScaledSizedBox(width: 30),
); );
}); });
} }

View File

@ -3,6 +3,7 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/chest_data.dart'; import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
@ -44,15 +45,21 @@ class _WalletsHomeState extends State<WalletsHome> {
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: AppBar(
elevation: 1, elevation: 1,
toolbarHeight: 60 * ratio, toolbarHeight: scaleSize(57),
title: Row( title: Row(
children: [ children: [
Image.asset( Image.asset(
'assets/chests/${currentChest.imageName}', 'assets/chests/${currentChest.imageName}',
height: 32, height: 32,
), ),
const SizedBox(width: 17), ScaledSizedBox(width: 17),
Text(currentChest.name!, style: TextStyle(color: Colors.grey[850])), Text(
currentChest.name!,
style: scaledTextStyle(
color: Colors.grey[850],
fontSize: 17,
fontWeight: FontWeight.w500),
),
], ],
), ),
backgroundColor: const Color(0xffFFD58D), backgroundColor: const Color(0xffFFD58D),
@ -73,11 +80,11 @@ class _WalletsHomeState extends State<WalletsHome> {
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.connectionState != ConnectionState.done || if (snapshot.connectionState != ConnectionState.done ||
snapshot.hasError) { snapshot.hasError) {
return const Center( return Center(
child: SizedBox( child: ScaledSizedBox(
height: 50, height: 50,
width: 50, width: 50,
child: CircularProgressIndicator( child: const CircularProgressIndicator(
color: orangeC, color: orangeC,
strokeWidth: 3, strokeWidth: 3,
), ),
@ -96,19 +103,19 @@ class _WalletsHomeState extends State<WalletsHome> {
Widget myWalletsTiles(BuildContext context, int currentChestNumber) { Widget myWalletsTiles(BuildContext context, int currentChestNumber) {
final myWalletProvider = Provider.of<MyWalletsProvider>(context); final myWalletProvider = Provider.of<MyWalletsProvider>(context);
final bool isWalletsExists = myWalletProvider.checkIfWalletExist(); final bool isWalletsExists = myWalletProvider.isWalletsExists();
if (!isWalletsExists) { if (!isWalletsExists) {
return const Text(''); return const Text('');
} }
if (myWalletProvider.listWallets.isEmpty) { if (myWalletProvider.listWallets.isEmpty) {
return const Expanded( return Expanded(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Center( Center(
child: Text( child: Text(
'Veuillez générer votre premier portefeuille', 'Veuillez générer votre premier portefeuille',
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w500), style: scaledTextStyle(fontSize: 17, fontWeight: FontWeight.w500),
)), )),
])); ]));
} }
@ -131,9 +138,9 @@ class _WalletsHomeState extends State<WalletsHome> {
final screenWidth = MediaQuery.of(context).size.width; final screenWidth = MediaQuery.of(context).size.width;
int nTule; int nTule;
if (screenWidth >= 900) { if (screenWidth >= 700) {
nTule = 4; nTule = 4;
} else if (screenWidth >= 650) { } else if (screenWidth >= 450) {
nTule = 3; nTule = 3;
} else { } else {
nTule = 2; nTule = 2;
@ -148,13 +155,13 @@ class _WalletsHomeState extends State<WalletsHome> {
TargetContent( TargetContent(
child: Column( child: Column(
children: [ children: [
Image.asset('assets/drag-and-drop.png', height: 140), Image.asset('assets/drag-and-drop.png', height: scaleSize(115)),
const SizedBox(height: 15), ScaledSizedBox(height: 15),
Text( Text(
'explainDraggableWallet'.tr(), 'explainDraggableWallet'.tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: scaledTextStyle(
fontSize: 22, fontWeight: FontWeight.w500), fontSize: 20, fontWeight: FontWeight.w500),
), ),
], ],
)) ))
@ -178,35 +185,38 @@ class _WalletsHomeState extends State<WalletsHome> {
configBox.put('showDraggableTutorial', false); configBox.put('showDraggableTutorial', false);
} }
return CustomScrollView(slivers: <Widget>[ return Padding(
const SliverToBoxAdapter(child: SizedBox(height: 20)), padding: const EdgeInsets.symmetric(horizontal: 5),
if (idtyWallet.address != '') child: CustomScrollView(slivers: <Widget>[
SliverToBoxAdapter( SliverToBoxAdapter(child: ScaledSizedBox(height: 12)),
child: DragTuleAction( if (idtyWallet.address != '')
wallet: idtyWallet, SliverToBoxAdapter(
child: WalletTileMembre(repository: idtyWallet), child: DragTuleAction(
wallet: idtyWallet,
child: WalletTileMembre(repository: idtyWallet),
),
), ),
), SliverGrid.count(
SliverGrid.count( key: keyListWallets,
key: keyListWallets, crossAxisCount: nTule,
crossAxisCount: nTule, childAspectRatio: 1,
childAspectRatio: 1, crossAxisSpacing: 0,
crossAxisSpacing: 0, mainAxisSpacing: 0,
mainAxisSpacing: 0, children: <Widget>[
children: <Widget>[ for (WalletData repository in listWalletsWithoutIdty)
for (WalletData repository in listWalletsWithoutIdty) DragTuleAction(
DragTuleAction( wallet: repository,
wallet: repository, child: WalletTile(repository: repository),
child: WalletTile(repository: repository), ),
), Consumer<SubstrateSdk>(builder: (context, sub, _) {
Consumer<SubstrateSdk>(builder: (context, sub, _) { return sub.nodeConnected &&
return sub.nodeConnected && myWalletProvider.listWallets.length < maxWalletsInSafe
myWalletProvider.listWallets.length < maxWalletsInSafe ? const AddNewDerivationButton()
? const AddNewDerivationButton() : const Text('');
: const Text(''); }),
}), ]),
]), const SliverToBoxAdapter(child: ChestOptionsButtons()),
const SliverToBoxAdapter(child: ChestOptionsButtons()), ]),
]); );
} }
} }

View File

@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:gecko/providers/wallets_profiles.dart'; import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/widgets/bottom_app_bar.dart'; import 'package:gecko/widgets/bottom_app_bar.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
import 'package:gecko/widgets/contacts_list.dart'; import 'package:gecko/widgets/contacts_list.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -24,15 +25,8 @@ class ContactsScreen extends StatelessWidget {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar(
elevation: 1, 'contactsManagementWithNbr'.tr(args: ['${myContacts.length}'])),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text(
'contactsManagementWithNbr'.tr(args: ['${myContacts.length}'])),
),
),
bottomNavigationBar: const GeckoBottomAppBar(), bottomNavigationBar: const GeckoBottomAppBar(),
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [

View File

@ -6,6 +6,7 @@ import 'package:gecko/globals.dart';
import 'package:gecko/screens/onBoarding/2.dart'; import 'package:gecko/screens/onBoarding/2.dart';
import 'package:gecko/widgets/commons/intro_info.dart'; import 'package:gecko/widgets/commons/intro_info.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
class OnboardingStepOne extends StatelessWidget { class OnboardingStepOne extends StatelessWidget {
const OnboardingStepOne({Key? key}) : super(key: key); const OnboardingStepOne({Key? key}) : super(key: key);
@ -14,17 +15,7 @@ class OnboardingStepOne extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('newWallet'.tr()),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text(
'newWallet'.tr(),
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
),
extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [
InfoIntro( InfoIntro(

View File

@ -5,6 +5,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/generate_wallets.dart'; import 'package:gecko/providers/generate_wallets.dart';
@ -16,6 +17,7 @@ import 'package:gecko/widgets/commons/build_text.dart';
import 'package:gecko/screens/onBoarding/11_congratulations.dart'; import 'package:gecko/screens/onBoarding/11_congratulations.dart';
import 'package:gecko/widgets/commons/fader_transition.dart'; import 'package:gecko/widgets/commons/fader_transition.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
import 'package:gecko/widgets/scan_derivations_info.dart'; import 'package:gecko/widgets/scan_derivations_info.dart';
import 'package:pin_code_fields/pin_code_fields.dart'; import 'package:pin_code_fields/pin_code_fields.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -48,25 +50,15 @@ class OnboardingStepTen extends StatelessWidget {
}, },
child: Scaffold( child: Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('myPassword'.tr()),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text(
'myPassword'.tr(),
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
),
extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [
Column(children: <Widget>[ Column(children: <Widget>[
SizedBox(height: isTall ? 40 : 20), ScaledSizedBox(height: isTall ? 25 : 5),
const BuildProgressBar(pagePosition: 9), const BuildProgressBar(pagePosition: 9),
SizedBox(height: isTall ? 40 : 20), ScaledSizedBox(height: isTall ? 25 : 5),
BuildText(text: "geckoWillCheckPassword".tr()), BuildText(text: "geckoWillCheckPassword".tr()),
SizedBox(height: isTall ? 60 : 10), ScaledSizedBox(height: isTall ? 25 : 0),
const ScanDerivationsInfo(), const ScanDerivationsInfo(),
Consumer<MyWalletsProvider>(builder: (context, mw, _) { Consumer<MyWalletsProvider>(builder: (context, mw, _) {
return Visibility( return Visibility(
@ -74,12 +66,14 @@ class OnboardingStepTen extends StatelessWidget {
!myWalletProvider.isPinLoading, !myWalletProvider.isPinLoading,
child: Text( child: Text(
"thisIsNotAGoodCode".tr(), "thisIsNotAGoodCode".tr(),
style: const TextStyle( style: scaledTextStyle(
color: Colors.red, fontWeight: FontWeight.w500), fontSize: 16,
color: Colors.red,
fontWeight: FontWeight.w500),
), ),
); );
}), }),
SizedBox(height: isTall ? 20 : 10), ScaledSizedBox(height: isTall ? 20 : 0),
Consumer<SubstrateSdk>(builder: (context, sub, _) { Consumer<SubstrateSdk>(builder: (context, sub, _) {
return sub.nodeConnected return sub.nodeConnected
? pinForm(context, walletOptions, pinLenght, 1, 2) ? pinForm(context, walletOptions, pinLenght, 1, 2)
@ -88,7 +82,7 @@ class OnboardingStepTen extends StatelessWidget {
children: [ children: [
Text( Text(
"youHaveToBeConnectedToValidateChest".tr(), "youHaveToBeConnectedToValidateChest".tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 20, fontSize: 20,
color: Colors.redAccent, color: Colors.redAccent,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -106,25 +100,25 @@ class OnboardingStepTen extends StatelessWidget {
walletOptions.changePinCacheChoice(); walletOptions.changePinCacheChoice();
}, },
child: Row(children: [ child: Row(children: [
const SizedBox(height: 30), ScaledSizedBox(height: isTall ? 30 : 0),
const Spacer(), const Spacer(),
Icon( Icon(
configBox.get('isCacheChecked') ?? false configBox.get('isCacheChecked') ?? false
? Icons.check_box ? Icons.check_box
: Icons.check_box_outline_blank, : Icons.check_box_outline_blank,
color: orangeC, color: orangeC,
size: scaleSize(22),
), ),
const SizedBox(width: 8), ScaledSizedBox(width: 8),
Text( Text(
'rememberPassword'.tr(), 'rememberPassword'.tr(),
style: TextStyle( style: scaledTextStyle(
fontSize: 16, color: Colors.grey[700]), fontSize: 15, color: Colors.grey[700]),
), ),
const Spacer() const Spacer()
])) ]))
: const Text(''); : const Text('');
}), }),
const SizedBox(height: 10),
]), ]),
const OfflineInfo(), const OfflineInfo(),
]), ]),
@ -159,6 +153,7 @@ class OnboardingStepTen extends StatelessWidget {
length: pinLenght, length: pinLenght,
obscureText: true, obscureText: true,
obscuringCharacter: '*', obscuringCharacter: '*',
useHapticFeedback: true,
animationType: AnimationType.slide, animationType: AnimationType.slide,
animationDuration: const Duration(milliseconds: 40), animationDuration: const Duration(milliseconds: 40),
validator: (v) { validator: (v) {
@ -173,13 +168,13 @@ class OnboardingStepTen extends StatelessWidget {
borderWidth: 4, borderWidth: 4,
shape: PinCodeFieldShape.box, shape: PinCodeFieldShape.box,
borderRadius: BorderRadius.circular(5), borderRadius: BorderRadius.circular(5),
fieldHeight: 50 * ratio, fieldHeight: scaleSize(47),
fieldWidth: 50, fieldWidth: scaleSize(47),
activeFillColor: Colors.black, activeFillColor: Colors.black,
), ),
showCursor: kDebugMode ? false : true, showCursor: !kDebugMode,
cursorColor: Colors.black, cursorColor: Colors.black,
textStyle: const TextStyle(fontSize: 27, height: 1.6), textStyle: const TextStyle(fontSize: 25, height: 1.6),
backgroundColor: const Color(0xffF9F9F1), backgroundColor: const Color(0xffF9F9F1),
enableActiveFill: false, enableActiveFill: false,
controller: enterPin, controller: enterPin,
@ -194,7 +189,6 @@ class OnboardingStepTen extends StatelessWidget {
onCompleted: (pin) async { onCompleted: (pin) async {
myWalletProvider.pinCode = pin.toUpperCase(); myWalletProvider.pinCode = pin.toUpperCase();
myWalletProvider.pinLenght = pinLenght; myWalletProvider.pinLenght = pinLenght;
log.d('$pin || ${generateWalletProvider.pin.text}');
if (pin.toUpperCase() == generateWalletProvider.pin.text) { if (pin.toUpperCase() == generateWalletProvider.pin.text) {
pinColor = Colors.green[500]; pinColor = Colors.green[500];
myWalletProvider.isPinLoading = false; myWalletProvider.isPinLoading = false;
@ -225,8 +219,7 @@ class OnboardingStepTen extends StatelessWidget {
myWalletProvider.reload(); myWalletProvider.reload();
generateWalletProvider.generatedMnemonic = ''; generateWalletProvider.generatedMnemonic = '';
myWalletProvider.resetPinCode(); myWalletProvider.debounceResetPinCode();
// sleep(const Duration(milliseconds: 500));
Navigator.push( Navigator.push(
context, context,
FaderTransition( FaderTransition(
@ -238,7 +231,6 @@ class OnboardingStepTen extends StatelessWidget {
myWalletProvider.isPinValid = false; myWalletProvider.isPinValid = false;
pinColor = Colors.red[600]; pinColor = Colors.red[600];
enterPin.text = ''; enterPin.text = '';
// myWalletProvider.reload();
pinFocus.requestFocus(); pinFocus.requestFocus();
} }
}, },

View File

@ -5,8 +5,10 @@ import 'package:confetti/confetti.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/widgets/commons/build_text.dart'; import 'package:gecko/widgets/commons/build_text.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
class OnboardingStepEleven extends StatelessWidget { class OnboardingStepEleven extends StatelessWidget {
const OnboardingStepEleven({Key? key}) : super(key: key); const OnboardingStepEleven({Key? key}) : super(key: key);
@ -20,35 +22,24 @@ class OnboardingStepEleven extends StatelessWidget {
canPop: false, canPop: false,
child: Scaffold( child: Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('allGood'.tr()),
toolbarHeight: 60 * ratio,
leading: const Icon(Icons.check),
title: SizedBox(
height: 22,
child: Text(
'allGood'.tr(),
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
),
extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [
Column(children: <Widget>[ Column(children: <Widget>[
const SizedBox(height: 40), ScaledSizedBox(height: isTall ? 25 : 5),
BuildText( BuildText(
text: "yourChestAndWalletWereCreatedSuccessfully".tr()), text: "yourChestAndWalletWereCreatedSuccessfully".tr()),
SizedBox(height: isTall ? 20 : 10), ScaledSizedBox(height: isTall ? 15 : 5),
Image.asset( Image.asset(
'assets/onBoarding/gecko-clin.gif', 'assets/onBoarding/gecko-clin.gif',
height: isTall ? 400 : 300, height: scaleSize(isTall ? 330 : 280),
), ),
Expanded( Expanded(
child: Align( child: Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: finishButton(context)), child: finishButton(context)),
), ),
const SizedBox(height: 40), ScaledSizedBox(height: isTall ? 40 : 5),
]), ]),
Align( Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
@ -83,9 +74,9 @@ class OnboardingStepEleven extends StatelessWidget {
} }
Widget finishButton(BuildContext context) { Widget finishButton(BuildContext context) {
return SizedBox( return ScaledSizedBox(
width: 380 * ratio, width: 340,
height: 60 * ratio, height: 55,
child: ElevatedButton( child: ElevatedButton(
key: keyGoWalletsHome, key: keyGoWalletsHome,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
@ -99,7 +90,8 @@ Widget finishButton(BuildContext context) {
}, },
child: Text( child: Text(
"accessMyChest".tr(), "accessMyChest".tr(),
style: TextStyle(fontSize: 22 * ratio, fontWeight: FontWeight.w600), style: scaledTextStyle(
fontSize: 21, fontWeight: FontWeight.w600, color: Colors.white),
), ),
), ),
); );

View File

@ -7,6 +7,7 @@ import 'package:gecko/globals.dart';
import 'package:gecko/screens/onBoarding/3.dart'; import 'package:gecko/screens/onBoarding/3.dart';
import 'package:gecko/widgets/commons/intro_info.dart'; import 'package:gecko/widgets/commons/intro_info.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
class OnboardingStepTwo extends StatelessWidget { class OnboardingStepTwo extends StatelessWidget {
const OnboardingStepTwo({Key? key}) : super(key: key); const OnboardingStepTwo({Key? key}) : super(key: key);
@ -15,17 +16,7 @@ class OnboardingStepTwo extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('yourMnemonic'.tr()),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text(
'yourMnemonic'.tr(),
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
),
extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [
InfoIntro( InfoIntro(

View File

@ -7,6 +7,7 @@ import 'package:gecko/globals.dart';
import 'package:gecko/screens/onBoarding/4.dart'; import 'package:gecko/screens/onBoarding/4.dart';
import 'package:gecko/widgets/commons/intro_info.dart'; import 'package:gecko/widgets/commons/intro_info.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
class OnboardingStepThree extends StatelessWidget { class OnboardingStepThree extends StatelessWidget {
const OnboardingStepThree({Key? key}) : super(key: key); const OnboardingStepThree({Key? key}) : super(key: key);
@ -15,25 +16,17 @@ class OnboardingStepThree extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('yourMnemonic'.tr()),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text(
'yourMnemonic'.tr(),
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
),
extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [
InfoIntro( InfoIntro(
text: 'warningForgotPassword'.tr(), text: 'warningForgotPassword'.tr(),
assetName: 'forgot_password.png'.tr(), assetName: 'forgot_password.png'.tr(),
buttonText: '>', buttonText: '>',
nextScreen: const OnboardingStepFor(), nextScreen: const OnboardingStepFor(),
pagePosition: 2), pagePosition: 2,
boxHeight: 316,
),
const OfflineInfo(), const OfflineInfo(),
]), ]),
), ),

View File

@ -7,6 +7,7 @@ import 'package:gecko/globals.dart';
import 'package:gecko/screens/onBoarding/5.dart'; import 'package:gecko/screens/onBoarding/5.dart';
import 'package:gecko/widgets/commons/intro_info.dart'; import 'package:gecko/widgets/commons/intro_info.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
class OnboardingStepFor extends StatelessWidget { class OnboardingStepFor extends StatelessWidget {
const OnboardingStepFor({Key? key}) : super(key: key); const OnboardingStepFor({Key? key}) : super(key: key);
@ -15,17 +16,7 @@ class OnboardingStepFor extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('yourMnemonic'.tr()),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text(
'yourMnemonic'.tr(),
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
),
extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [
InfoIntro( InfoIntro(

View File

@ -5,6 +5,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/generate_wallets.dart'; import 'package:gecko/providers/generate_wallets.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
@ -15,6 +16,7 @@ import 'package:gecko/widgets/commons/build_text.dart';
import 'package:gecko/screens/onBoarding/6.dart'; import 'package:gecko/screens/onBoarding/6.dart';
import 'package:gecko/widgets/commons/fader_transition.dart'; import 'package:gecko/widgets/commons/fader_transition.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
AsyncSnapshot<List>? mnemoList; AsyncSnapshot<List>? mnemoList;
@ -39,30 +41,53 @@ class _ChooseChestState extends State<OnboardingStepFive> {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('yourMnemonic'.tr()),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text(
'yourMnemonic'.tr(),
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
),
extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [
Column(children: [ Column(children: [
SizedBox(height: isTall ? 40 : 20), ScaledSizedBox(height: isTall ? 25 : 5),
const BuildProgressBar(pagePosition: 4), const BuildProgressBar(pagePosition: 4),
SizedBox(height: isTall ? 40 : 20), ScaledSizedBox(height: isTall ? 25 : 5),
BuildText(text: 'geckoGeneratedYourMnemonicKeepItSecret'.tr()), BuildText(text: 'geckoGeneratedYourMnemonicKeepItSecret'.tr()),
SizedBox(height: 35 * ratio), ScaledSizedBox(height: isTall ? 15 : 5),
sentanceArray(context), sentanceArray(context),
SizedBox(height: 17 * ratio), ScaledSizedBox(height: isTall ? 17 : 5),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
ScaledSizedBox(
height: 40,
width: 132,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
backgroundColor: orangeC,
elevation: 1,
),
onPressed: () {
Clipboard.setData(ClipboardData(
text: generateWalletProvider.generatedMnemonic!));
snackCopySeed(context);
},
child: Row(children: <Widget>[
Image.asset(
'assets/walletOptions/copy-white.png',
height: scaleSize(23),
),
const Spacer(),
Text(
'copy'.tr(),
style: scaledTextStyle(
fontSize: 15, color: Colors.grey[50]),
),
const Spacer(),
]),
),
),
ScaledSizedBox(width: 70),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
@ -75,71 +100,39 @@ class _ChooseChestState extends State<OnboardingStepFive> {
}, },
child: Image.asset( child: Image.asset(
'assets/printer.png', 'assets/printer.png',
height: 42 * ratio, height: scaleSize(42),
),
),
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]),
)
]),
), ),
), ),
], ],
), ),
const SizedBox(height: 40), ScaledSizedBox(height: isTall ? 17 : 5),
Expanded( Expanded(
child: Align( child: Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: SizedBox( child: ScaledSizedBox(
width: 380 * ratio, width: 350,
height: 60 * ratio, height: 55,
child: ElevatedButton( child: ElevatedButton(
key: keyGenerateMnemonic, key: keyGenerateMnemonic,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
foregroundColor: Colors.black, elevation: 4, foregroundColor: Colors.black,
backgroundColor: const Color(0xffFFD58D), // foreground elevation: 4,
backgroundColor: const Color(0xffFFD58D),
), ),
onPressed: () { onPressed: () {
// _generateWalletProvider.reloadBuild();
setState(() {}); setState(() {});
}, },
child: Text("chooseAnotherMnemonic".tr(), child: Text("chooseAnotherMnemonic".tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: scaledTextStyle(
fontSize: 22 * ratio, fontSize: 22, fontWeight: FontWeight.w600))),
fontWeight: FontWeight.w600))),
), ),
), ),
), ),
SizedBox(height: 22 * ratio), ScaledSizedBox(height: isTall ? 20 : 10),
nextButton( nextButton(
context, "iNotedMyMnemonic".tr(), false, widget.skipIntro), context, "iNotedMyMnemonic".tr(), false, widget.skipIntro),
const Spacer(), isTall ? const Spacer() : const SizedBox(height: 5),
// SizedBox(height: 35 * ratio),
]), ]),
const OfflineInfo(), const OfflineInfo(),
]), ]),
@ -152,68 +145,65 @@ Widget sentanceArray(BuildContext context) {
final generateWalletProvider = final generateWalletProvider =
Provider.of<GenerateWalletsProvider>(context, listen: false); Provider.of<GenerateWalletsProvider>(context, listen: false);
return Padding( return Container(
padding: const EdgeInsets.symmetric(horizontal: 3), constraints: BoxConstraints(maxWidth: scaleSize(isTall ? 355 : 340)),
child: Container( decoration: BoxDecoration(
constraints: const BoxConstraints(maxWidth: 450), border: Border.all(color: Colors.black),
decoration: BoxDecoration( color: const Color(0xffeeeedd),
border: Border.all(color: Colors.black), borderRadius: const BorderRadius.all(
color: const Color(0xffeeeedd), Radius.circular(10),
borderRadius: const BorderRadius.all( )),
Radius.circular(10), padding: EdgeInsets.all(scaleSize(11)),
)), child: FutureBuilder(
padding: const EdgeInsets.all(20), future: generateWalletProvider.generateWordList(context),
child: FutureBuilder( builder: (BuildContext context, AsyncSnapshot<List> data) {
future: generateWalletProvider.generateWordList(context), if (!data.hasData) {
builder: (BuildContext context, AsyncSnapshot<List> data) { return const Text('');
if (!data.hasData) { } else {
return const Text(''); mnemoList = data;
} else { return Column(
mnemoList = data; mainAxisAlignment: MainAxisAlignment.center,
return Column( mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max, children: <Widget>[
crossAxisAlignment: CrossAxisAlignment.center, Row(children: <Widget>[
children: <Widget>[ arrayCell(data.data![0]),
Row(children: <Widget>[ arrayCell(data.data![1]),
arrayCell(data.data![0]), arrayCell(data.data![2]),
arrayCell(data.data![1]), arrayCell(data.data![3]),
arrayCell(data.data![2]), ]),
arrayCell(data.data![3]), ScaledSizedBox(height: 12),
]), Row(children: <Widget>[
const SizedBox(height: 15), arrayCell(data.data![4]),
Row(children: <Widget>[ arrayCell(data.data![5]),
arrayCell(data.data![4]), arrayCell(data.data![6]),
arrayCell(data.data![5]), arrayCell(data.data![7]),
arrayCell(data.data![6]), ]),
arrayCell(data.data![7]), ScaledSizedBox(height: 12),
]), Row(children: <Widget>[
const SizedBox(height: 15), arrayCell(data.data![8]),
Row(children: <Widget>[ arrayCell(data.data![9]),
arrayCell(data.data![8]), arrayCell(data.data![10]),
arrayCell(data.data![9]), arrayCell(data.data![11]),
arrayCell(data.data![10]), ]),
arrayCell(data.data![11]), ]);
]), }
]); }),
}
}),
),
); );
} }
Widget arrayCell(dataWord) { Widget arrayCell(dataWord) {
return SizedBox( return ScaledSizedBox(
width: 100, width: scaleSize(isTall ? 78 : 91),
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Text( Text(
dataWord.split(':')[0], dataWord.split(':')[0],
style: TextStyle(fontSize: 13 * ratio, color: const Color(0xff6b6b52)), style: scaledTextStyle(fontSize: 12, color: const Color(0xff6b6b52)),
), ),
Text( Text(
dataWord.split(':')[1], dataWord.split(':')[1],
key: keyMnemonicWord(dataWord.split(':')[0]), key: keyMnemonicWord(dataWord.split(':')[0]),
style: TextStyle(fontSize: 17 * ratio, color: Colors.black), style: scaledTextStyle(fontSize: 16, color: Colors.black),
), ),
]), ]),
); );
@ -225,9 +215,9 @@ Widget nextButton(
Provider.of<GenerateWalletsProvider>(context, listen: false); Provider.of<GenerateWalletsProvider>(context, listen: false);
final myWalletProvider = final myWalletProvider =
Provider.of<MyWalletsProvider>(context, listen: false); Provider.of<MyWalletsProvider>(context, listen: false);
return SizedBox( return ScaledSizedBox(
width: 380 * ratio, width: 350,
height: 60 * ratio, height: 55,
child: ElevatedButton( child: ElevatedButton(
key: keyGoNext, key: keyGoNext,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
@ -251,7 +241,8 @@ Widget nextButton(
}, },
child: Text( child: Text(
text, text,
style: TextStyle(fontSize: 22 * ratio, fontWeight: FontWeight.w600), style: scaledTextStyle(
fontSize: 22, fontWeight: FontWeight.w600, color: Colors.white),
), ),
), ),
); );

View File

@ -2,9 +2,9 @@
// ignore_for_file: must_be_immutable // ignore_for_file: must_be_immutable
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/generate_wallets.dart'; import 'package:gecko/providers/generate_wallets.dart';
import 'package:gecko/widgets/commons/build_progress_bar.dart'; import 'package:gecko/widgets/commons/build_progress_bar.dart';
@ -13,6 +13,7 @@ import 'package:gecko/screens/onBoarding/7.dart';
import 'package:gecko/screens/onBoarding/9.dart'; import 'package:gecko/screens/onBoarding/9.dart';
import 'package:gecko/widgets/commons/fader_transition.dart'; import 'package:gecko/widgets/commons/fader_transition.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class OnboardingStepSix extends StatelessWidget { class OnboardingStepSix extends StatelessWidget {
@ -22,7 +23,7 @@ class OnboardingStepSix extends StatelessWidget {
final bool skipIntro; final bool skipIntro;
String? generatedMnemonic; String? generatedMnemonic;
TextEditingController wordController = TextEditingController(); final wordController = TextEditingController();
final TextEditingController _mnemonicController = TextEditingController(); final TextEditingController _mnemonicController = TextEditingController();
@override @override
@ -40,47 +41,37 @@ class OnboardingStepSix extends StatelessWidget {
child: Scaffold( child: Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
extendBodyBehindAppBar: true, appBar: GeckoAppBar('yourMnemonic'.tr()),
appBar: AppBar(
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text(
'yourMnemonic'.tr(),
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
),
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [
Align( Align(
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
child: Column(children: [ child: Column(children: [
SizedBox(height: isTall ? 40 : 20), ScaledSizedBox(height: isTall ? 25 : 5),
const BuildProgressBar(pagePosition: 5), const BuildProgressBar(pagePosition: 5),
SizedBox(height: isTall ? 40 : 20), ScaledSizedBox(height: isTall ? 25 : 5),
BuildText( BuildText(
text: "didYouNoteMnemonicToBeSureTypeWord".tr(args: [ text: "didYouNoteMnemonicToBeSureTypeWord".tr(args: [
(generateWalletProvider.nbrWord + 1).toString() (generateWalletProvider.nbrWord + 1).toString()
]), ]),
size: 20,
isMd: true), isMd: true),
SizedBox(height: isTall ? 70 : 20), ScaledSizedBox(height: isTall ? 40 : 5),
Text('${generateWalletProvider.nbrWord + 1}', if (isTall)
key: keyAskedWord, Text('${generateWalletProvider.nbrWord + 1}',
style: TextStyle( key: keyAskedWord,
fontSize: isTall ? 17 : 15, style: scaledTextStyle(
color: orangeC, fontSize: 20,
fontWeight: FontWeight.w400)), color: orangeC,
const SizedBox(height: 10), fontWeight: FontWeight.w500)),
if (isTall) ScaledSizedBox(height: 5),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(7), borderRadius: BorderRadius.circular(7),
border: Border.all( border: Border.all(
color: Colors.grey[600]!, color: Colors.grey[600]!,
width: 3, width: scaleSize(3),
)), )),
width: 430, width: scaleSize(340),
child: TextFormField( child: TextFormField(
key: keyInputWord, key: keyInputWord,
autofocus: true, autofocus: true,
@ -94,8 +85,8 @@ class OnboardingStepSix extends StatelessWidget {
maxLines: 1, maxLines: 1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: InputDecoration( decoration: InputDecoration(
labelStyle: TextStyle( labelStyle: scaledTextStyle(
fontSize: 22.0, fontSize: 19,
color: Colors.grey[500], color: Colors.grey[500],
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
labelText: generateWalletProvider.isAskedWordValid labelText: generateWalletProvider.isAskedWordValid
@ -103,10 +94,10 @@ class OnboardingStepSix extends StatelessWidget {
: "${generateWalletProvider.nbrWordAlpha} ${"nthMnemonicWord".tr()}", : "${generateWalletProvider.nbrWordAlpha} ${"nthMnemonicWord".tr()}",
fillColor: const Color(0xffeeeedd), fillColor: const Color(0xffeeeedd),
filled: true, filled: true,
contentPadding: const EdgeInsets.all(12), contentPadding: const EdgeInsets.all(10),
), ),
style: TextStyle( style: scaledTextStyle(
fontSize: 40.0, fontSize: 26,
color: generateWalletProvider.askedWordColor, color: generateWalletProvider.askedWordColor,
fontWeight: FontWeight.w500))), fontWeight: FontWeight.w500))),
Visibility( Visibility(
@ -133,7 +124,7 @@ class OnboardingStepSix extends StatelessWidget {
// ), // ),
// ), // ),
// ), // ),
SizedBox(height: 35 * ratio), ScaledSizedBox(height: 40),
]), ]),
), ),
const OfflineInfo(), const OfflineInfo(),
@ -151,9 +142,9 @@ Widget nextButton(BuildContext context, String text, nextScreen, bool isFast) {
generateWalletProvider.isAskedWordValid = false; generateWalletProvider.isAskedWordValid = false;
generateWalletProvider.askedWordColor = Colors.black; generateWalletProvider.askedWordColor = Colors.black;
return SizedBox( return ScaledSizedBox(
width: 380 * ratio, width: 340,
height: 60 * ratio, height: 55,
child: ElevatedButton( child: ElevatedButton(
key: keyGoNext, key: keyGoNext,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
@ -166,7 +157,8 @@ Widget nextButton(BuildContext context, String text, nextScreen, bool isFast) {
}, },
child: Text( child: Text(
text, text,
style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w600), style: scaledTextStyle(
fontSize: 22, fontWeight: FontWeight.w600, color: Colors.white),
), ),
), ),
); );

View File

@ -1,11 +1,12 @@
// ignore_for_file: file_names // ignore_for_file: file_names
import 'package:easy_localization/easy_localization.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/onBoarding/8.dart'; import 'package:gecko/screens/onBoarding/8.dart';
import 'package:gecko/widgets/commons/intro_info.dart'; import 'package:gecko/widgets/commons/intro_info.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
class OnboardingStepSeven extends StatelessWidget { class OnboardingStepSeven extends StatelessWidget {
const OnboardingStepSeven({Key? key, this.scanDerivation = false}) const OnboardingStepSeven({Key? key, this.scanDerivation = false})
@ -16,17 +17,7 @@ class OnboardingStepSeven extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('myPassword'.tr()),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text(
'myPassword'.tr(),
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
),
extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [
InfoIntro( InfoIntro(
@ -35,7 +26,7 @@ class OnboardingStepSeven extends StatelessWidget {
buttonText: '>', buttonText: '>',
nextScreen: OnboardingStepEight(scanDerivation: scanDerivation), nextScreen: OnboardingStepEight(scanDerivation: scanDerivation),
pagePosition: 6, pagePosition: 6,
boxHeight: 400), boxHeight: 320),
const OfflineInfo(), const OfflineInfo(),
]), ]),
), ),

View File

@ -1,11 +1,12 @@
// ignore_for_file: file_names // ignore_for_file: file_names
import 'package:easy_localization/easy_localization.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/onBoarding/9.dart'; import 'package:gecko/screens/onBoarding/9.dart';
import 'package:gecko/widgets/commons/intro_info.dart'; import 'package:gecko/widgets/commons/intro_info.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
class OnboardingStepEight extends StatelessWidget { class OnboardingStepEight extends StatelessWidget {
const OnboardingStepEight({Key? key, this.scanDerivation = false}) const OnboardingStepEight({Key? key, this.scanDerivation = false})
@ -16,17 +17,7 @@ class OnboardingStepEight extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('myPassword'.tr()),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text(
'myPassword'.tr(),
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
),
extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [
InfoIntro( InfoIntro(
@ -35,7 +26,8 @@ class OnboardingStepEight extends StatelessWidget {
buttonText: '>', buttonText: '>',
nextScreen: OnboardingStepNine(scanDerivation: scanDerivation), nextScreen: OnboardingStepNine(scanDerivation: scanDerivation),
pagePosition: 7, pagePosition: 7,
isMd: true), isMd: true,
boxHeight: 320),
const OfflineInfo(), const OfflineInfo(),
]), ]),
), ),

View File

@ -1,8 +1,9 @@
// ignore_for_file: file_names // ignore_for_file: file_names
import 'package:easy_localization/easy_localization.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/generate_wallets.dart'; import 'package:gecko/providers/generate_wallets.dart';
import 'package:gecko/widgets/commons/build_progress_bar.dart'; import 'package:gecko/widgets/commons/build_progress_bar.dart';
@ -10,6 +11,7 @@ import 'package:gecko/widgets/commons/build_text.dart';
import 'package:gecko/screens/onBoarding/10.dart'; import 'package:gecko/screens/onBoarding/10.dart';
import 'package:gecko/widgets/commons/next_button.dart'; import 'package:gecko/widgets/commons/next_button.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class OnboardingStepNine extends StatelessWidget { class OnboardingStepNine extends StatelessWidget {
@ -21,8 +23,6 @@ class OnboardingStepNine extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final generateWalletProvider = final generateWalletProvider =
Provider.of<GenerateWalletsProvider>(context); Provider.of<GenerateWalletsProvider>(context);
// final myWalletProvider =
// Provider.of<MyWalletsProvider>(context);
generateWalletProvider.pin.text = debugPin // kDebugMode && generateWalletProvider.pin.text = debugPin // kDebugMode &&
? 'AAAAA' ? 'AAAAA'
@ -30,25 +30,15 @@ class OnboardingStepNine extends StatelessWidget {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('myPassword'.tr()),
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text(
'myPassword'.tr(),
style: const TextStyle(fontWeight: FontWeight.w600),
),
),
),
extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [
Column(children: <Widget>[ Column(children: <Widget>[
SizedBox(height: isTall ? 40 : 20), ScaledSizedBox(height: isTall ? 25 : 5),
const BuildProgressBar(pagePosition: 8), const BuildProgressBar(pagePosition: 8),
SizedBox(height: isTall ? 40 : 20), ScaledSizedBox(height: isTall ? 25 : 5),
BuildText(text: "hereIsThePasswordKeepIt".tr()), BuildText(text: "hereIsThePasswordKeepIt".tr()),
const SizedBox(height: 100), ScaledSizedBox(height: isTall ? 60 : 10),
Stack( Stack(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
children: <Widget>[ children: <Widget>[
@ -60,9 +50,9 @@ class OnboardingStepNine extends StatelessWidget {
maxLines: 1, maxLines: 1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: const InputDecoration(), decoration: const InputDecoration(),
style: const TextStyle( style: scaledTextStyle(
letterSpacing: 5, letterSpacing: 5,
fontSize: 35.0, fontSize: 33,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
IconButton( IconButton(
@ -74,18 +64,18 @@ class OnboardingStepNine extends StatelessWidget {
), ),
], ],
), ),
const SizedBox(height: 30), ScaledSizedBox(height: isTall ? 30 : 15),
Text( Text(
'Pendant la phase de test de Ğecko,\nles codes secrets\nsont systématiquement AAAAA.' 'Pendant la phase de test de Ğecko,\nles codes secrets\nsont systématiquement AAAAA.'
.tr(), .tr(),
style: TextStyle(color: Colors.grey[700], fontSize: 15), style: scaledTextStyle(color: Colors.grey[700], fontSize: 14),
textAlign: TextAlign.center), textAlign: TextAlign.center),
Expanded( Expanded(
child: Align( child: Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: SizedBox( child: ScaledSizedBox(
width: 380 * ratio, width: 340,
height: 60 * ratio, height: 55,
child: ElevatedButton( child: ElevatedButton(
key: keyChangePin, key: keyChangePin,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
@ -99,16 +89,16 @@ class OnboardingStepNine extends StatelessWidget {
reload: true); reload: true);
}, },
child: Text("chooseAnotherPassword".tr(), child: Text("chooseAnotherPassword".tr(),
style: TextStyle( style: scaledTextStyle(
fontSize: 22 * ratio, fontSize: 22,
fontWeight: FontWeight.w600))), fontWeight: FontWeight.w600))),
))), ))),
SizedBox(height: 22 * ratio), ScaledSizedBox(height: 20),
NextButton( NextButton(
text: "iNotedMyPassword".tr(), text: "iNotedMyPassword".tr(),
nextScreen: OnboardingStepTen(scanDerivation: scanDerivation), nextScreen: OnboardingStepTen(scanDerivation: scanDerivation),
isFast: false), isFast: false),
SizedBox(height: 35 * ratio), ScaledSizedBox(height: 40),
]), ]),
const OfflineInfo(), const OfflineInfo(),
]), ]),

View File

@ -2,52 +2,85 @@
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart';
// import 'package:gecko/models/home.dart'; import 'package:screen_brightness/screen_brightness.dart';
// import 'package:provider/provider.dart';
class QrCodeFullscreen extends StatelessWidget { class QrCodeFullscreen extends StatefulWidget {
TextEditingController tplController = TextEditingController(); const QrCodeFullscreen(this.address, {this.color, Key? key})
: super(key: key);
QrCodeFullscreen(this.address, {this.color, Key? key}) : super(key: key);
final String address; final String address;
final Color? color; final Color? color;
@override
State<QrCodeFullscreen> createState() => _QrCodeFullscreenState();
}
class _QrCodeFullscreenState extends State<QrCodeFullscreen> {
final tplController = TextEditingController();
Future<void> setBrightness(double brightness) async {
try {
await ScreenBrightness().setScreenBrightness(brightness);
} catch (e) {
log.e(e.toString());
throw 'Failed to set brightness';
}
}
Future<void> resetBrightness() async {
try {
await ScreenBrightness().resetScreenBrightness();
} catch (e) {
log.e(e.toString());
throw 'Failed to reset brightness';
}
}
@override
void initState() {
super.initState();
setBrightness(1);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return PopScope(
appBar: AppBar( onPopInvoked: (_) {
elevation: 0, resetBrightness();
backgroundColor: color ?? Colors.black, },
toolbarHeight: 60 * ratio, child: Scaffold(
leading: IconButton( appBar: AppBar(
icon: const Icon(Icons.arrow_back, color: orangeC), elevation: 0,
onPressed: () { backgroundColor: widget.color ?? Colors.black,
Navigator.pop(context); toolbarHeight: scaleSize(57),
}), leading: IconButton(
title: SizedBox( icon: const Icon(Icons.arrow_back, color: orangeC),
height: 22, onPressed: () {
child: Text( Navigator.pop(context);
'QR Code de ${getShortPubkey(address)}', }),
style: const TextStyle(color: orangeC), title: Text(
), 'QR Code de ${getShortPubkey(widget.address)}',
)), style: scaledTextStyle(color: orangeC, fontSize: 20),
body: SafeArea( )),
child: SizedBox.expand( body: SafeArea(
child: Container( child: SizedBox.expand(
color: color ?? backgroundColor, child: Container(
child: Column( color: widget.color ?? backgroundColor,
children: [ child: Column(
const Spacer(), children: [
QrImageWidget( const Spacer(),
data: address, QrImageWidget(
version: QrVersions.auto, data: widget.address,
size: 350, version: QrVersions.auto,
), size: scaleSize(320),
const Spacer(flex: 2), ),
], const Spacer(flex: 2),
)), ],
)),
),
), ),
), ),
); );

View File

@ -6,12 +6,14 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/search.dart'; import 'package:gecko/providers/search.dart';
import 'package:gecko/widgets/commons/common_elements.dart'; import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/screens/search_result.dart'; import 'package:gecko/screens/search_result.dart';
import 'package:gecko/screens/wallet_view.dart'; import 'package:gecko/screens/wallet_view.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class SearchScreen extends StatefulWidget { class SearchScreen extends StatefulWidget {
@ -28,9 +30,11 @@ class _SearchScreenState extends State<SearchScreen> {
final int debouneTime = 50; final int debouneTime = 50;
Future getClipBoard() async { Future getClipBoard() async {
final searchProvider = Provider.of<SearchProvider>(context, listen: false);
final clipboard = await Clipboard.getData('text/plain'); final clipboard = await Clipboard.getData('text/plain');
pastedAddress = clipboard?.text ?? ''; pastedAddress = clipboard?.text ?? '';
canPasteAddress = isAddress(pastedAddress); canPasteAddress = isAddress(pastedAddress);
searchProvider.reload();
} }
@override @override
@ -44,10 +48,7 @@ class _SearchScreenState extends State<SearchScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final searchProvider = Provider.of<SearchProvider>(context); final searchProvider = Provider.of<SearchProvider>(context);
final screenHeight = MediaQuery.of(context).size.height;
final canValidate = searchProvider.searchController.text.length >= 2; final canValidate = searchProvider.searchController.text.length >= 2;
// final canPasteAddress = false;
return PopScope( return PopScope(
onPopInvoked: (_) { onPopInvoked: (_) {
@ -55,18 +56,11 @@ class _SearchScreenState extends State<SearchScreen> {
}, },
child: Scaffold( child: Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('search'.tr()),
elevation: 1,
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text('search'.tr()),
),
),
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [
Column(children: <Widget>[ Column(children: <Widget>[
SizedBox(height: isTall ? 200 : 100), ScaledSizedBox(height: isTall ? 165 : 60),
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 17), padding: const EdgeInsets.symmetric(horizontal: 17),
child: TextField( child: TextField(
@ -102,7 +96,7 @@ class _SearchScreenState extends State<SearchScreen> {
suffixIcon: searchProvider.searchController.text == '' suffixIcon: searchProvider.searchController.text == ''
? null ? null
: Padding( : Padding(
padding: const EdgeInsets.symmetric(horizontal: 17), padding: const EdgeInsets.symmetric(horizontal: 10),
child: IconButton( child: IconButton(
onPressed: (() async => { onPressed: (() async => {
searchProvider.searchController.text = '', searchProvider.searchController.text = '',
@ -112,15 +106,16 @@ class _SearchScreenState extends State<SearchScreen> {
icon: Icon( icon: Icon(
Icons.close, Icons.close,
color: Colors.grey[600], color: Colors.grey[600],
size: 30, size: scaleSize(28),
), ),
), ),
), ),
prefixIcon: const Padding( prefixIcon: Padding(
padding: EdgeInsets.symmetric(horizontal: 17), padding: const EdgeInsets.symmetric(horizontal: 13),
child: Image( child: Image.asset(
image: AssetImage('assets/loupe-noire.png'), 'assets/loupe-noire.png',
height: 35), height: scaleSize(10),
),
), ),
border: OutlineInputBorder( border: OutlineInputBorder(
borderSide: borderSide:
@ -131,19 +126,19 @@ class _SearchScreenState extends State<SearchScreen> {
BorderSide(color: Colors.grey[500]!, width: 2.5), BorderSide(color: Colors.grey[500]!, width: 2.5),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
contentPadding: const EdgeInsets.all(20), contentPadding: const EdgeInsets.all(13),
), ),
style: const TextStyle( style: scaledTextStyle(
fontSize: 20, fontSize: 17,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
), ),
), ),
), ),
const Spacer(flex: 1), const Spacer(),
SizedBox( ScaledSizedBox(
width: 320, width: 270,
height: 90, height: 70,
child: ElevatedButton( child: ElevatedButton(
key: keyConfirmSearch, key: keyConfirmSearch,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
@ -177,12 +172,14 @@ class _SearchScreenState extends State<SearchScreen> {
? 'pasteAddress'.tr() ? 'pasteAddress'.tr()
: 'search'.tr(), : 'search'.tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: scaledTextStyle(
fontSize: 21, fontWeight: FontWeight.w600), fontSize: 17,
fontWeight: FontWeight.w500,
color: Colors.white),
), ),
), ),
), ),
Spacer(flex: screenHeight <= 800 ? 1 : 2), const Spacer(),
]), ]),
const OfflineInfo(), const OfflineInfo(),
]), ]),

View File

@ -2,11 +2,13 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/duniter_indexer.dart';
import 'package:gecko/providers/wallets_profiles.dart'; import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/providers/search.dart'; import 'package:gecko/providers/search.dart';
import 'package:gecko/widgets/bottom_app_bar.dart'; import 'package:gecko/widgets/bottom_app_bar.dart';
import 'package:gecko/widgets/commons/offline_info.dart'; import 'package:gecko/widgets/commons/offline_info.dart';
import 'package:gecko/widgets/commons/top_appbar.dart';
import 'package:gecko/widgets/search_result_list.dart'; import 'package:gecko/widgets/search_result_list.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -20,25 +22,11 @@ class SearchResultScreen extends StatelessWidget {
Provider.of<WalletsProfilesProvider>(context, listen: false); Provider.of<WalletsProfilesProvider>(context, listen: false);
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false); final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
double avatarSize = 55; double avatarSize = scaleSize(37);
// List<G1WalletsList> myContacts = contactsBox.toMap().values.toList();
// myContacts = myContacts
// .where((map) =>
// (map.username ?? '').contains(searchProvider.searchController.text))
// .toList();
// final searchProvider.resultLenght.toString();
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: GeckoAppBar('researchResults'.tr()),
elevation: 1,
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text('researchResults'.tr()),
),
),
bottomNavigationBar: const GeckoBottomAppBar(), bottomNavigationBar: const GeckoBottomAppBar(),
body: SafeArea( body: SafeArea(
child: Stack(children: [ child: Stack(children: [
@ -47,38 +35,39 @@ class SearchResultScreen extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
const SizedBox(height: 30), ScaledSizedBox(height: 20),
Center( Center(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Text( Text(
"resultsFor".tr(), "resultsFor".tr(),
style: TextStyle(color: Colors.grey[600]), style: scaledTextStyle(
color: Colors.grey[600], fontSize: 16),
), ),
Text( Text(
'"${searchProvider.searchController.text}"', '"${searchProvider.searchController.text}"',
style: const TextStyle( style: scaledTextStyle(
fontStyle: FontStyle.italic, fontSize: 21), fontStyle: FontStyle.italic, fontSize: 18),
) )
], ],
), ),
), ),
// const SizedBox(height: 40), // ScaledSizedBox(height: 40),
// Text( // Text(
// 'Dans mes contacts'.tr(args: [currencyName]), // 'Dans mes contacts'.tr(args: [currencyName]),
// style: const TextStyle(fontSize: 20), // style: scaledTextStyle(fontSize: 20),
// ), // ),
// ContactsList( // ContactsList(
// myContacts: myContacts, // myContacts: myContacts,
// avatarSize: avatarSize, // avatarSize: avatarSize,
// walletsProfilesClass: walletsProfilesClass, // walletsProfilesClass: walletsProfilesClass,
// duniterIndexer: duniterIndexer), // duniterIndexer: duniterIndexer),
const SizedBox(height: 40), ScaledSizedBox(height: 22),
Text( Text(
'inBlockchainResult'.tr(args: [currencyName]), 'inBlockchainResult'.tr(args: [currencyName]),
style: const TextStyle(fontSize: 20), style: scaledTextStyle(fontSize: 16),
), ),
const SizedBox(height: 20), ScaledSizedBox(height: 13),
SearchResult( SearchResult(
searchProvider: searchProvider, searchProvider: searchProvider,
duniterIndexer: duniterIndexer, duniterIndexer: duniterIndexer,

View File

@ -1,5 +1,6 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/duniter_indexer.dart';
@ -8,6 +9,7 @@ import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/providers/settings_provider.dart'; import 'package:gecko/providers/settings_provider.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/widgets/commons/loading.dart';
import 'package:polkawallet_sdk/api/types/networkParams.dart'; import 'package:polkawallet_sdk/api/types/networkParams.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -18,89 +20,85 @@ class SettingsScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
const double buttonHigh = 50;
const double buttonWidth = 240;
const double fontSize = 16;
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: AppBar(
toolbarHeight: 60 * ratio, toolbarHeight: scaleSize(57),
title: SizedBox( title: Text(
height: 22, 'parameters'.tr(),
child: Text('parameters'.tr()), style: scaledTextStyle(fontSize: 21),
)), )),
body: Column(children: <Widget>[ body: Column(children: <Widget>[
const SizedBox(height: 30), ScaledSizedBox(height: 30),
Text( Text(
'networkSettings'.tr(), 'networkSettings'.tr(),
style: TextStyle(color: Colors.grey[500], fontSize: 22), style: scaledTextStyle(color: Colors.grey[500]!, fontSize: 20),
), ),
const SizedBox(height: 20), ScaledSizedBox(height: 20),
duniterEndpointSelection(context), duniterEndpointSelection(context),
const SizedBox(height: 30), ScaledSizedBox(height: 30),
indexerEndpointSelection(context), indexerEndpointSelection(context),
const SizedBox(height: 40), ScaledSizedBox(height: 35),
Text( Text(
'displaySettings'.tr(), 'displaySettings'.tr(),
style: TextStyle(color: Colors.grey[500], fontSize: 22), style: scaledTextStyle(color: Colors.grey[500]!, fontSize: 20),
), ),
const SizedBox(height: 20), ScaledSizedBox(height: 20),
chooseCurrencyUnit(context), chooseCurrencyUnit(context),
// SizedBox(height: isTall ? 80 : 120),
const Spacer(), const Spacer(),
SizedBox( Center(
height: buttonHigh, child: InkWell(
width: buttonWidth, key: keyDeleteAllWallets,
child: Center( onTap: () async {
child: InkWell( log.w('Oublier tous mes coffres');
key: keyDeleteAllWallets, await _myWallets.deleteAllWallet(context);
onTap: () async { },
log.i('Oublier tous mes coffres'); child: ScaledSizedBox(
await _myWallets.deleteAllWallet(context); height: scaleSize(40),
}, width: 220,
child: Text( child: Center(
'forgetAllMyChests'.tr(), child: Text(
style: const TextStyle( 'forgetAllMyChests'.tr(),
fontSize: fontSize + 4, style: scaledTextStyle(
color: Color(0xffD80000), fontSize: 18,
fontWeight: FontWeight.w600, color: const Color(0xffD80000),
fontWeight: FontWeight.w600,
),
), ),
), ),
), ),
), ),
), ),
// const Spacer(), // const Spacer(),
SizedBox(height: isTall ? 90 : 60), ScaledSizedBox(height: 70),
]), ]),
); );
} }
Widget chooseCurrencyUnit(BuildContext context) { Widget chooseCurrencyUnit(BuildContext context) {
HomeProvider homeProvider = final homeProvider = Provider.of<HomeProvider>(context, listen: false);
Provider.of<HomeProvider>(context, listen: false);
return InkWell( return InkWell(
key: keyUdUnit, key: keyUdUnit,
onTap: () async { onTap: () async {
await homeProvider.changeCurrencyUnit(context); await homeProvider.changeCurrencyUnit(context);
}, },
child: SizedBox( child: ScaledSizedBox(
height: 50, height: 50,
child: Row( child: Row(
children: [ children: [
const SizedBox(width: 12), ScaledSizedBox(width: 12),
Text('showUdAmounts'.tr()), Text('showUdAmounts'.tr(), style: scaledTextStyle(fontSize: 16)),
const Spacer(), const Spacer(),
Consumer<HomeProvider>(builder: (context, homeProvider, _) { Consumer<HomeProvider>(builder: (context, homeProvider, _) {
final bool isUdUnit = configBox.get('isUdUnit') ?? false; final bool isUdUnit = configBox.get('isUdUnit') ?? false;
return Icon( return Icon(
isUdUnit ? Icons.check_box : Icons.check_box_outline_blank, isUdUnit ? Icons.check_box : Icons.check_box_outline_blank,
color: orangeC, color: orangeC,
size: 32, size: scaleSize(30),
); );
}), }),
const SizedBox(width: 30), ScaledSizedBox(width: 30),
], ],
), ),
), ),
@ -133,7 +131,7 @@ class SettingsScreen extends StatelessWidget {
selectedDuniterEndpoint = customEndpoint.endpoint; selectedDuniterEndpoint = customEndpoint.endpoint;
} }
TextEditingController endpointController = TextEditingController( final endpointController = TextEditingController(
text: configBox.containsKey('customEndpoint') text: configBox.containsKey('customEndpoint')
? configBox.get('customEndpoint') ? configBox.get('customEndpoint')
: 'wss://'); : 'wss://');
@ -141,30 +139,34 @@ class SettingsScreen extends StatelessWidget {
return Column(children: <Widget>[ return Column(children: <Widget>[
Row(children: [ Row(children: [
Consumer<SubstrateSdk>(builder: (context, sub, _) { Consumer<SubstrateSdk>(builder: (context, sub, _) {
log.d(sub.sdk.api.connectedNode?.endpoint);
return Expanded( return Expanded(
child: Row(children: [ child: Row(children: [
const SizedBox(width: 10), ScaledSizedBox(width: 2),
SizedBox( ScaledSizedBox(
width: 80, width: 55,
child: Text( child: Text(
'currencyNode'.tr(args: ['']), 'currencyNode'.tr(),
style: scaledTextStyle(fontSize: 16),
), ),
), ),
const Spacer(), const Spacer(),
Icon(sub.nodeConnected && !sub.isLoadingEndpoint ScaledSizedBox(
? Icons.check width: 30,
: Icons.close), child: Icon(sub.nodeConnected && !sub.isLoadingEndpoint
? Icons.check
: Icons.close),
),
if (sub.nodeConnected && !sub.isLoadingEndpoint) if (sub.nodeConnected && !sub.isLoadingEndpoint)
const Icon(Icons.add_card_sharp, size: 0.01), const Icon(Icons.add_card_sharp, size: 0.01),
const Spacer(), const Spacer(),
SizedBox( ScaledSizedBox(
width: 280, height: 52,
width: 230,
child: Consumer<SettingsProvider>(builder: (context, set, _) { child: Consumer<SettingsProvider>(builder: (context, set, _) {
return DropdownButtonHideUnderline( return DropdownButtonHideUnderline(
key: keySelectDuniterNodeDropDown, key: keySelectDuniterNodeDropDown,
child: DropdownButton( child: DropdownButton(
// alignment: AlignmentDirectional.topStart, style: scaledTextStyle(fontSize: 16, color: Colors.black),
value: selectedDuniterEndpoint, value: selectedDuniterEndpoint,
icon: const Icon(Icons.keyboard_arrow_down), icon: const Icon(Icons.keyboard_arrow_down),
items: duniterBootstrapNodes items: duniterBootstrapNodes
@ -176,7 +178,6 @@ class SettingsScreen extends StatelessWidget {
); );
}).toList(), }).toList(),
onChanged: (String? newEndpoint) { onChanged: (String? newEndpoint) {
log.d(newEndpoint!);
selectedDuniterEndpoint = newEndpoint; selectedDuniterEndpoint = newEndpoint;
set.reload(); set.reload();
}, },
@ -184,9 +185,9 @@ class SettingsScreen extends StatelessWidget {
); );
}), }),
), ),
const Spacer(flex: 5), const Spacer(flex: 3),
sub.isLoadingEndpoint sub.isLoadingEndpoint
? const CircularProgressIndicator(color: orangeC) ? Loading(size: scaleSize(32), stroke: 2.5)
: Consumer<SettingsProvider>(builder: (context, set, _) { : Consumer<SettingsProvider>(builder: (context, set, _) {
return IconButton( return IconButton(
key: keyConnectToEndpoint, key: keyConnectToEndpoint,
@ -196,7 +197,7 @@ class SettingsScreen extends StatelessWidget {
sub.getConnectedEndpoint() sub.getConnectedEndpoint()
? orangeC ? orangeC
: Colors.grey[500], : Colors.grey[500],
size: 40, size: scaleSize(35),
), ),
onPressed: selectedDuniterEndpoint != onPressed: selectedDuniterEndpoint !=
sub.getConnectedEndpoint() sub.getConnectedEndpoint()
@ -226,13 +227,14 @@ class SettingsScreen extends StatelessWidget {
Consumer<SettingsProvider>(builder: (context, set, _) { Consumer<SettingsProvider>(builder: (context, set, _) {
return Visibility( return Visibility(
visible: selectedDuniterEndpoint == 'Personnalisé', visible: selectedDuniterEndpoint == 'Personnalisé',
child: SizedBox( child: ScaledSizedBox(
width: 200, width: 200,
height: 50, height: 50,
child: TextField( child: TextField(
key: keyCustomDuniterEndpoint, key: keyCustomDuniterEndpoint,
controller: endpointController, controller: endpointController,
autocorrect: false, autocorrect: false,
style: scaledTextStyle(fontSize: 16),
), ),
), ),
); );
@ -244,17 +246,15 @@ class SettingsScreen extends StatelessWidget {
Consumer<SettingsProvider>(builder: (context, set, _) { Consumer<SettingsProvider>(builder: (context, set, _) {
return Visibility( return Visibility(
visible: selectedDuniterEndpoint == 'Auto', visible: selectedDuniterEndpoint == 'Auto',
child: SizedBox( child: ScaledSizedBox(
width: 250, width: 250,
height: sub.getConnectedEndpoint() == null ? 60 : 20, height: sub.getConnectedEndpoint() == null ? 60 : 20,
child: Text( child: Text(
sub.getConnectedEndpoint() ?? sub.getConnectedEndpoint() ?? "anAutoNodeChoosed".tr(),
"anAutoNodeChoosed" style: scaledTextStyle(
.tr(), //"Un noeud sûr et valide sera choisi automatiquement parmis une liste aléatoire.",
style: TextStyle(
fontSize: 15, fontSize: 15,
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
color: Colors.grey[700]), color: Colors.grey[700]!),
), ),
), ),
); );
@ -263,7 +263,7 @@ class SettingsScreen extends StatelessWidget {
'blockN'.tr(args: [ 'blockN'.tr(args: [
sub.blocNumber.toString() sub.blocNumber.toString()
]), //'bloc N°${sub.blocNumber}', ]), //'bloc N°${sub.blocNumber}',
style: TextStyle(fontSize: 14, color: Colors.grey[700]), style: scaledTextStyle(fontSize: 14, color: Colors.grey[700]),
) )
], ],
); );
@ -285,7 +285,7 @@ class SettingsScreen extends StatelessWidget {
selectedIndexerEndpoint = duniterIndexer.listIndexerEndpoints[0]; selectedIndexerEndpoint = duniterIndexer.listIndexerEndpoints[0];
} }
TextEditingController indexerEndpointController = TextEditingController( final indexerEndpointController = TextEditingController(
text: configBox.containsKey('customIndexer') text: configBox.containsKey('customIndexer')
? configBox.get('customIndexer') ? configBox.get('customIndexer')
: 'https://'); : 'https://');
@ -293,25 +293,22 @@ class SettingsScreen extends StatelessWidget {
return Column(children: <Widget>[ return Column(children: <Widget>[
Row(children: [ Row(children: [
Consumer<DuniterIndexer>(builder: (context, indexer, _) { Consumer<DuniterIndexer>(builder: (context, indexer, _) {
log.d(selectedIndexerEndpoint);
log.d(indexer.listIndexerEndpoints);
return Expanded( return Expanded(
child: Row(children: [ child: Row(children: [
const SizedBox(width: 10), ScaledSizedBox(width: 5),
const SizedBox( ScaledSizedBox(
width: 80, width: 55,
// child: Text('indexer'.tr()), // why translation does not work?? child: Text('Indexer', style: scaledTextStyle(fontSize: 16)),
child: Text('Indexer'),
), ),
const Spacer(), const Spacer(),
Icon(indexerEndpoint != '' ? Icons.check : Icons.close), Icon(indexerEndpoint != '' ? Icons.check : Icons.close),
const Spacer(), const Spacer(),
SizedBox( ScaledSizedBox(
width: 280, width: 230,
child: Consumer<SettingsProvider>(builder: (context, set, _) { child: Consumer<SettingsProvider>(builder: (context, set, _) {
return DropdownButtonHideUnderline( return DropdownButtonHideUnderline(
child: DropdownButton( child: DropdownButton(
// alignment: AlignmentDirectional.topStart, style: scaledTextStyle(fontSize: 16, color: Colors.black),
value: selectedIndexerEndpoint, value: selectedIndexerEndpoint,
icon: const Icon(Icons.keyboard_arrow_down), icon: const Icon(Icons.keyboard_arrow_down),
items: items:
@ -322,7 +319,6 @@ class SettingsScreen extends StatelessWidget {
); );
}).toList(), }).toList(),
onChanged: (newEndpoint) { onChanged: (newEndpoint) {
log.d(newEndpoint!);
selectedIndexerEndpoint = newEndpoint.toString(); selectedIndexerEndpoint = newEndpoint.toString();
set.reload(); set.reload();
}, },
@ -332,7 +328,7 @@ class SettingsScreen extends StatelessWidget {
), ),
const Spacer(flex: 5), const Spacer(flex: 5),
indexer.isLoadingIndexer indexer.isLoadingIndexer
? const CircularProgressIndicator(color: orangeC) ? Loading(size: scaleSize(32), stroke: 2.5)
: Consumer<SettingsProvider>(builder: (context, set, _) { : Consumer<SettingsProvider>(builder: (context, set, _) {
return IconButton( return IconButton(
icon: Icon( icon: Icon(
@ -340,7 +336,7 @@ class SettingsScreen extends StatelessWidget {
color: selectedIndexerEndpoint != indexerEndpoint color: selectedIndexerEndpoint != indexerEndpoint
? orangeC ? orangeC
: Colors.grey[500], : Colors.grey[500],
size: 40, size: scaleSize(35),
), ),
onPressed: selectedIndexerEndpoint != indexerEndpoint onPressed: selectedIndexerEndpoint != indexerEndpoint
? () async { ? () async {
@ -356,7 +352,6 @@ class SettingsScreen extends StatelessWidget {
} else { } else {
configBox.delete('customIndexer'); configBox.delete('customIndexer');
} }
log.d('connection to indexer $finalEndpoint');
await indexer await indexer
.checkIndexerEndpoint(finalEndpoint); .checkIndexerEndpoint(finalEndpoint);
} }
@ -370,12 +365,13 @@ class SettingsScreen extends StatelessWidget {
Consumer<SettingsProvider>(builder: (context, set, _) { Consumer<SettingsProvider>(builder: (context, set, _) {
return Visibility( return Visibility(
visible: selectedIndexerEndpoint == 'Personnalisé', visible: selectedIndexerEndpoint == 'Personnalisé',
child: SizedBox( child: ScaledSizedBox(
width: 200, width: 200,
height: 50, height: 50,
child: TextField( child: TextField(
controller: indexerEndpointController, controller: indexerEndpointController,
autocorrect: false, autocorrect: false,
style: scaledTextStyle(fontSize: 16),
), ),
), ),
); );
@ -384,14 +380,12 @@ class SettingsScreen extends StatelessWidget {
return Consumer<SettingsProvider>(builder: (context, set, _) { return Consumer<SettingsProvider>(builder: (context, set, _) {
return Visibility( return Visibility(
visible: selectedIndexerEndpoint == 'Auto', visible: selectedIndexerEndpoint == 'Auto',
child: SizedBox( child: ScaledSizedBox(
width: 250, width: 250,
height: 60, height: 60,
child: Text( child: Text(
sub.getConnectedEndpoint() ?? sub.getConnectedEndpoint() ?? "anAutoNodeChoosed".tr(),
"anAutoNodeChoosed" style: scaledTextStyle(
.tr(), //"Un noeud sûr et valide sera choisi automatiquement parmis une liste aléatoire.",
style: TextStyle(
fontSize: 15, fontSize: 15,
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
color: Colors.grey[700]), color: Colors.grey[700]),

View File

@ -1,5 +1,6 @@
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
class TemplateScreen extends StatelessWidget { class TemplateScreen extends StatelessWidget {
const TemplateScreen({Key? key}) : super(key: key); const TemplateScreen({Key? key}) : super(key: key);
@ -11,11 +12,7 @@ class TemplateScreen extends StatelessWidget {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: AppBar(
toolbarHeight: 60 * ratio, toolbarHeight: scaleSize(57), title: const Text('Template screen')),
title: const SizedBox(
height: 22,
child: Text('Template screen'),
)),
body: const SafeArea( body: const SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 20), SizedBox(height: 20),

View File

@ -1,6 +1,7 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
@ -73,13 +74,12 @@ class TransactionInProgress extends StatelessWidget {
txStatus = TransactionStatus.success; txStatus = TransactionStatus.success;
resultText = 'extrinsicValidated' resultText = 'extrinsicValidated'
.tr(args: [actionMap[transType] ?? 'strangeTransaction'.tr()]); .tr(args: [actionMap[transType] ?? 'strangeTransaction'.tr()]);
log.i('Bloc of last transaction: ${sub.blocNumber} --- $result');
} else if (result.contains('Exception: ')) { } else if (result.contains('Exception: ')) {
txStatus = TransactionStatus.failed; txStatus = TransactionStatus.failed;
resultText = "${"anErrorOccurred".tr()}:\n"; resultText = "${"anErrorOccurred".tr()}:\n";
final String exception = result.split('Exception: ')[1]; final String exception = result.split('Exception: ')[1];
resultText = resultMap[exception] ?? "$resultText\n$exception"; resultText = resultMap[exception] ?? "$resultText\n$exception";
log.d('Error: $exception'); log.e('Error: $exception');
} else { } else {
txStatus = TransactionStatus.loading; txStatus = TransactionStatus.loading;
resultText = resultMap[result] ?? 'unknown status...'; resultText = resultMap[result] ?? 'unknown status...';
@ -94,19 +94,19 @@ class TransactionInProgress extends StatelessWidget {
child: Scaffold( child: Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
appBar: AppBar( appBar: AppBar(
toolbarHeight: 60 * ratio, toolbarHeight: scaleSize(57),
elevation: 0, elevation: 0,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
title: SizedBox( title: Row(
height: 22, mainAxisAlignment: MainAxisAlignment.center,
child: Row( children: <Widget>[
mainAxisAlignment: MainAxisAlignment.center, Text(
children: <Widget>[ 'extrinsicInProgress'.tr(args: [
Text('extrinsicInProgress'.tr(args: [
actionMap[transType] ?? 'strangeTransaction'.tr() actionMap[transType] ?? 'strangeTransaction'.tr()
])) ]),
]), style: scaledTextStyle(fontSize: 20),
)), )
])),
body: SafeArea( body: SafeArea(
child: Align( child: Align(
alignment: FractionalOffset.bottomCenter, alignment: FractionalOffset.bottomCenter,
@ -123,52 +123,58 @@ class TransactionInProgress extends StatelessWidget {
], ],
)), )),
child: Column(children: <Widget>[ child: Column(children: <Widget>[
const SizedBox(height: 10), ScaledSizedBox(height: 10),
if (transType == 'pay') if (transType == 'pay')
Text( Text(
isUdUnit isUdUnit
? 'ud'.tr(args: ['$amount ']) ? 'ud'.tr(args: ['$amount '])
: '$amount $currencyName', : '$amount $currencyName',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: scaledTextStyle(
fontSize: 18, fontWeight: FontWeight.w600), fontSize: 17, fontWeight: FontWeight.w500),
), ),
if (transType == 'pay') const SizedBox(height: 10), if (transType == 'pay') ScaledSizedBox(height: 10),
Text( Text(
'fromMinus'.tr(), 'fromMinus'.tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(fontSize: 18), style: scaledTextStyle(fontSize: 16),
), ),
Text( Text(
from, from,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: scaledTextStyle(
fontSize: 18, fontWeight: FontWeight.w600), fontSize: 17, fontWeight: FontWeight.w500),
), ),
const SizedBox(height: 10), Visibility(
Text( visible: from != to,
'toMinus'.tr(), child: Column(
textAlign: TextAlign.center, children: [
style: const TextStyle(fontSize: 18), ScaledSizedBox(height: 10),
Text(
'toMinus'.tr(),
textAlign: TextAlign.center,
style: scaledTextStyle(fontSize: 16),
),
Text(
toUsername ?? to,
textAlign: TextAlign.center,
style: scaledTextStyle(
fontSize: 17, fontWeight: FontWeight.w500),
),
],
),
), ),
Text( ScaledSizedBox(height: 20),
toUsername ?? to,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 18, fontWeight: FontWeight.w600),
),
const SizedBox(height: 20),
]), ]),
), ),
// const SizedBox(height: 20, width: double.infinity),
const Spacer(), const Spacer(),
Column(children: [ Column(children: [
Visibility( Visibility(
visible: txStatus == TransactionStatus.loading, visible: txStatus == TransactionStatus.loading,
child: const SizedBox( child: ScaledSizedBox(
height: 18, height: 17,
width: 18, width: 17,
child: CircularProgressIndicator( child: const CircularProgressIndicator(
color: orangeC, color: orangeC,
strokeWidth: 2, strokeWidth: 2,
), ),
@ -176,27 +182,27 @@ class TransactionInProgress extends StatelessWidget {
), ),
Visibility( Visibility(
visible: txStatus == TransactionStatus.success, visible: txStatus == TransactionStatus.success,
child: const Icon( child: Icon(
Icons.done_all, Icons.done_all,
size: 35, size: scaleSize(32),
color: Colors.greenAccent, color: Colors.greenAccent,
), ),
), ),
Visibility( Visibility(
visible: txStatus == TransactionStatus.failed, visible: txStatus == TransactionStatus.failed,
child: const Icon( child: Icon(
Icons.close, Icons.close,
size: 35, size: scaleSize(32),
color: Colors.redAccent, color: Colors.redAccent,
), ),
), ),
const SizedBox(height: 10), ScaledSizedBox(height: 10),
Visibility( Visibility(
visible: txStatus != TransactionStatus.none, visible: txStatus != TransactionStatus.none,
child: Text( child: Text(
resultText, resultText,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 19 * ratio), style: scaledTextStyle(fontSize: 17),
), ),
), ),
]), ]),
@ -204,9 +210,9 @@ class TransactionInProgress extends StatelessWidget {
Expanded( Expanded(
child: Align( child: Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: SizedBox( child: ScaledSizedBox(
width: 380 * ratio, width: 300,
height: 60 * ratio, height: 55,
child: ElevatedButton( child: ElevatedButton(
key: keyCloseTransactionScreen, key: keyCloseTransactionScreen,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
@ -219,15 +225,14 @@ class TransactionInProgress extends StatelessWidget {
}, },
child: Text( child: Text(
'close'.tr(), 'close'.tr(),
style: TextStyle( style: scaledTextStyle(
fontSize: 23 * ratio, fontSize: 20, fontWeight: FontWeight.w600),
fontWeight: FontWeight.w600),
), ),
), ),
), ),
), ),
), ),
SizedBox(height: isTall ? 80 : 20) ScaledSizedBox(height: 80)
])), ])),
), ),
), ),

View File

@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/g1_wallets_list.dart'; import 'package:gecko/models/g1_wallets_list.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/duniter_indexer.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
@ -23,8 +24,8 @@ import 'package:gecko/widgets/payment_popup.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart';
const double buttonSize = 100; const double buttonSize = 83;
const double buttonFontSize = 18; const double buttonFontSize = 14;
class WalletViewScreen extends StatelessWidget { class WalletViewScreen extends StatelessWidget {
const WalletViewScreen( const WalletViewScreen(
@ -35,25 +36,24 @@ class WalletViewScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
WalletsProfilesProvider walletProfile = final walletProfile =
Provider.of<WalletsProfilesProvider>(context, listen: false); Provider.of<WalletsProfilesProvider>(context, listen: false);
final sub = Provider.of<SubstrateSdk>(context, listen: false); final sub = Provider.of<SubstrateSdk>(context, listen: false);
final myWalletProvider = final myWalletProvider =
Provider.of<MyWalletsProvider>(context, listen: false); Provider.of<MyWalletsProvider>(context, listen: false);
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false); final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
WalletData? defaultWallet = myWalletProvider.getDefaultWallet(); final defaultWallet = myWalletProvider.getDefaultWallet();
walletProfile.address = address; walletProfile.address = address;
sub.setCurrentWallet(defaultWallet); sub.setCurrentWallet(defaultWallet);
log.d("username: $username");
return Scaffold( return Scaffold(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
appBar: AppBar( appBar: AppBar(
elevation: 0, elevation: 0,
toolbarHeight: 60 * ratio, toolbarHeight: scaleSize(57),
titleSpacing: 10,
actions: [ actions: [
Row( Row(
children: [ children: [
@ -65,7 +65,6 @@ class WalletViewScreen extends StatelessWidget {
g1WalletsBox.toMap().forEach((key, value) { g1WalletsBox.toMap().forEach((key, value) {
if (key == address) newContact = value; if (key == address) newContact = value;
}); });
// G1WalletsList(pubkey: pubkey!, username: username);
await walletProfile.addContact( await walletProfile.addContact(
newContact ?? G1WalletsList(address: address)); newContact ?? G1WalletsList(address: address));
}, },
@ -73,11 +72,11 @@ class WalletViewScreen extends StatelessWidget {
walletProfile.isContact(address) walletProfile.isContact(address)
? Icons.add_reaction_rounded ? Icons.add_reaction_rounded
: Icons.add_reaction_outlined, : Icons.add_reaction_outlined,
size: 35, size: scaleSize(33),
), ),
); );
}), }),
const SizedBox(width: 10), ScaledSizedBox(width: isTall ? 10 : 0),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
@ -92,44 +91,42 @@ class WalletViewScreen extends StatelessWidget {
child: QrImageWidget( child: QrImageWidget(
data: walletProfile.address, data: walletProfile.address,
version: QrVersions.auto, version: QrVersions.auto,
size: 80, size: scaleSize(65),
), ),
), ),
], ],
) )
], ],
title: SizedBox( title: Text(
height: 22, duniterIndexer.walletNameIndexer[walletProfile.address] == null
child: Text(duniterIndexer ? 'seeAWallet'.tr()
.walletNameIndexer[walletProfile.address] == : 'memberAccountOf'.tr(args: [
null duniterIndexer.walletNameIndexer[walletProfile.address] ??
? 'seeAWallet'.tr() '?'
: 'memberAccountOf'.tr(args: [ ]),
duniterIndexer.walletNameIndexer[walletProfile.address] ?? style: scaledTextStyle(fontSize: 18),
'?' ),
]))),
), ),
bottomNavigationBar: const GeckoBottomAppBar(), bottomNavigationBar: const GeckoBottomAppBar(),
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
HeaderProfile(address: address, username: username), HeaderProfile(address: address, username: username),
SizedBox(height: isTall ? 30 : 15), ScaledSizedBox(height: 25),
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
Column(children: <Widget>[ Column(children: <Widget>[
SizedBox( ScaledSizedBox(
height: buttonSize, height: buttonSize,
child: ClipOval( child: ClipOval(
child: Material( child: Material(
color: yellowC, color: yellowC,
child: InkWell( child: InkWell(
key: keyViewActivity, key: keyViewActivity,
splashColor: orangeC, // inkwell color splashColor: orangeC,
child: const Padding( child: Padding(
padding: EdgeInsets.all(13), padding: EdgeInsets.all(scaleSize(10)),
child: Image( child:
image: AssetImage( Image.asset('assets/walletOptions/clock.png'),
'assets/walletOptions/clock.png'), ),
height: 90)),
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
@ -141,11 +138,11 @@ class WalletViewScreen extends StatelessWidget {
), ),
), ),
), ),
const SizedBox(height: 9), ScaledSizedBox(height: 6),
Text( Text(
"displayNActivity".tr(), "displayNActivity".tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: scaledTextStyle(
fontSize: buttonFontSize, fontWeight: FontWeight.w500), fontSize: buttonFontSize, fontWeight: FontWeight.w500),
), ),
]), ]),
@ -154,10 +151,8 @@ class WalletViewScreen extends StatelessWidget {
return FutureBuilder( return FutureBuilder(
future: sub.certState(defaultWallet.address, address), future: sub.certState(defaultWallet.address, address),
builder: (context, AsyncSnapshot<Map<String, int>> snapshot) { builder: (context, AsyncSnapshot<Map<String, int>> snapshot) {
if (snapshot.data == null) return const SizedBox(); if (snapshot.data == null) return ScaledSizedBox();
String duration = ''; String duration = '';
log.d(
'${getShortPubkey(address)} --- certDelay ${snapshot.data!['certDelay']} --- certRenewable ${snapshot.data!['certRenewable']}');
if (snapshot.data!['certDelay'] != null || if (snapshot.data!['certDelay'] != null ||
snapshot.data!['certRenewable'] != null) { snapshot.data!['certRenewable'] != null) {
@ -199,7 +194,7 @@ class WalletViewScreen extends StatelessWidget {
if (snapshot.data!['canCert'] != null || if (snapshot.data!['canCert'] != null ||
duration == 'seconds'.tr(args: ['0'])) duration == 'seconds'.tr(args: ['0']))
Column(children: <Widget>[ Column(children: <Widget>[
SizedBox( ScaledSizedBox(
height: buttonSize, height: buttonSize,
child: ClipOval( child: ClipOval(
child: Material( child: Material(
@ -267,13 +262,13 @@ class WalletViewScreen extends StatelessWidget {
), ),
), ),
), ),
const SizedBox(height: 9), ScaledSizedBox(height: 6),
Text( Text(
toStatus == null toStatus == null
? "certify".tr() ? "certify".tr()
: "createIdentity".tr(), : "createIdentity".tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: scaledTextStyle(
fontSize: buttonFontSize, fontSize: buttonFontSize,
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
), ),
@ -291,7 +286,7 @@ class WalletViewScreen extends StatelessWidget {
); );
}), }),
Column(children: <Widget>[ Column(children: <Widget>[
SizedBox( ScaledSizedBox(
height: buttonSize, height: buttonSize,
child: ClipOval( child: ClipOval(
child: Material( child: Material(
@ -299,11 +294,12 @@ class WalletViewScreen extends StatelessWidget {
child: InkWell( child: InkWell(
key: keyCopyAddress, key: keyCopyAddress,
splashColor: orangeC, splashColor: orangeC,
child: const Padding( child: Padding(
padding: EdgeInsets.all(20), padding: EdgeInsets.all(scaleSize(17)),
child: Image( child: const Image(
image: AssetImage('assets/copy_key.png'), image: AssetImage('assets/copy_key.png'),
height: 90)), ),
),
onTap: () { onTap: () {
Clipboard.setData(ClipboardData(text: address)); Clipboard.setData(ClipboardData(text: address));
snackCopyKey(context); snackCopyKey(context);
@ -311,11 +307,11 @@ class WalletViewScreen extends StatelessWidget {
), ),
), ),
), ),
const SizedBox(height: 9), ScaledSizedBox(height: 6),
Text( Text(
"copyAddress".tr(), "copyAddress".tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: scaledTextStyle(
fontSize: buttonFontSize, fontWeight: FontWeight.w500), fontSize: buttonFontSize, fontWeight: FontWeight.w500),
), ),
]), ]),
@ -325,7 +321,7 @@ class WalletViewScreen extends StatelessWidget {
return Opacity( return Opacity(
opacity: sub.nodeConnected ? 1 : 0.5, opacity: sub.nodeConnected ? 1 : 0.5,
child: Container( child: Container(
height: buttonSize, height: scaleSize(buttonSize),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xff7c94b6), color: const Color(0xff7c94b6),
borderRadius: const BorderRadius.all(Radius.circular(100)), borderRadius: const BorderRadius.all(Radius.circular(100)),
@ -360,9 +356,9 @@ class WalletViewScreen extends StatelessWidget {
} }
} }
: null, : null,
child: const Padding( child: Padding(
padding: EdgeInsets.all(14), padding: EdgeInsets.all(scaleSize(10)),
child: Image( child: const Image(
image: AssetImage('assets/vector_white.png')), image: AssetImage('assets/vector_white.png')),
)), )),
), ),
@ -370,44 +366,41 @@ class WalletViewScreen extends StatelessWidget {
), ),
); );
}), }),
const SizedBox(height: 9), ScaledSizedBox(height: 6),
Consumer<SubstrateSdk>(builder: (context, sub, _) { Consumer<SubstrateSdk>(builder: (context, sub, _) {
return Text( return Text(
'doATransfer'.tr(), 'doATransfer'.tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: scaledTextStyle(
color: sub.nodeConnected ? Colors.black : Colors.grey[500], color: sub.nodeConnected ? Colors.black : Colors.grey[500],
fontSize: buttonFontSize, fontSize: buttonFontSize,
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
); );
}), }),
SizedBox(height: isTall ? 50 : 20) ScaledSizedBox(height: isTall ? 50 : 7)
]), ]),
)); ));
} }
Widget waitToCert(String status, String duration) { Widget waitToCert(String status, String duration) {
return Column(children: <Widget>[ return Column(children: <Widget>[
SizedBox( ScaledSizedBox(
height: buttonSize, height: buttonSize,
child: Padding( child: Container(
padding: const EdgeInsets.only(bottom: 0), foregroundDecoration: const BoxDecoration(
child: Container( color: Colors.grey,
foregroundDecoration: const BoxDecoration( backgroundBlendMode: BlendMode.saturation,
color: Colors.grey, ),
backgroundBlendMode: BlendMode.saturation, child: const Opacity(
), opacity: 0.5,
child: const Opacity( child: Image(image: AssetImage('assets/gecko_certify.png')),
opacity: 0.5,
child: Image(image: AssetImage('assets/gecko_certify.png')),
),
), ),
), ),
), ),
Text( Text(
status.tr(args: [duration]), status.tr(args: [duration]),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: scaledTextStyle(
fontSize: buttonFontSize - 4, fontSize: buttonFontSize - 4,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Colors.grey[600]), color: Colors.grey[600]),

View File

@ -1,5 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
import 'package:gecko/providers/wallet_options.dart'; import 'package:gecko/providers/wallet_options.dart';
import 'package:gecko/widgets/ud_unit_display.dart'; import 'package:gecko/widgets/ud_unit_display.dart';
@ -22,54 +22,50 @@ class Balance extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final walletOptions = final walletOptions =
Provider.of<WalletOptionsProvider>(context, listen: false); Provider.of<WalletOptionsProvider>(context, listen: false);
return Column(children: <Widget>[ return Consumer<SubstrateSdk>(builder: (context, sdk, _) {
Consumer<SubstrateSdk>(builder: (context, sdk, _) { return FutureBuilder(
return FutureBuilder( future: sdk.getBalance(address),
future: sdk.getBalance(address), builder: (BuildContext context,
builder: (BuildContext context, AsyncSnapshot<Map<String, double>> globalBalance) {
AsyncSnapshot<Map<String, double>> globalBalance) { if (globalBalance.connectionState != ConnectionState.done ||
if (globalBalance.connectionState != ConnectionState.done || globalBalance.hasError) {
globalBalance.hasError) { if (walletOptions.balanceCache[address] != null &&
if (walletOptions.balanceCache[address] != null && walletOptions.balanceCache[address] != -1) {
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: [ return Row(children: [
Text( Text(walletOptions.balanceCache[address]!.toString(),
walletOptions.balanceCache[address]!.toString(), style: scaledTextStyle(fontSize: size, color: color)),
style: TextStyle( ScaledSizedBox(width: 5),
fontSize: isTall ? size : size * 0.9, UdUnitDisplay(size: scaleSize(size), color: color),
color: color,
),
),
const SizedBox(width: 5),
UdUnitDisplay(size: size, color: color),
]); ]);
} else { } else {
return const Text(''); return ScaledSizedBox(
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: scaledTextStyle(
fontSize: size,
color: color,
),
),
ScaledSizedBox(width: 5),
UdUnitDisplay(size: scaleSize(size), color: color),
]);
} else {
return const Text('');
}
});
});
} }
} }

View File

@ -3,6 +3,7 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
@ -32,13 +33,13 @@ class GeckoBottomAppBar extends StatelessWidget {
child: Container( child: Container(
color: yellowC, color: yellowC,
width: size.width, width: size.width,
height: 80, height: scaleSize(67),
child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [ child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
const Spacer(), const Spacer(),
const SizedBox(width: 11), ScaledSizedBox(width: 11),
IconButton( IconButton(
key: keyAppBarHome, key: keyAppBarHome,
iconSize: 55, iconSize: scaleSize(53),
icon: const Icon(Icons.home_outlined), icon: const Icon(Icons.home_outlined),
onPressed: () { onPressed: () {
searchProvider.reload(); searchProvider.reload();
@ -48,7 +49,7 @@ class GeckoBottomAppBar extends StatelessWidget {
); );
}, },
), ),
const SizedBox(width: 12), ScaledSizedBox(width: 12),
const Spacer(), const Spacer(),
IconButton( IconButton(
key: keyAppBarQrcode, key: keyAppBarQrcode,
@ -58,7 +59,7 @@ class GeckoBottomAppBar extends StatelessWidget {
}, },
), ),
const Spacer(), const Spacer(),
const SizedBox(width: 15), ScaledSizedBox(width: 15),
Stack( Stack(
alignment: AlignmentDirectional.center, alignment: AlignmentDirectional.center,
children: [ children: [
@ -67,8 +68,8 @@ class GeckoBottomAppBar extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 0), padding: const EdgeInsets.only(left: 0),
child: Container( child: Container(
width: 75, width: scaleSize(75),
height: 75, height: scaleSize(75),
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
border: border:
@ -84,36 +85,38 @@ class GeckoBottomAppBar extends StatelessWidget {
), ),
), ),
), ),
IconButton( ScaledSizedBox(
key: keyAppBarChest, height: 53,
icon: const Image(image: AssetImage('assets/wallet.png')), child: IconButton(
onPressed: lockAction key: keyAppBarChest,
? null icon: const Image(image: AssetImage('assets/wallet.png')),
: () async { onPressed: lockAction
WalletData? defaultWallet = ? null
myWalletProvider.getDefaultWallet(); : () async {
String? pin; WalletData? defaultWallet =
if (myWalletProvider.pinCode == '') { myWalletProvider.getDefaultWallet();
pin = await Navigator.push( String? pin;
context, if (myWalletProvider.pinCode == '') {
MaterialPageRoute( pin = await Navigator.push(
builder: (homeContext) { context,
return UnlockingWallet(wallet: defaultWallet); MaterialPageRoute(
}, builder: (homeContext) {
), return UnlockingWallet(wallet: defaultWallet);
); },
} ),
if (pin != null || myWalletProvider.pinCode != '') { );
// log.d( }
// isRoutePresentInNavigator(context, '/mywallets')); if (pin != null || myWalletProvider.pinCode != '') {
Navigator.popUntil(context, ModalRoute.withName('/')); Navigator.popUntil(
//FIXME: Should not have to wait 300 milliseconds when /mywallets exist in navigator... context, ModalRoute.withName('/'));
sleep(const Duration(milliseconds: 300)); //FIXME: Should not have to wait 300 milliseconds when /mywallets exist in navigator...
Navigator.pushNamed(context, '/mywallets'); sleep(const Duration(milliseconds: 300));
// Navigator.pushNamedAndRemoveUntil( Navigator.pushNamed(context, '/mywallets');
// context, '/mywallets', ModalRoute.withName('/')); // Navigator.pushNamedAndRemoveUntil(
} // context, '/mywallets', ModalRoute.withName('/'));
}, }
},
),
), ),
], ],
), ),
@ -127,7 +130,6 @@ class GeckoBottomAppBar extends StatelessWidget {
bool isRoutePresentInNavigator(BuildContext context, String routeName) { bool isRoutePresentInNavigator(BuildContext context, String routeName) {
bool isPresent = false; bool isPresent = false;
Navigator.popUntil(context, (route) { Navigator.popUntil(context, (route) {
log.d(route.settings.name);
if (route.settings.name == routeName) { if (route.settings.name == routeName) {
isPresent = true; isPresent = true;
} }

View File

@ -1,33 +1,73 @@
import 'package:bubble/bubble.dart'; import 'package:bubble/bubble.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
class BubbleSpeak extends StatelessWidget { class BubbleSpeak extends StatelessWidget {
const BubbleSpeak({ const BubbleSpeak({
required this.text, required this.text,
this.long, this.long,
this.fontSize = 18,
this.textKey, this.textKey,
Key? key, Key? key,
}) : super(key: key); }) : super(key: key);
final String text; final String text;
final double? long; final double? long;
final double fontSize;
final Key? textKey; final Key? textKey;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Bubble( return Bubble(
padding: long == null padding: long == null
? const BubbleEdges.all(20) ? const BubbleEdges.all(18)
: BubbleEdges.symmetric(horizontal: long, vertical: 30), : BubbleEdges.symmetric(horizontal: long, vertical: 30),
elevation: 5, elevation: 5,
color: backgroundColor, color: backgroundColor,
child: Text( child: Text(
text, text,
key: textKey, key: textKey,
style: const TextStyle( style: scaledTextStyle(
color: Colors.black, fontSize: 21, fontWeight: FontWeight.w400), color: Colors.black,
fontSize: fontSize,
fontWeight: FontWeight.w400),
), ),
); );
} }
} }
class BubbleSpeakWithTail extends StatelessWidget {
const BubbleSpeakWithTail({
required this.text,
this.long,
this.fontSize = 18,
this.textKey,
Key? key,
}) : super(key: key);
final String text;
final double? long;
final double fontSize;
final Key? textKey;
@override
Widget build(BuildContext context) {
return Stack(
alignment: Alignment.bottomRight,
clipBehavior: Clip.none,
children: [
BubbleSpeak(
text: text, fontSize: fontSize, textKey: textKey, long: long),
Positioned(
left: 15,
bottom: -scaleSize(28),
child: Image(
image: const AssetImage('assets/home/bout_de_bulle.png'),
height: scaleSize(30),
),
),
],
);
}
}

View File

@ -3,6 +3,7 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
@ -21,7 +22,7 @@ class AddNewDerivationButton extends StatelessWidget {
String newDerivationName = String newDerivationName =
'${'wallet'.tr()} ${myWalletProvider.listWallets.last.number! + 2}'; '${'wallet'.tr()} ${myWalletProvider.listWallets.last.number! + 2}';
return Padding( return Padding(
padding: const EdgeInsets.all(16), padding: EdgeInsets.all(scaleSize(11)),
child: ClipRRect( child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(12)), borderRadius: const BorderRadius.all(Radius.circular(12)),
child: Column(children: <Widget>[ child: Column(children: <Widget>[
@ -55,20 +56,20 @@ class AddNewDerivationButton extends StatelessWidget {
decoration: const BoxDecoration(color: floattingYellow), decoration: const BoxDecoration(color: floattingYellow),
child: Center( child: Center(
child: myWalletProvider.isNewDerivationLoading child: myWalletProvider.isNewDerivationLoading
? const SizedBox( ? ScaledSizedBox(
height: 60, height: 50,
width: 60, width: 50,
child: CircularProgressIndicator( child: const CircularProgressIndicator(
color: orangeC, color: orangeC,
strokeWidth: 7, strokeWidth: 6,
), ),
) )
: const Text( : Text(
'+', '+',
style: TextStyle( style: scaledTextStyle(
fontSize: 150, fontSize: 110,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0xFFFCB437)), color: const Color(0xFFFCB437)),
)), )),
)), )),
), ),

View File

@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/screens/myWallets/chest_options.dart'; import 'package:gecko/screens/myWallets/chest_options.dart';
@ -17,18 +18,19 @@ class ChestOptionsButtons extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final myWalletProvider = Provider.of<MyWalletsProvider>(context); final myWalletProvider = Provider.of<MyWalletsProvider>(context);
return Column(children: [ return Column(children: [
const SizedBox(height: 50), ScaledSizedBox(height: 50),
SizedBox( ScaledSizedBox(
height: 80, height: 60,
width: 420, width: 300,
child: ElevatedButton.icon( child: ElevatedButton.icon(
icon: Image.asset( icon: Image.asset(
'assets/chests/config.png', 'assets/chests/config.png',
height: 60, height: scaleSize(40),
), ),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
foregroundColor: Colors.black, elevation: 2, foregroundColor: Colors.black,
backgroundColor: floattingYellow, // foreground elevation: 2,
backgroundColor: floattingYellow,
), ),
onPressed: () => Navigator.push( onPressed: () => Navigator.push(
context, context,
@ -38,69 +40,68 @@ class ChestOptionsButtons extends StatelessWidget {
), ),
label: Text( label: Text(
" ${"manageChest".tr()}", " ${"manageChest".tr()}",
style: const TextStyle( style: scaledTextStyle(
fontSize: 22, fontSize: 17,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0xff8a3c0f), color: const Color(0xff8a3c0f),
), ),
), ),
)), )),
const SizedBox(height: 30), ScaledSizedBox(height: 20),
Row( InkWell(
mainAxisAlignment: MainAxisAlignment.center, key: keyImportG1v1,
children: [ onTap: () {
SvgPicture.asset( Navigator.push(
'assets/cesium_bw2.svg', context,
semanticsLabel: 'CS', MaterialPageRoute(builder: (context) {
height: 50, return const ImportG1v1();
), }),
const SizedBox(width: 5), );
InkWell( },
key: keyImportG1v1, child: Row(
onTap: () { mainAxisAlignment: MainAxisAlignment.center,
Navigator.push( children: [
context, SvgPicture.asset(
MaterialPageRoute(builder: (context) { 'assets/cesium_bw2.svg',
return const ImportG1v1(); semanticsLabel: 'CS',
}), height: scaleSize(40),
); ),
}, ScaledSizedBox(
child: SizedBox( width: 275,
width: 350,
height: 60, height: 60,
child: Center( child: Center(
child: Text('importG1v1'.tr(), child: Text('importG1v1'.tr(),
style: TextStyle( style: scaledTextStyle(
fontSize: 22, fontSize: 17,
color: Colors.blue[900], color: Colors.blue[900],
fontWeight: FontWeight.w500))), fontWeight: FontWeight.w500))),
), ),
), ],
],
),
const SizedBox(height: 20),
InkWell(
key: keyChangeChest,
onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(builder: (context) {
// return const ChooseChest();
// }),
// );
},
child: SizedBox(
width: 400,
height: 60,
child: Center(
child: Text('changeChest'.tr(),
style: const TextStyle(
fontSize: 22,
color: Colors.grey, //orangeC
fontWeight: FontWeight.w500))),
), ),
), ),
const SizedBox(height: 30) ScaledSizedBox(height: 20),
// InkWell(
// key: keyChangeChest,
// onTap: () {
// // Navigator.push(
// // context,
// // MaterialPageRoute(builder: (context) {
// // return const ChooseChest();
// // }),
// // );
// },
// child: ScaledSizedBox(
// width: 270,
// height: 60,
// child: Center(
// child: Text('changeChest'.tr(),
// style: const scaledTextStyle(
// fontSize: 20,
// color: Colors.grey, //orangeC
// fontWeight: FontWeight.w500))),
// ),
// ),
ScaledSizedBox(height: 30)
]); ]);
} }
} }

View File

@ -3,6 +3,7 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/home.dart'; import 'package:gecko/providers/home.dart';
@ -38,14 +39,14 @@ class HomeButtons extends StatelessWidget {
), ),
child: ClipOval( child: ClipOval(
child: Material( child: Material(
color: orangeC, // button color color: orangeC,
child: InkWell( child: InkWell(
key: keyOpenSearch, key: keyOpenSearch,
child: Padding( child: Padding(
padding: const EdgeInsets.all(18), padding: EdgeInsets.all(scaleSize(15)),
child: Image( child: Image(
image: const AssetImage('assets/home/loupe.png'), image: const AssetImage('assets/home/loupe.png'),
height: 62 * ratio), height: scaleSize(58)),
), ),
onTap: () { onTap: () {
Navigator.push( Navigator.push(
@ -58,17 +59,17 @@ class HomeButtons extends StatelessWidget {
), ),
), ),
), ),
const SizedBox(height: 12), ScaledSizedBox(height: 10),
Text( Text(
"searchWallet".tr(), "searchWallet".tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: scaledTextStyle(
color: Colors.white, color: Colors.white,
fontSize: 15 * ratio, fontSize: 13.5,
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
) )
]), ]),
const SizedBox(width: 120), ScaledSizedBox(width: 95),
Column(children: <Widget>[ Column(children: <Widget>[
Container( Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
@ -108,26 +109,26 @@ class HomeButtons extends StatelessWidget {
} }
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.all(18), padding: EdgeInsets.all(scaleSize(14.5)),
child: Image( child: Image(
image: const AssetImage('assets/home/wallet.png'), image: const AssetImage('assets/home/wallet.png'),
height: 68 * ratio))), height: scaleSize(61)))),
), ),
), ),
), ),
const SizedBox(height: 12), ScaledSizedBox(height: 10),
Text( Text(
"manageWallets".tr(), "manageWallets".tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: scaledTextStyle(
color: Colors.white, color: Colors.white,
fontSize: 15 * ratio, fontSize: 13.5,
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
) )
]) ])
]), ]),
Padding( Padding(
padding: EdgeInsets.only(top: 35 * ratio), padding: EdgeInsets.only(top: scaleSize(30)),
child: child:
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
Column(children: <Widget>[ Column(children: <Widget>[
@ -145,29 +146,29 @@ class HomeButtons extends StatelessWidget {
color: orangeC, // button color color: orangeC, // button color
child: InkWell( child: InkWell(
child: Padding( child: Padding(
padding: const EdgeInsets.all(18), padding: EdgeInsets.all(scaleSize(14)),
child: Image( child: Image(
image: const AssetImage('assets/home/qrcode.png'), image: const AssetImage('assets/home/qrcode.png'),
height: 68 * ratio)), height: scaleSize(62))),
onTap: () async { onTap: () async {
await historyProvider.scan(context); await historyProvider.scan(context);
}), }),
), ),
), ),
), ),
const SizedBox(height: 12), ScaledSizedBox(height: 10),
Text( Text(
"scanQRCode".tr(), "scanQRCode".tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: scaledTextStyle(
color: Colors.white, color: Colors.white,
fontSize: 15 * ratio, fontSize: 13.5,
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
) )
]) ])
]), ]),
), ),
SizedBox(height: isTall ? 80 : 40) ScaledSizedBox(height: isTall ? 60 : 30)
]); ]);
} }
} }

View File

@ -1,5 +1,6 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/wallet_options.dart'; import 'package:gecko/providers/wallet_options.dart';
import 'package:gecko/screens/myWallets/manage_membership.dart'; import 'package:gecko/screens/myWallets/manage_membership.dart';
@ -26,16 +27,16 @@ class ManageMembershipButton extends StatelessWidget {
}), }),
); );
}, },
child: SizedBox( child: ScaledSizedBox(
height: 40, height: 40,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
const SizedBox(width: 32), ScaledSizedBox(width: 28),
Image.asset( Image.asset(
'assets/medal.png', 'assets/medal.png',
height: 45, height: scaleSize(42),
), ),
const SizedBox(width: 22), ScaledSizedBox(width: 20),
Text('manageMembership'.tr(), style: const TextStyle(fontSize: 20)), Text('manageMembership'.tr(), style: scaledTextStyle(fontSize: 18)),
]), ]),
), ),
); );

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/cesium_plus.dart'; import 'package:gecko/providers/cesium_plus.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
@ -16,7 +17,7 @@ class CertTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
int keyID = 0; int keyID = 0;
const double avatarSize = 200; const double avatarSize = 40;
return Column( return Column(
children: listCerts.map((repository) { children: listCerts.map((repository) {
@ -25,45 +26,49 @@ class CertTile extends StatelessWidget {
padding: const EdgeInsets.only(right: 0), padding: const EdgeInsets.only(right: 0),
child: ListTile( child: ListTile(
key: keyTransaction(keyID++), key: keyTransaction(keyID++),
contentPadding: const EdgeInsets.only( contentPadding: EdgeInsets.only(
left: 20, right: 30, top: 15, bottom: 15), left: 10, right: 0, top: scaleSize(3), bottom: scaleSize(3)),
leading: ClipOval( leading: ClipOval(
child: defaultAvatar(avatarSize), child: defaultAvatar(avatarSize),
), ),
title: Padding( title: Padding(
padding: const EdgeInsets.only(bottom: 5), padding: const EdgeInsets.only(bottom: 2),
child: Text(repository['name'], child: Text(
style: const TextStyle(fontSize: 22)), repository['name'],
style: scaledTextStyle(fontSize: 16),
),
), ),
subtitle: RichText( subtitle: RichText(
text: TextSpan( text: TextSpan(
style: TextStyle( style: scaledTextStyle(
fontSize: 18, fontSize: 15,
color: Colors.grey[700], color: Colors.grey[700],
), ),
children: <TextSpan>[ children: <TextSpan>[
TextSpan( TextSpan(
text: repository['date'], text: repository['date'],
style: scaledTextStyle(fontSize: 15),
), ),
if (repository[2] != '') if (repository[2] != '')
TextSpan( TextSpan(
text: ' · ', text: ' · ',
style: TextStyle( style: scaledTextStyle(
fontSize: 20, fontSize: 19,
color: Colors.grey[550], color: Colors.grey[550],
), ),
), ),
TextSpan( TextSpan(
text: getShortPubkey(repository['address']), text: getShortPubkey(repository['address']),
style: TextStyle( style: scaledTextStyle(
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
fontFamily: 'Monospace',
color: Colors.grey[600], color: Colors.grey[600],
fontSize: 18), fontSize: 15),
), ),
], ],
), ),
), ),
dense: false, dense: !isTall,
isThreeLine: false, isThreeLine: false,
onTap: () { onTap: () {
Navigator.push( Navigator.push(

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -24,18 +25,20 @@ class Certifications extends StatelessWidget {
? Row( ? Row(
children: [ children: [
Image.asset('assets/medal.png', Image.asset('assets/medal.png',
color: color, height: 20), color: color, height: scaleSize(18)),
const SizedBox(width: 1), ScaledSizedBox(width: 1),
Text(certs.data?[0].toString() ?? '0', Text(certs.data?[0].toString() ?? '0',
style: TextStyle(fontSize: size, color: color)), style:
const SizedBox(width: 5), scaledTextStyle(fontSize: size, color: color)),
ScaledSizedBox(width: 5),
Text( Text(
"(${certs.data?[1].toString() ?? '0'})", "(${certs.data?[1].toString() ?? '0'})",
style: TextStyle(fontSize: size * 0.7, color: color), style: scaledTextStyle(
fontSize: size * 0.7, color: color),
) )
], ],
) )
: const Text(''); : const SizedBox();
}); });
}), }),
]); ]);

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -11,7 +12,10 @@ class CertsCounter extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Consumer<SubstrateSdk>(builder: (context, sub, _) { return Consumer<SubstrateSdk>(builder: (context, sub, _) {
return Text('(${sub.certsCounterCache[address]![isSent ? 1 : 0]})'); return Text(
'(${sub.certsCounterCache[address]![isSent ? 1 : 0]})',
style: scaledTextStyle(fontSize: 17),
);
}); });
} }
} }

123
lib/widgets/certs_list.dart Normal file
View File

@ -0,0 +1,123 @@
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/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/widgets/cert_tile.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
class CertsList extends StatelessWidget {
const CertsList(
{Key? key,
required this.address,
this.direction = CertDirection.received})
: super(key: key);
final String address;
final CertDirection direction;
@override
Widget build(BuildContext context) {
final screenHeight = MediaQuery.of(context).size.height;
final appBarHeight = AppBar().preferredSize.height;
final windowHeight = screenHeight - appBarHeight - (isTall ? 170 : 140);
final httpLink = HttpLink(
'$indexerEndpoint/v1/graphql',
);
late String gertCertsReq;
late String certFrom;
if (direction == CertDirection.received) {
gertCertsReq = getCertsReceived;
certFrom = 'issuer';
} else {
gertCertsReq = getCertsSent;
certFrom = 'receiver';
}
final client = ValueNotifier(
GraphQLClient(
cache: GraphQLCache(store: HiveStore()),
link: httpLink,
),
);
return GraphQLProvider(
client: client,
child: Query(
options: QueryOptions(
document: gql(gertCertsReq),
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>[
ScaledSizedBox(height: 50),
Text(
"noNetworkNoHistory".tr(),
textAlign: TextAlign.center,
style: scaledTextStyle(fontSize: 18),
)
]);
} else if (result.data?['certification']?.isEmpty) {
return Column(children: <Widget>[
ScaledSizedBox(height: 50),
Text(
"noDataToDisplay".tr(),
style: scaledTextStyle(fontSize: 18),
)
]);
}
final List certsData = result.data!['certification'];
List listCerts = [];
for (final cert in certsData) {
final String issuerAddress = cert[certFrom]['pubkey'];
final String issuerName = cert[certFrom]['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
});
}
// Build history list
return SizedBox(
height: windowHeight,
child: ListView(
key: keyListTransactions,
children: <Widget>[
result.data == null
? Column(children: <Widget>[
ScaledSizedBox(height: 50),
Text(
"noTransactionToDisplay".tr(),
style: scaledTextStyle(fontSize: 18),
)
])
: Column(children: <Widget>[
CertTile(listCerts: listCerts),
])
],
),
);
},
),
);
}
}
enum CertDirection { received, sent }

View File

@ -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),
]);
}
}

View File

@ -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),
]);
}
}

View File

@ -13,7 +13,6 @@ class CesiumAvatar extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final csProvider = Provider.of<CesiumPlusProvider>(context, listen: false); final csProvider = Provider.of<CesiumPlusProvider>(context, listen: false);
log.d('tatata');
return ClipOval( return ClipOval(
child: FutureBuilder( child: FutureBuilder(

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
class BuildImage extends StatelessWidget { class BuildImage extends StatelessWidget {
const BuildImage({ const BuildImage({
@ -15,10 +16,11 @@ class BuildImage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final ratio = isTall ? 1 : 0.95;
return Container( return Container(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
width: 440, width: scaleSize(imageWidth * ratio),
height: isTall ? boxHeight : boxHeight * 0.9, height: scaleSize(boxHeight * ratio),
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: const LinearGradient( gradient: const LinearGradient(
begin: Alignment.topLeft, begin: Alignment.topLeft,
@ -29,6 +31,6 @@ class BuildImage extends StatelessWidget {
], ],
), ),
border: Border.all(color: Colors.grey[900]!)), border: Border.all(color: Colors.grey[900]!)),
child: Image.asset('assets/onBoarding/$assetName', width: imageWidth)); child: Image.asset('assets/onBoarding/$assetName'));
} }
} }

View File

@ -1,6 +1,7 @@
import 'package:dots_indicator/dots_indicator.dart'; import 'package:dots_indicator/dots_indicator.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
class BuildProgressBar extends StatelessWidget { class BuildProgressBar extends StatelessWidget {
const BuildProgressBar({ const BuildProgressBar({
@ -16,8 +17,10 @@ class BuildProgressBar extends StatelessWidget {
dotsCount: 10, dotsCount: 10,
position: pagePosition, position: pagePosition,
decorator: DotsDecorator( decorator: DotsDecorator(
spacing: const EdgeInsets.symmetric(horizontal: 10), size: Size.square(scaleSize(7)),
color: Colors.grey[300]!, // Inactive color activeSize: Size.square(scaleSize(10)),
spacing: EdgeInsets.symmetric(horizontal: scaleSize(10)),
color: Colors.grey[400]!,
activeColor: orangeC, activeColor: orangeC,
), ),
); );

View File

@ -1,12 +1,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
class BuildText extends StatelessWidget { class BuildText extends StatelessWidget {
const BuildText({ const BuildText({
Key? key, Key? key,
required this.text, required this.text,
this.size = 20, this.size = 17,
this.isMd = true, this.isMd = true,
}) : super(key: key); }) : super(key: key);
@ -16,25 +17,24 @@ class BuildText extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final double ratio = isTall ? 1 : 0.95;
final mdStyle = MarkdownStyleSheet( final mdStyle = MarkdownStyleSheet(
p: TextStyle( p: scaledTextStyle(
fontSize: isTall ? size : size * 0.9, fontSize: size * ratio, color: Colors.black, letterSpacing: 0.3),
color: Colors.black,
letterSpacing: 0.3),
textAlign: WrapAlignment.spaceBetween, textAlign: WrapAlignment.spaceBetween,
); );
return Container( return Container(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
width: 440, width: scaleSize(350 * ratio),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, border: Border.all(color: Colors.grey[900]!)), color: Colors.white, border: Border.all(color: Colors.grey[900]!)),
child: isMd child: isMd
? MarkdownBody(data: text, styleSheet: mdStyle) ? MarkdownBody(data: text, styleSheet: mdStyle)
: Text(text, : Text(text,
textAlign: TextAlign.justify, textAlign: TextAlign.justify,
style: TextStyle( style: scaledTextStyle(
fontSize: isTall ? size : size * 0.9, fontSize: size * ratio,
color: Colors.black, color: Colors.black,
letterSpacing: 0.3)), letterSpacing: 0.3)),
); );

View File

@ -1,19 +1,20 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
Future<bool?> confirmPopup(BuildContext context, String title) async { Future<bool?> confirmPopup(BuildContext context, String title) async {
return showDialog<bool>( return showDialog<bool>(
context: context, context: context,
barrierDismissible: true, // user must tap button! barrierDismissible: true,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
content: Text( content: Text(
title, title,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w500), style: scaledTextStyle(fontSize: 19, fontWeight: FontWeight.w500),
), ),
actions: <Widget>[ actions: <Widget>[
Row( Row(
@ -23,26 +24,27 @@ Future<bool?> confirmPopup(BuildContext context, String title) async {
key: keyConfirm, key: keyConfirm,
child: Text( child: Text(
"yes".tr(), "yes".tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 21, fontSize: 19,
color: Color(0xffD80000), color: const Color(0xffD80000),
), ),
), ),
onPressed: () { onPressed: () {
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
), ),
const SizedBox(width: 20), ScaledSizedBox(width: 20),
TextButton( TextButton(
child: Text( child: Text(
"no".tr(), "no".tr(),
style: const TextStyle(fontSize: 21), style:
scaledTextStyle(fontSize: 19, color: Colors.blueAccent),
), ),
onPressed: () { onPressed: () {
Navigator.pop(context, false); Navigator.pop(context, false);
}, },
), ),
const SizedBox(height: 120) ScaledSizedBox(height: 70)
], ],
) )
], ],
@ -58,45 +60,45 @@ Future<bool?> confirmPopupCertification(BuildContext context, String question1,
barrierDismissible: true, barrierDismissible: true,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
// actionsPadding: const EdgeInsets.all(0.0),
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
content: SizedBox( content: ScaledSizedBox(
height: 240, height: 230,
child: Column( child: Column(
children: [ children: [
const SizedBox(height: 15), ScaledSizedBox(height: 15),
Text( Text(
question1, question1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: style:
const TextStyle(fontSize: 20, fontWeight: FontWeight.w400), scaledTextStyle(fontSize: 19, fontWeight: FontWeight.w400),
), ),
const SizedBox(height: 20), ScaledSizedBox(height: 20),
Text( Text(
username, username,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: style:
const TextStyle(fontSize: 24, fontWeight: FontWeight.w500), scaledTextStyle(fontSize: 22, fontWeight: FontWeight.w500),
), ),
const SizedBox(height: 20), ScaledSizedBox(height: 20),
Text( Text(
question2, question2,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: style:
const TextStyle(fontSize: 20, fontWeight: FontWeight.w400), scaledTextStyle(fontSize: 19, fontWeight: FontWeight.w400),
), ),
const SizedBox(height: 20), ScaledSizedBox(height: 20),
Text( Text(
address, address,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: style:
const TextStyle(fontSize: 20, fontWeight: FontWeight.w500), scaledTextStyle(fontSize: 19, fontWeight: FontWeight.w500),
), ),
const SizedBox(height: 20), ScaledSizedBox(height: 20),
const Text( Text(
'?', '?',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w400), style:
scaledTextStyle(fontSize: 19, fontWeight: FontWeight.w400),
), ),
], ],
), ),
@ -109,26 +111,26 @@ Future<bool?> confirmPopupCertification(BuildContext context, String question1,
key: keyConfirm, key: keyConfirm,
child: Text( child: Text(
"yes".tr(), "yes".tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 25, fontSize: 20,
color: Color(0xffD80000), color: const Color(0xffD80000),
), ),
), ),
onPressed: () { onPressed: () {
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
), ),
const SizedBox(width: 35), ScaledSizedBox(width: 32),
TextButton( TextButton(
child: Text( child: Text(
"no".tr(), "no".tr(),
style: const TextStyle(fontSize: 25), style: scaledTextStyle(fontSize: 20),
), ),
onPressed: () { onPressed: () {
Navigator.pop(context, false); Navigator.pop(context, false);
}, },
), ),
const SizedBox(height: 120) ScaledSizedBox(height: 120)
], ],
) )
], ],
@ -147,7 +149,7 @@ Future<void> infoPopup(BuildContext context, String title) async {
content: Text( content: Text(
title, title,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w500), style: scaledTextStyle(fontSize: 20, fontWeight: FontWeight.w500),
), ),
actions: <Widget>[ actions: <Widget>[
Row( Row(
@ -159,9 +161,9 @@ Future<void> infoPopup(BuildContext context, String title) async {
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
child: Text( child: Text(
"gotit".tr(), "gotit".tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 21, fontSize: 21,
color: Color(0xffD80000), color: const Color(0xffD80000),
), ),
), ),
), ),
@ -176,42 +178,3 @@ Future<void> infoPopup(BuildContext context, String title) async {
}, },
); );
} }
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);
// }),
// ),
// );
// }

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/widgets/commons/build_image.dart'; import 'package:gecko/widgets/commons/build_image.dart';
import 'package:gecko/widgets/commons/build_progress_bar.dart'; import 'package:gecko/widgets/commons/build_progress_bar.dart';
import 'package:gecko/widgets/commons/build_text.dart'; import 'package:gecko/widgets/commons/build_text.dart';
@ -15,9 +16,9 @@ class InfoIntro extends StatelessWidget {
required this.pagePosition, required this.pagePosition,
this.isMd = false, this.isMd = false,
this.isFast = false, this.isFast = false,
this.boxHeight = 440, this.boxHeight = 340,
this.imageWidth = 350, this.imageWidth = 350,
this.textSize = 20, this.textSize = 17,
}) : super(key: key); }) : super(key: key);
final String text; final String text;
@ -34,12 +35,10 @@ class InfoIntro extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column(children: <Widget>[ return Column(children: <Widget>[
SizedBox(height: isTall ? 40 : 20), ScaledSizedBox(height: isTall ? 25 : 5),
BuildProgressBar(pagePosition: pagePosition), BuildProgressBar(pagePosition: pagePosition),
SizedBox(height: isTall ? 40 : 20), ScaledSizedBox(height: isTall ? 25 : 5),
BuildText(text: text, size: textSize, isMd: isMd), BuildText(text: text, size: textSize, isMd: isMd),
BuildImage( BuildImage(
assetName: assetName, boxHeight: boxHeight, imageWidth: imageWidth), assetName: assetName, boxHeight: boxHeight, imageWidth: imageWidth),
Expanded( Expanded(
@ -49,8 +48,7 @@ class InfoIntro extends StatelessWidget {
text: buttonText, nextScreen: nextScreen, isFast: false), text: buttonText, nextScreen: nextScreen, isFast: false),
), ),
), ),
// const SizedBox(height: 40), ScaledSizedBox(height: isTall ? 40 : 5),
SizedBox(height: isTall ? 40 : 20),
]); ]);
} }
} }

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/widgets/commons/fader_transition.dart'; import 'package:gecko/widgets/commons/fader_transition.dart';
@ -17,9 +18,9 @@ class NextButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( return ScaledSizedBox(
width: 380 * ratio, width: 340,
height: 60 * ratio, height: 55,
child: ElevatedButton( child: ElevatedButton(
key: keyGoNext, key: keyGoNext,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
@ -32,7 +33,8 @@ class NextButton extends StatelessWidget {
}, },
child: Text( child: Text(
text, text,
style: TextStyle(fontSize: 23 * ratio, fontWeight: FontWeight.w600), style: scaledTextStyle(
fontSize: 23, fontWeight: FontWeight.w600, color: Colors.white),
), ),
), ),
); );

View File

@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
import 'package:gecko/models/scale_functions.dart';
class GeckoAppBar extends StatelessWidget implements PreferredSizeWidget {
const GeckoAppBar(this.text, {Key? key}) : super(key: key);
final String text;
@override
AppBar build(BuildContext context) {
return AppBar(
toolbarHeight: scaleSize(57),
titleSpacing: 10,
title: Text(
text,
style: scaledTextStyle(fontWeight: FontWeight.w600, fontSize: 18),
),
);
}
@override
Size get preferredSize => Size.fromHeight(scaleSize(57));
}

View File

@ -1,6 +1,8 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/g1_wallets_list.dart'; import 'package:gecko/models/g1_wallets_list.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/duniter_indexer.dart';
@ -27,11 +29,11 @@ class ContactsList extends StatelessWidget {
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false); final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 20), padding: const EdgeInsets.symmetric(horizontal: 5),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
const SizedBox(height: 20, width: double.infinity), ScaledSizedBox(height: 10, width: double.infinity),
if (myContacts.isEmpty) if (myContacts.isEmpty)
Text('noContacts'.tr()) Text('noContacts'.tr())
else else
@ -42,14 +44,15 @@ class ContactsList extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 5), padding: const EdgeInsets.symmetric(horizontal: 5),
child: ListTile( child: ListTile(
key: keySearchResult('keyID++'), key: keySearchResult('keyID++'),
horizontalTitleGap: 40, horizontalTitleGap: 7,
contentPadding: const EdgeInsets.all(5), contentPadding: const EdgeInsets.all(5),
leading: dense: !isTall,
CesiumAvatar(address: g1Wallet.address, size: 55), leading: CesiumAvatar(
address: g1Wallet.address, size: scaleSize(50)),
title: Row(children: <Widget>[ title: Row(children: <Widget>[
Text(getShortPubkey(g1Wallet.address), Text(getShortPubkey(g1Wallet.address),
style: const TextStyle( style: scaledTextStyle(
fontSize: 18, fontSize: 16,
fontFamily: 'Monospace', fontFamily: 'Monospace',
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
textAlign: TextAlign.center), textAlign: TextAlign.center),
@ -57,7 +60,7 @@ class ContactsList extends StatelessWidget {
trailing: Column( trailing: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
SizedBox( ScaledSizedBox(
width: 110, width: 110,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
@ -68,16 +71,16 @@ class ContactsList extends StatelessWidget {
children: [ children: [
Balance( Balance(
address: g1Wallet.address, address: g1Wallet.address,
size: 16), size: scaleSize(14)),
]), ]),
]), ]),
), ),
]), ]),
subtitle: Row(children: <Widget>[ subtitle: Row(children: <Widget>[
NameByAddress( NameByAddress(
size: scaleSize(17),
wallet: WalletData(address: g1Wallet.address)) wallet: WalletData(address: g1Wallet.address))
]), ]),
dense: false,
isThreeLine: false, isThreeLine: false,
onTap: () { onTap: () {
Navigator.push( Navigator.push(

View File

@ -2,6 +2,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
@ -23,9 +24,7 @@ class DragTuleAction extends StatelessWidget {
delay: const Duration(milliseconds: 200), delay: const Duration(milliseconds: 200),
data: wallet.address, data: wallet.address,
dragAnchorStrategy: (Draggable<Object> _, BuildContext __, Offset ___) => dragAnchorStrategy: (Draggable<Object> _, BuildContext __, Offset ___) =>
const Offset(0, 0), const Offset(55, 55),
// feedbackOffset: const Offset(-500, -500),
// dragAnchorStrategy: childDragAnchorStrategy,
onDragStarted: () => myWalletProvider.dragAddress = wallet, onDragStarted: () => myWalletProvider.dragAddress = wallet,
onDragEnd: (_) { onDragEnd: (_) {
myWalletProvider.lastFlyBy = null; myWalletProvider.lastFlyBy = null;
@ -37,17 +36,15 @@ class DragTuleAction extends StatelessWidget {
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: orangeC, backgroundColor: orangeC,
shape: const CircleBorder(), shape: const CircleBorder(),
padding: const EdgeInsets.all(15), padding: EdgeInsets.all(scaleSize(14)),
), ),
child: const SizedBox( child: SizedBox(
height: 35, height: scaleSize(33),
child: Image(image: AssetImage('assets/vector_white.png')), child: const Image(image: AssetImage('assets/vector_white.png')),
), ),
), ),
child: DragTarget<String>( child: DragTarget<String>(
onAccept: (senderAddress) async { onAccept: (senderAddress) async {
log.d(
'INTERPAY: sender: $senderAddress --- receiver: ${wallet.address}');
final walletData = final walletData =
myWalletProvider.getWalletDataByAddress(senderAddress); myWalletProvider.getWalletDataByAddress(senderAddress);
await sub.setCurrentWallet(walletData!); await sub.setCurrentWallet(walletData!);

View File

@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/duniter_indexer.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -27,19 +28,35 @@ class DragWalletsInfo extends StatelessWidget {
final toName = final toName =
duniterIndexer.walletNameIndexer[lastFlyBy.address] ?? lastFlyBy.name; duniterIndexer.walletNameIndexer[lastFlyBy.address] ?? lastFlyBy.name;
final mdStyle = MarkdownStyleSheet(
p: scaledTextStyle(fontSize: 16, color: Colors.black, letterSpacing: 0.3),
textAlign: WrapAlignment.spaceBetween,
);
return Container( return Container(
color: yellowC, color: yellowC,
width: screenWidth, width: screenWidth,
height: 80, height: scaleSize(85),
child: Center( child: Center(
child: Column( child: Column(
children: [ children: [
const SizedBox(height: 2), ScaledSizedBox(height: 2),
Text('${'executeATransfer'.tr()}:'), Text(
MarkdownBody(data: '${'from'.tr()} **$fromName**'), '${'executeATransfer'.tr()}:',
if (isSameAddress) Text('chooseATargetWallet'.tr()), style: scaledTextStyle(fontSize: 16),
if (!isSameAddress) MarkdownBody(data: 'Vers: **$toName**'), ),
MarkdownBody(
data: '${'from'.tr(args: [''])} **$fromName**',
styleSheet: mdStyle),
if (isSameAddress)
Text(
'chooseATargetWallet'.tr(),
style: scaledTextStyle(fontSize: 16),
),
if (!isSameAddress)
MarkdownBody(
data: '${'to'.tr(args: [''])} **$toName**',
styleSheet: mdStyle),
], ],
)), )),
); );

View File

@ -3,6 +3,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/wallets_profiles.dart'; import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/screens/debug_screen.dart'; import 'package:gecko/screens/debug_screen.dart';
@ -19,82 +20,122 @@ class MainDrawer extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Drawer( final listStyle = scaledTextStyle(fontSize: 15);
child: Column(
children: <Widget>[ return SizedBox(
Expanded( width: MediaQuery.of(context).size.width * 0.67,
child: ListView(padding: EdgeInsets.zero, children: <Widget>[ child: Drawer(
const DrawerHeader( child: Column(
decoration: BoxDecoration( children: <Widget>[
color: orangeC, Expanded(
child: ListView(padding: EdgeInsets.zero, children: <Widget>[
DrawerHeader(
decoration: const BoxDecoration(
color: orangeC,
),
child: Column(children: <Widget>[
Image(
image: const AssetImage('assets/icon/gecko_final.png'),
height: scaleSize(125)),
]),
), ),
child: Column(children: <Widget>[ ScaledSizedBox(height: scaleSize(10)),
SizedBox(height: 0), Opacity(
Image( opacity: 0.8,
image: AssetImage('assets/icon/gecko_final.png'), child: ListTile(
height: 130), key: keyParameters,
]), leading: Icon(Icons.settings, size: scaleSize(25)),
), dense: !isTall,
ListTile( // contentPadding:
key: keyParameters, // EdgeInsets.symmetric(horizontal: scaleSize(12)),
title: Text('parameters'.tr()), title: Text(
onTap: () { 'parameters'.tr(),
Navigator.pop(context); style: listStyle,
Navigator.push( ),
context, onTap: () {
MaterialPageRoute(builder: (context) { Navigator.pop(context);
return SettingsScreen(); Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return SettingsScreen();
}),
);
},
),
),
ScaledSizedBox(height: scaleSize(4)),
if (isWalletsExists)
Opacity(
opacity: 0.8,
child: ListTile(
key: keyContacts,
leading: Icon(Icons.contacts_rounded, size: scaleSize(25)),
dense: !isTall,
title: Text(
'contactsManagement'.tr(),
style: listStyle,
),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const ContactsScreen();
}),
);
},
),
),
if (isWalletsExists) ScaledSizedBox(height: scaleSize(4)),
if (kDebugMode)
Opacity(
opacity: 0.8,
child: ListTile(
key: keyDebugScreen,
leading:
Icon(Icons.developer_mode_rounded, size: scaleSize(25)),
dense: !isTall,
title: Text(
'Debug screen'.tr(),
style: listStyle,
),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const DebugScreen();
}),
);
},
),
),
])),
Align(
alignment: FractionalOffset.bottomCenter,
child: InkWell(
key: keyCopyAddress,
splashColor: orangeC,
child: Padding(
padding: const EdgeInsets.all(15),
child: Opacity(
opacity: 0.8,
child: Text('Ğecko v$appVersion',
style: scaledTextStyle(fontSize: 13)),
),
),
onTap: () {
Clipboard.setData(
ClipboardData(text: 'Ğecko v$appVersion'));
snackMessage(context,
message:
'Le numéro de version de Ğecko a été copié dans votre presse papier',
duration: 4);
}), }),
);
},
), ),
if (isWalletsExists) ScaledSizedBox(height: 15)
ListTile( ],
key: keyContacts, ),
title: Text('contactsManagement'.tr()),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const ContactsScreen();
}),
);
},
),
if (kDebugMode)
ListTile(
key: keyDebugScreen,
title: Text('Debug screen'.tr()),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const DebugScreen();
}),
);
},
),
])),
Align(
alignment: FractionalOffset.bottomCenter,
child: InkWell(
key: keyCopyAddress,
splashColor: orangeC,
child: Padding(
padding: const EdgeInsets.all(20),
child: Text('Ğecko v$appVersion')),
onTap: () {
Clipboard.setData(ClipboardData(text: 'Ğecko v$appVersion'));
snackMessage(context,
message:
'Le numéro de version de Ğecko a été copié dans votre presse papier',
duration: 4);
}),
),
const SizedBox(height: 20)
],
), ),
); );
} }

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/duniter_indexer.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
@ -27,7 +28,7 @@ class HeaderProfile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
const double avatarSize = 140; final avatarSize = scaleSize(110);
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false); final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
final walletOptions = final walletOptions =
Provider.of<WalletOptionsProvider>(context, listen: false); Provider.of<WalletOptionsProvider>(context, listen: false);
@ -37,7 +38,7 @@ class HeaderProfile extends StatelessWidget {
Consumer<SubstrateSdk>(builder: (context, sub, _) { Consumer<SubstrateSdk>(builder: (context, sub, _) {
bool isAccountExist = walletOptions.balanceCache[address] != 0; bool isAccountExist = walletOptions.balanceCache[address] != 0;
return Container( return Container(
height: 185, height: scaleSize(160),
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
begin: Alignment.topCenter, begin: Alignment.topCenter,
@ -50,13 +51,13 @@ class HeaderProfile extends StatelessWidget {
)); ));
}), }),
Padding( Padding(
padding: const EdgeInsets.only(left: 30, right: 30), padding: EdgeInsets.only(left: scaleSize(19), right: scaleSize(19)),
child: Row(children: <Widget>[ child: Row(children: <Widget>[
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Container( Container(
height: 10, height: 5,
color: yellowC, color: yellowC,
), ),
Row(children: [ Row(children: [
@ -68,16 +69,17 @@ class HeaderProfile extends StatelessWidget {
}, },
child: Text( child: Text(
getShortPubkey(address), getShortPubkey(address),
style: const TextStyle( style: scaledTextStyle(
fontSize: 30, fontSize: 23,
fontWeight: FontWeight.w800, fontFamily: 'Monospace',
fontWeight: FontWeight.w900,
), ),
), ),
), ),
]), ]),
const SizedBox(height: 18), ScaledSizedBox(height: 15),
Balance(address: address, size: 25), Balance(address: address, size: 20),
const SizedBox(height: 5), ScaledSizedBox(height: 5),
InkWell( InkWell(
onTap: () => sub.certsCounterCache[address] != null onTap: () => sub.certsCounterCache[address] != null
? { ? {
@ -100,13 +102,15 @@ class HeaderProfile extends StatelessWidget {
address: address, address: address,
isOwner: false, isOwner: false,
color: Colors.black), color: Colors.black),
Certifications(address: address, size: 19) Certifications(address: address, size: 18)
], ],
), ),
), ),
]), ]),
const Spacer(), const Spacer(),
// ScaledSizedBox(width: 20),
Column(children: <Widget>[ Column(children: <Widget>[
ScaledSizedBox(height: 15),
CesiumAvatar(address: address, size: avatarSize), CesiumAvatar(address: address, size: avatarSize),
]), ]),
]), ]),

View File

@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/queries_indexer.dart'; import 'package:gecko/models/queries_indexer.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/duniter_indexer.dart';
import 'package:gecko/widgets/history_view.dart'; import 'package:gecko/widgets/history_view.dart';
@ -24,11 +25,11 @@ class HistoryQuery extends StatelessWidget {
if (indexerEndpoint == '') { if (indexerEndpoint == '') {
return Column(children: <Widget>[ return Column(children: <Widget>[
const SizedBox(height: 50), ScaledSizedBox(height: 50),
Text( Text(
"noNetworkNoHistory".tr(), "noNetworkNoHistory".tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(fontSize: 18), style: scaledTextStyle(fontSize: 18),
) )
]); ]);
} }
@ -72,20 +73,20 @@ class HistoryQuery extends StatelessWidget {
if (result.hasException) { if (result.hasException) {
log.e('Error Indexer: ${result.exception}'); log.e('Error Indexer: ${result.exception}');
return Column(children: <Widget>[ return Column(children: <Widget>[
const SizedBox(height: 50), ScaledSizedBox(height: 50),
Text( Text(
"noNetworkNoHistory".tr(), "noNetworkNoHistory".tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(fontSize: 18), style: scaledTextStyle(fontSize: 18),
) )
]); ]);
} else if (result } else if (result
.data?['transaction_connection']?['edges'].isEmpty) { .data?['transaction_connection']?['edges'].isEmpty) {
return Column(children: <Widget>[ return Column(children: <Widget>[
const SizedBox(height: 50), ScaledSizedBox(height: 50),
Text( Text(
"noDataToDisplay".tr(), "noDataToDisplay".tr(),
style: const TextStyle(fontSize: 18), style: scaledTextStyle(fontSize: 18),
) )
]); ]);
} }
@ -93,8 +94,6 @@ class HistoryQuery extends StatelessWidget {
if (result.isNotLoading) { if (result.isNotLoading) {
if (duniterIndexer.fetchMoreCursor == null) nPage = 1; if (duniterIndexer.fetchMoreCursor == null) nPage = 1;
// log.d('nPage: $nPage');
if (nPage <= 3) { if (nPage <= 3) {
nRepositories = 20; nRepositories = 20;
} else if (nPage <= 6) { } else if (nPage <= 6) {

View File

@ -1,6 +1,7 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/duniter_indexer.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
import 'package:gecko/screens/wallet_view.dart'; import 'package:gecko/screens/wallet_view.dart';
@ -24,16 +25,16 @@ class HistoryView extends StatelessWidget {
final sub = Provider.of<SubstrateSdk>(homeContext, listen: false); final sub = Provider.of<SubstrateSdk>(homeContext, listen: false);
int keyID = 0; int keyID = 0;
const double avatarSize = 200; const double avatarSize = 50;
bool isMigrationPassed = false; bool isMigrationPassed = false;
List<String> pastDelimiters = []; List<String> pastDelimiters = [];
return duniterIndexer.transBC == null return duniterIndexer.transBC == null
? Column(children: <Widget>[ ? Column(children: <Widget>[
const SizedBox(height: 50), ScaledSizedBox(height: 50),
Text( Text(
"noTransactionToDisplay".tr(), "noTransactionToDisplay".tr(),
style: const TextStyle(fontSize: 18), style: scaledTextStyle(fontSize: 18),
) )
]) ])
: Column(children: <Widget>[ : Column(children: <Widget>[
@ -51,23 +52,23 @@ class HistoryView extends StatelessWidget {
return Column(children: <Widget>[ return Column(children: <Widget>[
if (isMigrationTime) if (isMigrationTime)
Padding( Padding(
padding: const EdgeInsets.symmetric(vertical: 30), padding: EdgeInsets.symmetric(vertical: scaleSize(23)),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
const Image( Image(
image: AssetImage('assets/party.png'), height: 40), image: const AssetImage('assets/party.png'),
const SizedBox(width: 40), height: scaleSize(32)),
Text( Text(
'blockchainStart'.tr(), 'blockchainStart'.tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 25, fontSize: 20,
color: Colors.blueAccent, color: Colors.blueAccent,
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
), ),
const SizedBox(width: 40), Image(
const Image( image: const AssetImage('assets/party.png'),
image: AssetImage('assets/party.png'), height: 40), height: scaleSize(32)),
], ],
), ),
), ),
@ -76,11 +77,11 @@ class HistoryView extends StatelessWidget {
!(pastDelimiters[pastDelimiters.length - 2] == !(pastDelimiters[pastDelimiters.length - 2] ==
answer['dateDelimiter'])) answer['dateDelimiter']))
Padding( Padding(
padding: const EdgeInsets.symmetric(vertical: 30), padding: const EdgeInsets.symmetric(vertical: 20),
child: Text( child: Text(
answer['dateDelimiter'], answer['dateDelimiter'],
style: const TextStyle( style: scaledTextStyle(
fontSize: 23, fontSize: 20,
color: orangeC, color: orangeC,
fontWeight: FontWeight.w300), fontWeight: FontWeight.w300),
), ),
@ -117,30 +118,32 @@ class HistoryView extends StatelessWidget {
}), }),
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
const Icon( Icon(
Icons.account_circle, Icons.account_circle,
size: 40, size: 40,
color: Colors.blueAccent, color: Colors.green[700],
), ),
const SizedBox(width: 40),
Column(children: [ Column(children: [
Text( Text(
'Identité migré:'.tr(), 'Identité migré:'.tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 25, fontSize: 20,
color: Colors.blueAccent, color: Colors.green[700],
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
), ),
Text( Text(
'Ancienne adresse: ${getShortPubkey(sub.oldOwnerKeys[address]![0])}') 'from'.tr(args: [
' ${getShortPubkey(sub.oldOwnerKeys[address]![0])}'
]),
style: scaledTextStyle(fontSize: 17),
),
]), ]),
const SizedBox(width: 40), Icon(
const Icon(
Icons.account_circle, Icons.account_circle,
size: 40, size: scaleSize(32),
color: Colors.blueAccent, color: Colors.green[700],
), ),
], ],
), ),
@ -149,11 +152,11 @@ class HistoryView extends StatelessWidget {
if (!duniterIndexer.pageInfo!['hasNextPage']) if (!duniterIndexer.pageInfo!['hasNextPage'])
Column( Column(
children: <Widget>[ children: <Widget>[
const SizedBox(height: 15), ScaledSizedBox(height: 15),
Text("historyStart".tr(), Text("historyStart".tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(fontSize: 20)), style: scaledTextStyle(fontSize: 20)),
const SizedBox(height: 15) ScaledSizedBox(height: 15)
], ],
) )
]); ]);

View File

@ -1,6 +1,7 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/providers/substrate_sdk.dart'; import 'package:gecko/providers/substrate_sdk.dart';
import 'package:gecko/widgets/commons/animated_text.dart'; import 'package:gecko/widgets/commons/animated_text.dart';
@ -35,14 +36,14 @@ class IdentityStatus extends StatelessWidget {
if (resStatus == IdtyStatus.confirmed) { if (resStatus == IdtyStatus.confirmed) {
return NameByAddress( return NameByAddress(
wallet: WalletData(address: address), wallet: WalletData(address: address),
size: 20, size: 18,
color: Colors.grey[700]!, color: Colors.grey[700]!,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontStyle: FontStyle.italic); fontStyle: FontStyle.italic);
} else if (resStatus == IdtyStatus.validated) { } else if (resStatus == IdtyStatus.validated) {
return NameByAddress( return NameByAddress(
wallet: WalletData(address: address), wallet: WalletData(address: address),
size: 22, size: 20,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontStyle: FontStyle.normal); fontStyle: FontStyle.normal);
@ -60,7 +61,7 @@ class IdentityStatus extends StatelessWidget {
return SizedBox( return SizedBox(
child: showText(statusText[resStatus]!, child: showText(statusText[resStatus]!,
bold: resStatus == IdtyStatus.validated ? true : false), bold: resStatus == IdtyStatus.validated, size: scaleSize(17)),
); );
}); });
}); });
@ -68,7 +69,6 @@ class IdentityStatus extends StatelessWidget {
AnimatedFadeOutIn showText(String text, AnimatedFadeOutIn showText(String text,
{double size = 18, bool bold = false}) { {double size = 18, bool bold = false}) {
// log.d('$address $text');
return AnimatedFadeOutIn<String>( return AnimatedFadeOutIn<String>(
data: text, data: text,
duration: const Duration(milliseconds: 150), duration: const Duration(milliseconds: 150),

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/g1_wallets_list.dart'; import 'package:gecko/models/g1_wallets_list.dart';
import 'package:gecko/models/queries_indexer.dart'; import 'package:gecko/models/queries_indexer.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/duniter_indexer.dart';
import 'package:gecko/widgets/wallet_name.dart'; import 'package:gecko/widgets/wallet_name.dart';
@ -87,7 +88,7 @@ class NameByAddress extends StatelessWidget {
? '(${duniterIndexer.walletNameIndexer[wallet.address]!})' ? '(${duniterIndexer.walletNameIndexer[wallet.address]!})'
: truncate( : truncate(
duniterIndexer.walletNameIndexer[wallet.address]!, 20), duniterIndexer.walletNameIndexer[wallet.address]!, 20),
style: TextStyle( style: scaledTextStyle(
fontSize: size, fontSize: size,
color: color, color: color,
fontWeight: fontWeight, fontWeight: fontWeight,

View File

@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
@ -43,13 +44,12 @@ void paymentPopup(BuildContext context, String toAddress, String? username) {
), ),
); );
} }
log.d(pin);
if (pin != null || myWalletProvider.pinCode != '') { if (pin != null || myWalletProvider.pinCode != '') {
// Payment workflow ! // Payment workflow !
final sub = Provider.of<SubstrateSdk>(context, listen: false); final sub = Provider.of<SubstrateSdk>(context, listen: false);
final acc = sub.getCurrentWallet(); final acc = sub.getCurrentWallet();
log.d( log.d(
"fromAddress: ${acc.address!},destAddress: $toAddress, amount: ${double.parse(walletViewProvider.payAmount.text)}, password: $pin"); "fromAddress: ${acc.address!},destAddress: $toAddress, amount: ${double.parse(walletViewProvider.payAmount.text)}");
sub.pay( sub.pay(
fromAddress: acc.address!, fromAddress: acc.address!,
destAddress: toAddress, destAddress: toAddress,
@ -105,7 +105,7 @@ void paymentPopup(BuildContext context, String toAddress, String? username) {
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom), bottom: MediaQuery.of(context).viewInsets.bottom),
child: Container( child: Container(
height: 420, height: scaleSize(400),
decoration: const ShapeDecoration( decoration: const ShapeDecoration(
color: Color(0xffffeed1), color: Color(0xffffeed1),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@ -116,8 +116,11 @@ void paymentPopup(BuildContext context, String toAddress, String? username) {
), ),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.only( padding: EdgeInsets.only(
top: 24, bottom: 0, left: 24, right: 24), top: scaleSize(14),
bottom: 0,
left: scaleSize(16),
right: scaleSize(16)),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -127,125 +130,137 @@ void paymentPopup(BuildContext context, String toAddress, String? username) {
children: [ children: [
Text( Text(
'executeATransfer'.tr(), 'executeATransfer'.tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 26, fontWeight: FontWeight.w700), fontSize: 20, fontWeight: FontWeight.w700),
), ),
IconButton( IconButton(
key: keyPopButton, key: keyPopButton,
iconSize: 40, iconSize: scaleSize(32),
icon: const Icon(Icons.cancel_outlined), icon: const Icon(Icons.cancel_outlined),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
]), ]),
const SizedBox(height: 5), ScaledSizedBox(height: 5),
Text( Text(
'from'.tr(), 'from'.tr(args: ['']),
style: TextStyle( style: scaledTextStyle(
fontSize: 19, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Colors.grey[600]), color: Colors.grey[600]),
), ),
const SizedBox(height: 5), ScaledSizedBox(height: 5),
Consumer<SubstrateSdk>(builder: (context, sub, _) { Consumer<SubstrateSdk>(builder: (context, sub, _) {
return DropdownButton( return Container(
dropdownColor: const Color(0xffffeed1), decoration: BoxDecoration(
elevation: 12, border: Border.all(
key: keyDropdownWallets, color: Colors.blueAccent.shade200, width: 2),
value: defaultWallet, borderRadius:
menuMaxHeight: 300, const BorderRadius.all(Radius.circular(10)),
onTap: () { ),
FocusScope.of(context).requestFocus(amountFocus); alignment: Alignment.center,
}, padding: const EdgeInsets.all(0),
selectedItemBuilder: (_) { child: DropdownButton(
return myWalletProvider.listWallets dropdownColor: const Color(0xffffeed1),
elevation: 12,
key: keyDropdownWallets,
value: defaultWallet,
menuMaxHeight: scaleSize(270),
onTap: () {
FocusScope.of(context)
.requestFocus(amountFocus);
},
selectedItemBuilder: (_) {
return myWalletProvider.listWallets
.map((WalletData wallet) {
return Container(
width: scaleSize(isTall ? 315 : 310),
padding: EdgeInsets.all(scaleSize(7)),
child: Visibility(
visible: wallet.address ==
defaultWallet.address,
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
NameByAddress(
wallet: wallet,
fontStyle: FontStyle.normal,
size: 18,
),
const Spacer(),
// const Text('data')
Balance(
address: wallet.address,
size: 18),
]),
),
);
}).toList();
},
onChanged: (WalletData? newSelectedWallet) async {
defaultWallet = newSelectedWallet!;
await sub.setCurrentWallet(newSelectedWallet);
sub.reload();
amountFocus.requestFocus();
setState(() {});
},
items: myWalletProvider.listWallets
.map((WalletData wallet) { .map((WalletData wallet) {
return Container( return DropdownMenuItem(
width: 408, value: wallet,
decoration: BoxDecoration( key: keySelectThisWallet(wallet.address),
border: Border.all( child: Container(
color: Colors.blueAccent.shade200, color: const Color(0xffffeed1),
width: 2), width: scaleSize(isTall ? 315 : 310),
borderRadius: const BorderRadius.all( padding: const EdgeInsets.all(10),
Radius.circular(10.0)), child: Row(
), mainAxisAlignment:
padding: const EdgeInsets.all(7), MainAxisAlignment.center,
child: Visibility( children: [
visible: NameByAddress(
wallet.address == defaultWallet.address, wallet: wallet,
child: Row(children: [ fontStyle: FontStyle.normal,
NameByAddress( size: 18,
wallet: wallet, ),
fontStyle: FontStyle.normal), const Spacer(),
const Spacer(), Balance(
Balance( address: wallet.address,
address: wallet.address, size: 20), size: 18),
]), ]),
), ),
); );
}).toList(); }).toList()),
}, );
onChanged: (WalletData? newSelectedWallet) async {
defaultWallet = newSelectedWallet!;
await sub.setCurrentWallet(newSelectedWallet);
sub.reload();
amountFocus.requestFocus();
setState(() {});
},
items: myWalletProvider.listWallets
.map((WalletData wallet) {
return DropdownMenuItem(
value: wallet,
key: keySelectThisWallet(wallet.address),
child: Container(
color: const Color(0xffffeed1),
width: 408,
height: 80,
padding: const EdgeInsets.all(7),
child: Row(children: [
NameByAddress(
wallet: wallet,
fontStyle: FontStyle.normal),
const Spacer(),
Balance(address: wallet.address, size: 20),
]),
),
);
}).toList());
}), }),
const SizedBox(height: 12), ScaledSizedBox(height: 12),
Row( Row(
children: [ children: [
Text( Text(
'to'.tr(), 'to'.tr(args: ['']),
style: TextStyle( style: scaledTextStyle(
fontSize: 19, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Colors.grey[600]), color: Colors.grey[600]),
), ),
const SizedBox(width: 10), ScaledSizedBox(width: 10),
Column( Text(
children: [ username ?? getShortPubkey(toAddress),
const SizedBox(height: 2), style: scaledTextStyle(
Text( fontSize: 18,
username ?? getShortPubkey(toAddress), fontWeight: FontWeight.w600,
style: const TextStyle( ),
fontSize: 21,
fontWeight: FontWeight.w600,
),
),
],
), ),
], ],
), ),
const SizedBox(height: 7), ScaledSizedBox(height: 7),
Row( Row(
children: [ children: [
Text( Text(
'amount'.tr(), 'amount'.tr(),
style: TextStyle( style: scaledTextStyle(
fontSize: 19, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Colors.grey[600]), color: Colors.grey[600]),
), ),
@ -254,24 +269,25 @@ void paymentPopup(BuildContext context, String toAddress, String? username) {
onTap: () => infoFeesPopup(context), onTap: () => infoFeesPopup(context),
child: Row( child: Row(
children: [ children: [
const Icon(Icons.info_outlined, color: orangeC), Icon(Icons.info_outlined,
const SizedBox(width: 5), color: orangeC, size: scaleSize(21)),
ScaledSizedBox(width: 5),
Text( Text(
'fees'.tr( 'fees'.tr(
args: [fees.toString(), currencyName]), args: [fees.toString(), currencyName]),
style: const TextStyle( style: scaledTextStyle(
color: orangeC, color: orangeC,
fontSize: 17, fontSize: 14,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
], ],
), ),
), ),
const SizedBox(width: 10), ScaledSizedBox(width: 10),
], ],
), ),
const SizedBox(height: 10), ScaledSizedBox(height: 10),
Focus( Focus(
onFocusChange: (focused) { onFocusChange: (focused) {
setState(() { setState(() {
@ -299,7 +315,6 @@ void paymentPopup(BuildContext context, String toAddress, String? username) {
walletViewProvider.payAmount.text == '' walletViewProvider.payAmount.text == ''
? '0' ? '0'
: walletViewProvider.payAmount.text)); : walletViewProvider.payAmount.text));
log.d(fees);
setState(() {}); setState(() {});
}, },
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
@ -310,9 +325,8 @@ void paymentPopup(BuildContext context, String toAddress, String? username) {
], ],
decoration: InputDecoration( decoration: InputDecoration(
hintText: '0.00', hintText: '0.00',
suffix: Text(isUdUnit suffix: Text(
? 'ud'.tr(args: ['']) isUdUnit ? 'ud'.tr(args: ['']) : currencyName),
: currencyName), // udUnitDisplay(40),
filled: true, filled: true,
fillColor: Colors.transparent, fillColor: Colors.transparent,
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
@ -320,24 +334,25 @@ void paymentPopup(BuildContext context, String toAddress, String? username) {
color: Colors.grey[500]!, width: 2), color: Colors.grey[500]!, width: 2),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
contentPadding: const EdgeInsets.all(15), contentPadding: EdgeInsets.all(scaleSize(9)),
), ),
style: const TextStyle( style: scaledTextStyle(
fontSize: 33, fontSize: 25,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
), ),
const Spacer(), const Spacer(),
SizedBox( ScaledSizedBox(
width: double.infinity, width: double.infinity,
height: 60, height: 55,
child: ElevatedButton( child: ElevatedButton(
key: keyConfirmPayment, key: keyConfirmPayment,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
foregroundColor: Colors.white, elevation: 4, foregroundColor: Colors.white,
backgroundColor: orangeC, // foreground elevation: 4,
backgroundColor: orangeC,
), ),
onPressed: canValidate onPressed: canValidate
? () async { ? () async {
@ -347,8 +362,8 @@ void paymentPopup(BuildContext context, String toAddress, String? username) {
: null, : null,
child: Text( child: Text(
'executeTheTransfer'.tr(), 'executeTheTransfer'.tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 20, fontWeight: FontWeight.w600), fontSize: 18, fontWeight: FontWeight.w600),
), ),
), ),
), ),
@ -373,19 +388,19 @@ Future<void> infoFeesPopup(BuildContext context) async {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const Icon(Icons.info_outlined, color: orangeC, size: 40), const Icon(Icons.info_outlined, color: orangeC, size: 40),
const SizedBox(height: 20), ScaledSizedBox(height: 20),
Text( Text(
'feesExplanation'.tr(), 'feesExplanation'.tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w500), style: scaledTextStyle(fontSize: 20, fontWeight: FontWeight.w500),
), ),
const SizedBox(height: 30), ScaledSizedBox(height: 30),
Text( Text(
'feesExplanationDetails'.tr(), 'feesExplanationDetails'.tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w300), style: scaledTextStyle(fontSize: 18, fontWeight: FontWeight.w300),
), ),
const SizedBox(height: 5), ScaledSizedBox(height: 5),
InkWell( InkWell(
onTap: () async => await _launchUrl('https://duniter.org'), onTap: () async => await _launchUrl('https://duniter.org'),
child: Container( child: Container(
@ -401,7 +416,7 @@ Future<void> infoFeesPopup(BuildContext context) async {
child: Text( child: Text(
'moreInfo'.tr(), 'moreInfo'.tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: scaledTextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.w300, fontWeight: FontWeight.w300,
color: Colors.blueAccent, color: Colors.blueAccent,
@ -422,9 +437,9 @@ Future<void> infoFeesPopup(BuildContext context) async {
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
child: Text( child: Text(
'gotit'.tr(), 'gotit'.tr(),
style: const TextStyle( style: scaledTextStyle(
fontSize: 21, fontSize: 21,
color: Color(0xffD80000), color: const Color(0xffD80000),
), ),
), ),
), ),

View File

@ -1,6 +1,7 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/providers/generate_wallets.dart'; import 'package:gecko/providers/generate_wallets.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -22,24 +23,33 @@ class ScanDerivationsInfo extends StatelessWidget {
children: [ children: [
if (generateWalletProvider.scanStatus == if (generateWalletProvider.scanStatus ==
ScanDerivationsStatus.rootScanning) ScanDerivationsStatus.rootScanning)
Text('scanRootDerivationInProgress'.tr()), Text(
'scanRootDerivationInProgress'.tr(),
style: scaledTextStyle(fontSize: 16),
),
if (generateWalletProvider.scanStatus == if (generateWalletProvider.scanStatus ==
ScanDerivationsStatus.scanning) ScanDerivationsStatus.scanning)
Text('derivationsScanProgress' Text(
.tr(args: [generateWalletProvider.numberScan.toString()])), 'derivationsScanProgress'
.tr(args: [generateWalletProvider.numberScan.toString()]),
style: scaledTextStyle(fontSize: 16),
),
if (generateWalletProvider.scanStatus == if (generateWalletProvider.scanStatus ==
ScanDerivationsStatus.import) ScanDerivationsStatus.import)
Text("importDerivationsInProgress".tr(args: [ Text(
'${generateWalletProvider.scanedWalletNumber}', "importDerivationsInProgress".tr(args: [
'${generateWalletProvider.scanedValidWalletNumber}' '${generateWalletProvider.scanedWalletNumber}',
])), '${generateWalletProvider.scanedValidWalletNumber}'
const SizedBox(width: 10), ]),
const SizedBox( style: scaledTextStyle(fontSize: 16),
),
ScaledSizedBox(width: 10),
ScaledSizedBox(
height: 22, height: 22,
width: 22, width: 22,
child: CircularProgressIndicator( child: CircularProgressIndicator(
color: orangeC, color: orangeC,
strokeWidth: 3, strokeWidth: scaleSize(3),
), ),
), ),
], ],

View File

@ -3,6 +3,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/queries_indexer.dart'; import 'package:gecko/models/queries_indexer.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/duniter_indexer.dart';
import 'package:gecko/providers/search.dart'; import 'package:gecko/providers/search.dart';
@ -28,7 +29,6 @@ class SearchIdentityQuery extends StatelessWidget {
return Text('noResult'.tr()); return Text('noResult'.tr());
} }
log.d(indexerEndpoint);
final httpLink = HttpLink( final httpLink = HttpLink(
'$indexerEndpoint/v1/graphql', '$indexerEndpoint/v1/graphql',
); );
@ -44,12 +44,10 @@ class SearchIdentityQuery extends StatelessWidget {
client: client, client: client,
child: Query( child: Query(
options: QueryOptions( options: QueryOptions(
document: gql( document: gql(searchAddressByNameQ),
searchAddressByNameQ), // this is the query string you just created
variables: { variables: {
'name': name, 'name': name,
}, },
// pollInterval: const Duration(seconds: 10),
), ),
builder: (QueryResult result, builder: (QueryResult result,
{VoidCallback? refetch, FetchMore? fetchMore}) { {VoidCallback? refetch, FetchMore? fetchMore}) {
@ -76,61 +74,58 @@ class SearchIdentityQuery extends StatelessWidget {
searchProvider.resultLenght = identities.length; searchProvider.resultLenght = identities.length;
double avatarSize = 55; final avatarSize = scaleSize(45);
return Expanded( return Expanded(
child: ListView(children: <Widget>[ child: ListView(children: <Widget>[
for (Map profile in identities) for (Map profile in identities)
Padding( ListTile(
padding: const EdgeInsets.symmetric(horizontal: 5), key: keySearchResult(profile['pubkey']),
child: ListTile( horizontalTitleGap: 10,
key: keySearchResult(profile['pubkey']), contentPadding: const EdgeInsets.only(right: 2),
horizontalTitleGap: 40, leading: CesiumAvatar(
contentPadding: const EdgeInsets.all(5), address: profile['pubkey'], size: avatarSize),
leading: CesiumAvatar( title: Row(children: <Widget>[
address: profile['pubkey'], size: avatarSize), Text(getShortPubkey(profile['pubkey']),
title: Row(children: <Widget>[ style: scaledTextStyle(
Text(getShortPubkey(profile['pubkey']), fontSize: 16,
style: const TextStyle( fontFamily: 'Monospace',
fontSize: 18, fontWeight: FontWeight.w500),
fontFamily: 'Monospace', textAlign: TextAlign.center),
fontWeight: FontWeight.w500), ]),
textAlign: TextAlign.center), trailing: ScaledSizedBox(
]), width: 120,
trailing: SizedBox( child: Row(
width: 110, mainAxisAlignment: MainAxisAlignment.end,
child: Row( children: [
mainAxisAlignment: MainAxisAlignment.end, Column(
children: [ mainAxisAlignment: MainAxisAlignment.center,
Column( children: [
mainAxisAlignment: MainAxisAlignment.center, Balance(
children: [ address: profile['pubkey'], size: 15),
Balance( ]),
address: profile['pubkey'], size: 16), ]),
]), ),
]), subtitle: Row(children: <Widget>[
), Text(profile['name'] ?? '',
subtitle: Row(children: <Widget>[ style: scaledTextStyle(
Text(profile['name'] ?? '', fontSize: 17, fontWeight: FontWeight.w500),
style: const TextStyle( textAlign: TextAlign.center),
fontSize: 18, fontWeight: FontWeight.w500), ]),
textAlign: TextAlign.center), dense: !isTall,
]), isThreeLine: false,
dense: false, onTap: () {
isThreeLine: false, Navigator.pop(context);
onTap: () { Navigator.push(
Navigator.pop(context); context,
Navigator.push( MaterialPageRoute(builder: (context) {
context, walletsProfiles.address = profile['pubkey'];
MaterialPageRoute(builder: (context) { return WalletViewScreen(
walletsProfiles.address = profile['pubkey']; address: profile['pubkey'],
return WalletViewScreen( username: profile['name'],
address: profile['pubkey'], );
username: profile['name'], }),
); );
}), }),
);
}),
),
]), ]),
); );
}), }),

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/g1_wallets_list.dart'; import 'package:gecko/models/g1_wallets_list.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/duniter_indexer.dart';
@ -36,12 +37,11 @@ class SearchResult extends StatelessWidget {
if (snapshot.data?.isEmpty ?? true) { if (snapshot.data?.isEmpty ?? true) {
return SearchIdentityQuery( return SearchIdentityQuery(
name: searchProvider.searchController.text); name: searchProvider.searchController.text);
// const Text('Aucun résultat');
} else { } else {
return Expanded( return Expanded(
child: ListView(children: <Widget>[ child: ListView(children: <Widget>[
for (G1WalletsList g1Wallet in snapshot.data ?? []) for (G1WalletsList g1Wallet in snapshot.data ?? [])
resultTile(g1Wallet, context), resultTileAddressSearch(g1Wallet, context),
]), ]),
); );
} }
@ -58,53 +58,50 @@ class SearchResult extends StatelessWidget {
); );
} }
Padding resultTile(G1WalletsList g1Wallet, BuildContext context) { Widget resultTileAddressSearch(G1WalletsList g1Wallet, BuildContext context) {
return Padding( return ListTile(
padding: const EdgeInsets.symmetric(horizontal: 5), key: keySearchResult(g1Wallet.address),
child: ListTile( horizontalTitleGap: 10,
key: keySearchResult(g1Wallet.address), contentPadding: const EdgeInsets.all(5),
horizontalTitleGap: 40, leading: CesiumAvatar(address: g1Wallet.address, size: avatarSize),
contentPadding: const EdgeInsets.all(5), title: Row(children: <Widget>[
leading: CesiumAvatar(address: g1Wallet.address, size: avatarSize), Text(getShortPubkey(g1Wallet.address),
title: Row(children: <Widget>[ style: scaledTextStyle(
Text(getShortPubkey(g1Wallet.address), fontSize: 18,
style: const TextStyle( fontFamily: 'Monospace',
fontSize: 18, fontWeight: FontWeight.w500),
fontFamily: 'Monospace', textAlign: TextAlign.center),
fontWeight: FontWeight.w500), ]),
textAlign: TextAlign.center), trailing:
]), Column(mainAxisAlignment: MainAxisAlignment.center, children: [
trailing: ScaledSizedBox(
width: 110,
child: Row(mainAxisAlignment: MainAxisAlignment.end, children: [
Column(mainAxisAlignment: MainAxisAlignment.center, children: [ Column(mainAxisAlignment: MainAxisAlignment.center, children: [
SizedBox( Balance(address: g1Wallet.address, size: 15),
width: 110,
child: Row(mainAxisAlignment: MainAxisAlignment.end, children: [
Column(mainAxisAlignment: MainAxisAlignment.center, children: [
Balance(address: g1Wallet.address, size: 16),
]),
]), ]),
), ]),
]), ),
subtitle: Row(children: <Widget>[ ]),
NameByAddress( subtitle: Row(children: <Widget>[
wallet: WalletData(address: g1Wallet.address), NameByAddress(
), wallet: WalletData(address: g1Wallet.address),
]), ),
dense: false, ]),
isThreeLine: false, dense: false,
onTap: () { isThreeLine: false,
Navigator.pop(context); onTap: () {
Navigator.push( Navigator.pop(context);
context, Navigator.push(
MaterialPageRoute(builder: (context) { context,
walletsProfilesClass.address = g1Wallet.address; MaterialPageRoute(builder: (context) {
return WalletViewScreen( walletsProfilesClass.address = g1Wallet.address;
address: g1Wallet.address, return WalletViewScreen(
username: g1Wallet.username, address: g1Wallet.address,
); username: g1Wallet.username,
}), );
); }),
}), );
); });
} }
} }

View File

@ -1,4 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/cesium_plus.dart'; import 'package:gecko/providers/cesium_plus.dart';
import 'package:gecko/providers/duniter_indexer.dart'; import 'package:gecko/providers/duniter_indexer.dart';
@ -36,52 +38,50 @@ class TransactionTile extends StatelessWidget {
child: ListTile( child: ListTile(
key: keyTransaction(newKey), key: keyTransaction(newKey),
contentPadding: contentPadding:
const EdgeInsets.only(left: 20, right: 30, top: 15, bottom: 15), const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
leading: ClipOval( leading: ClipOval(
child: defaultAvatar(avatarSize), child: defaultAvatar(avatarSize),
), ),
title: Padding( title: Padding(
padding: const EdgeInsets.only(bottom: 5), padding: const EdgeInsets.only(bottom: 5),
child: Text(getShortPubkey(repository[1]), child: Text(getShortPubkey(repository[1]),
style: const TextStyle(fontSize: 18, fontFamily: 'Monospace')), style: scaledTextStyle(fontSize: 17, fontFamily: 'Monospace')),
), ),
subtitle: RichText( subtitle: RichText(
text: TextSpan( text: TextSpan(
style: TextStyle( style: scaledTextStyle(
fontSize: 17, fontSize: 17,
color: Colors.grey[700], color: Colors.grey[700],
), ),
children: <TextSpan>[ children: <TextSpan>[
TextSpan( TextSpan(text: dateForm, style: scaledTextStyle(fontSize: 16)),
text: dateForm,
),
if (username != null) if (username != null)
TextSpan( TextSpan(
text: ' · ', text: ' · ',
style: TextStyle( style: scaledTextStyle(
fontSize: 25, fontSize: 21,
color: Colors.grey[550], color: Colors.grey[550],
), ),
), ),
TextSpan( TextSpan(
text: username, text: username,
style: TextStyle( style: scaledTextStyle(
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
color: Colors.grey[600], color: Colors.grey[600],
fontSize: 19), fontSize: 16),
), ),
], ],
), ),
), ),
trailing: Text(finalAmount, trailing: Text(finalAmount,
style: TextStyle( style: scaledTextStyle(
fontSize: 18, fontSize: 17,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: repository[4] == 'RECEIVED' color: repository[4] == 'RECEIVED'
? Colors.green[700] ? Colors.green[700]
: Colors.blue[700]), : Colors.blue[700]),
textAlign: TextAlign.justify), textAlign: TextAlign.justify),
dense: false, dense: !isTall,
isThreeLine: false, isThreeLine: false,
onTap: () { onTap: () {
Navigator.push( Navigator.push(
@ -93,7 +93,6 @@ class TransactionTile extends StatelessWidget {
); );
}), }),
); );
// Navigator.pop(context);
}), }),
); );
} }

View File

@ -21,15 +21,14 @@ class UdUnitDisplay extends StatelessWidget {
children: [ children: [
Text( Text(
'ud'.tr(args: ['']), 'ud'.tr(args: ['']),
style: TextStyle( style: TextStyle(fontSize: size, color: color),
fontSize: isTall ? size : size * 0.9, color: color),
), ),
Column( Column(
children: [ children: [
Text( Text(
currencyName, currencyName,
style: TextStyle( style: TextStyle(
fontSize: (isTall ? size : size * 0.9) * 0.7, fontSize: size * 0.7,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: color), color: color),
), ),
@ -38,8 +37,6 @@ class UdUnitDisplay extends StatelessWidget {
) )
], ],
) )
: Text(currencyName, : Text(currencyName, style: TextStyle(fontSize: size, color: color));
style:
TextStyle(fontSize: isTall ? size : size * 0.9, color: color));
} }
} }

View File

@ -1,5 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:truncate/truncate.dart'; import 'package:truncate/truncate.dart';
@ -16,14 +16,12 @@ class WalletName extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double newSize = (wallet.name?.length ?? 0) <= 15 ? size : size - 2;
return Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ return Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
Text( Text(
truncate(wallet.name ?? '', 20), truncate(wallet.name ?? '', 20),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: scaledTextStyle(
fontSize: isTall ? newSize : newSize * 0.9, fontSize: size,
color: color, color: color,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,

View File

@ -1,6 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
@ -24,7 +25,7 @@ class WalletTile extends StatelessWidget {
final defaultWallet = myWalletProvider.getDefaultWallet(); final defaultWallet = myWalletProvider.getDefaultWallet();
return Padding( return Padding(
padding: const EdgeInsets.all(16), padding: EdgeInsets.all(scaleSize(11)),
child: GestureDetector( child: GestureDetector(
key: keyOpenWallet(repository.address), key: keyOpenWallet(repository.address),
onTap: () { onTap: () {
@ -37,7 +38,7 @@ class WalletTile extends StatelessWidget {
), ),
); );
}, },
child: SizedBox( child: ScaledSizedBox(
key: repository.number == 1 ? keyDragAndDrop : const Key('nothing'), key: repository.number == 1 ? keyDragAndDrop : const Key('nothing'),
child: ClipOvalShadow( child: ClipOvalShadow(
shadow: const Shadow( shadow: const Shadow(
@ -91,12 +92,12 @@ class WalletTile extends StatelessWidget {
children: [ children: [
Column( Column(
children: [ children: [
const SizedBox(height: 7), ScaledSizedBox(height: 5),
Opacity( Opacity(
opacity: 0.7, opacity: 0.7,
child: NameByAddress( child: NameByAddress(
wallet: repository, wallet: repository,
size: 20, size: 16,
color: color:
defaultWallet.address == repository.address defaultWallet.address == repository.address
? Colors.white ? Colors.white
@ -135,7 +136,7 @@ class BalanceBuilder extends StatelessWidget {
color: isDefault ? orangeC : yellowC, color: isDefault ? orangeC : yellowC,
child: Padding( child: Padding(
padding: padding:
const EdgeInsets.only(left: 5, right: 5, top: 38, bottom: 10), EdgeInsets.only(left: 5, right: 5, top: scaleSize(28), bottom: 6),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -143,7 +144,7 @@ class BalanceBuilder extends StatelessWidget {
opacity: 0.7, opacity: 0.7,
child: Balance( child: Balance(
address: address, address: address,
size: 16, size: 14,
color: isDefault ? Colors.white : Colors.black, color: isDefault ? Colors.white : Colors.black,
loadingColor: isDefault ? yellowC : orangeC), loadingColor: isDefault ? yellowC : orangeC),
) )

View File

@ -1,6 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/scale_functions.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart'; import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/my_wallets.dart'; import 'package:gecko/providers/my_wallets.dart';
@ -22,7 +23,8 @@ class WalletTileMembre extends StatelessWidget {
final myWalletProvider = Provider.of<MyWalletsProvider>(context); final myWalletProvider = Provider.of<MyWalletsProvider>(context);
final defaultWallet = myWalletProvider.getDefaultWallet(); final defaultWallet = myWalletProvider.getDefaultWallet();
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 70, vertical: 20), padding: EdgeInsets.symmetric(
horizontal: scaleSize(52), vertical: scaleSize(15)),
child: GestureDetector( child: GestureDetector(
key: keyOpenWallet(repository.address), key: keyOpenWallet(repository.address),
onTap: () { onTap: () {
@ -35,9 +37,9 @@ class WalletTileMembre extends StatelessWidget {
), ),
); );
}, },
child: SizedBox( child: ScaledSizedBox(
key: repository.number == 1 ? keyDragAndDrop : const Key('nothing'), key: repository.number == 1 ? keyDragAndDrop : const Key('nothing'),
height: 240, height: 180,
child: ClipOvalShadow( child: ClipOvalShadow(
shadow: const Shadow( shadow: const Shadow(
color: Colors.transparent, color: Colors.transparent,
@ -84,12 +86,12 @@ class WalletTileMembre extends StatelessWidget {
), ),
), ),
Positioned( Positioned(
left: 25, left: 20,
top: 25, top: 20,
child: Opacity( child: Opacity(
opacity: 0.6, opacity: 0.8,
child: Image.asset('assets/medal.png', child: Image.asset('assets/medal.png',
color: Colors.black, height: 40), color: orangeC, height: scaleSize(33)),
), ),
), ),
], ],
@ -101,12 +103,12 @@ class WalletTileMembre extends StatelessWidget {
isDefault: repository.address == defaultWallet.address), isDefault: repository.address == defaultWallet.address),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [ Row(mainAxisAlignment: MainAxisAlignment.center, children: [
Column(children: [ Column(children: [
const SizedBox(height: 10), ScaledSizedBox(height: 5),
Opacity( Opacity(
opacity: 0.7, opacity: 0.7,
child: NameByAddress( child: NameByAddress(
wallet: repository, wallet: repository,
size: 20, size: 18,
color: defaultWallet.address == repository.address color: defaultWallet.address == repository.address
? Colors.white ? Colors.white
: Colors.black, : Colors.black,
@ -116,8 +118,8 @@ class WalletTileMembre extends StatelessWidget {
]), ]),
]), ]),
Positioned( Positioned(
right: 25, right: scaleSize(12),
top: 25, top: scaleSize(18),
child: Opacity( child: Opacity(
opacity: 0.7, opacity: 0.7,
child: Certifications( child: Certifications(
@ -125,7 +127,7 @@ class WalletTileMembre extends StatelessWidget {
color: defaultWallet.address == repository.address color: defaultWallet.address == repository.address
? Colors.white ? Colors.white
: Colors.black, : Colors.black,
size: 18), size: 15),
), ),
), ),
]), ]),
@ -154,8 +156,8 @@ class BalanceBuilder extends StatelessWidget {
width: double.infinity, width: double.infinity,
color: isDefault ? orangeC : yellowC, color: isDefault ? orangeC : yellowC,
child: Padding( child: Padding(
padding: padding: EdgeInsets.only(
const EdgeInsets.only(left: 5, right: 5, top: 45, bottom: 15), left: 5, right: 5, top: scaleSize(27), bottom: scaleSize(11)),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -163,7 +165,7 @@ class BalanceBuilder extends StatelessWidget {
opacity: 0.7, opacity: 0.7,
child: Balance( child: Balance(
address: address, address: address,
size: 16, size: 15,
color: isDefault ? Colors.white : Colors.black, color: isDefault ? Colors.white : Colors.black,
loadingColor: isDefault ? yellowC : orangeC), loadingColor: isDefault ? yellowC : orangeC),
) )

View File

@ -1298,10 +1298,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: responsive_framework name: responsive_framework
sha256: e083346029b008335b008274c4d3fac5b9e0ca8796f201ed20884f579101d584 sha256: "23aa7be5d5136922df708f6ddccb5ec4e0eb8bc576c3f105f5093f31d6b68e50"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.2.0" version: "1.1.1"
rxdart: rxdart:
dependency: transitive dependency: transitive
description: description:
@ -1310,6 +1310,54 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.27.7" version: "0.27.7"
screen_brightness:
dependency: "direct main"
description:
name: screen_brightness
sha256: ed8da4a4511e79422fc1aa88138e920e4008cd312b72cdaa15ccb426c0faaedd
url: "https://pub.dev"
source: hosted
version: "0.2.2+1"
screen_brightness_android:
dependency: transitive
description:
name: screen_brightness_android
sha256: "3df10961e3a9e968a5e076fe27e7f4741fa8a1d3950bdeb48cf121ed529d0caf"
url: "https://pub.dev"
source: hosted
version: "0.1.0+2"
screen_brightness_ios:
dependency: transitive
description:
name: screen_brightness_ios
sha256: "99adc3ca5490b8294284aad5fcc87f061ad685050e03cf45d3d018fe398fd9a2"
url: "https://pub.dev"
source: hosted
version: "0.1.0"
screen_brightness_macos:
dependency: transitive
description:
name: screen_brightness_macos
sha256: "64b34e7e3f4900d7687c8e8fb514246845a73ecec05ab53483ed025bd4a899fd"
url: "https://pub.dev"
source: hosted
version: "0.1.0+1"
screen_brightness_platform_interface:
dependency: transitive
description:
name: screen_brightness_platform_interface
sha256: b211d07f0c96637a15fb06f6168617e18030d5d74ad03795dd8547a52717c171
url: "https://pub.dev"
source: hosted
version: "0.1.0"
screen_brightness_windows:
dependency: transitive
description:
name: screen_brightness_windows
sha256: "9261bf33d0fc2707d8cf16339ce25768100a65e70af0fcabaf032fc12408ba86"
url: "https://pub.dev"
source: hosted
version: "0.1.3"
scroll_to_index: scroll_to_index:
dependency: transitive dependency: transitive
description: description:

Some files were not shown because too many files have changed in this diff Show More