Merge branch 'dev'

This commit is contained in:
poka 2023-03-16 00:54:33 +01:00
commit f41443622a
19 changed files with 650 additions and 449 deletions

View File

@ -152,7 +152,7 @@
"canRenewCertInX": "You can renew\nthis certification\nin {}",
"executeATransfer": "Execute a transfer",
"executeTheTransfer": "Execute the transfer",
"doATransfer" : "Execute a\ntransfer",
"doATransfer": "Execute a\ntransfer",
"seconds": "{} seconds",
"minutes": "{} minutes",
"hours": "{} hours {}",
@ -199,13 +199,13 @@
"ud": "{}UD",
"chooseATargetWallet": "Choose a target wallet",
"thisMnemonicHasBeenCopiedToClipboard": "This mnemonic has been copied to clipboard",
"smithCantMigrateIdentity":"You can't migrate this identity while you're member of smith web",
"smithCantMigrateIdentity": "You can't migrate this identity while you're member of smith web",
"received": "Received",
"sent": "Sent",
"createIdentity": "Create a new \nidentity",
"memberAccountOf": "Account of {}",
"pasteAddress": "Paste address from\nclipboard",
"historyStart" :"Beginning of history",
"historyStart": "Beginning of history",
"blockchainStart": "Beginning of the ĞDev",
"networkSettings": "Network Settings",
"displaySettings": "Display Settings",
@ -215,6 +215,7 @@
"blockN": "block N°{}",
"thisIsNotAGoodCode": "This is not a good code",
"youHaveToBeConnectedToValidateChest": "You have to be connected\nto validate your chest",
"thisIdentityAlreadyExist": "This identity already exists"
"thisIdentityAlreadyExist": "This identity already exists",
"removedFromcontacts": "Removed from contacts",
"addedToContacts": "Added to contacts"
}

View File

@ -153,7 +153,7 @@
"canRenewCertInX": "Podrás renovar\nla certificación\nen {}",
"executeATransfer": "Ejecutar una transacción",
"executeTheTransfer": "Ejecutar la transacción",
"doATransfer" : "Hacer una\ntransacción",
"doATransfer": "Hacer una\ntransacción",
"seconds": "{} segundos",
"minutes": "{} minutos",
"hours": "{} horas {}",
@ -200,13 +200,13 @@
"ud": "{}DU",
"chooseATargetWallet": "Elige un monedero de destino",
"thisMnemonicHasBeenCopiedToClipboard": "This mnemonic has been copied to clipboard",
"smithCantMigrateIdentity":"You can't migrate this identity while you're member of smith web",
"smithCantMigrateIdentity": "You can't migrate this identity while you're member of smith web",
"received": "Received",
"sent": "Sent",
"createIdentity": "Create a new \nidentity",
"memberAccountOf": "Account of {}",
"pasteAddress": "Paste address from\nclipboard",
"historyStart" :"Beginning of history",
"historyStart": "Beginning of history",
"blockchainStart": "Comienzo de la ĞDev",
"networkSettings": "Parametros de red",
"displaySettings": "Parametros interficie",
@ -216,5 +216,7 @@
"blockN": "bloque N°{}",
"thisIsNotAGoodCode": "Este codígo no es valido",
"youHaveToBeConnectedToValidateChest": "Tienes que tener conneción\npara validar tu cofre",
"thisIdentityAlreadyExist": "Esta identidad ya existe"
}
"thisIdentityAlreadyExist": "Esta identidad ya existe",
"removedFromcontacts": "Removed from contacts",
"addedToContacts": "Added to contacts"
}

View File

@ -199,13 +199,13 @@
"ud": "{}DU",
"chooseATargetWallet": "Choisissez un portefeuille cible",
"thisMnemonicHasBeenCopiedToClipboard": "Cette phrase secrète viens d'être copié dans votre presse-papier.",
"smithCantMigrateIdentity":"Vous ne pouvez pas migrer cette identité\ntant que vous êtes dans la toile forgerons",
"smithCantMigrateIdentity": "Vous ne pouvez pas migrer cette identité\ntant que vous êtes dans la toile forgerons",
"received": "Reçus",
"sent": "Envoyés",
"createIdentity": "Créer sa nouvelle\nidentité",
"memberAccountOf": "Compte de {}",
"pasteAddress": "Coller l'adresse depuis\nle presse-papier",
"historyStart" :"Début de l'historique",
"historyStart": "Début de l'historique",
"blockchainStart": "Début de la ĞDev",
"networkSettings": "Connectivité réseau",
"displaySettings": "Affichage",
@ -215,5 +215,7 @@
"blockN": "bloc N°{}",
"thisIsNotAGoodCode": "Ce n'est pas le bon code",
"youHaveToBeConnectedToValidateChest": "Vous devez vous connecter à internet\npour valider votre coffre",
"thisIdentityAlreadyExist": "Cette identité existe déjà"
}
"thisIdentityAlreadyExist": "Cette identité existe déjà",
"removedFromcontacts": "Retiré des contact",
"addedToContacts": "Ajouté au contacts"
}

View File

@ -1,3 +1,5 @@
// ignore_for_file: use_build_context_synchronously
import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
@ -8,6 +10,7 @@ import 'package:jdenticon_dart/jdenticon_dart.dart';
import 'package:permission_handler/permission_handler.dart';
// import 'package:qrscan/qrscan.dart' as scanner;
import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:confetti/confetti.dart';
class WalletsProfilesProvider with ChangeNotifier {
WalletsProfilesProvider(this.address);
@ -21,6 +24,8 @@ class WalletsProfilesProvider with ChangeNotifier {
TextEditingController payAmount = TextEditingController();
TextEditingController payComment = TextEditingController();
num? _balance;
final centerController =
ConfettiController(duration: const Duration(milliseconds: 300));
Future<String> scan(context) async {
if (Platform.isAndroid || Platform.isIOS) {
@ -34,6 +39,10 @@ class WalletsProfilesProvider with ChangeNotifier {
return 'false';
}
if (isAddress(barcode.rawContent)) {
Navigator.popUntil(
context,
ModalRoute.withName('/'),
);
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
@ -133,8 +142,13 @@ class WalletsProfilesProvider with ChangeNotifier {
// log.d(profile.username);
if (isContact(profile.address)) {
await contactsBox.delete(profile.address);
snackMessage(homeContext,
message: 'removedFromcontacts'.tr(), duration: 4);
} else {
centerController.play();
await contactsBox.put(profile.address, profile);
// drawStar(Size(50, 50));
snackMessage(homeContext, message: 'addedToContacts'.tr(), duration: 4);
}
notifyListeners();
}

View File

@ -1,13 +1,14 @@
// ignore_for_file: must_be_immutable
import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/widgets_keys.dart';
import 'package:flutter/material.dart';
import 'package:gecko/providers/duniter_indexer.dart';
import 'package:gecko/widgets/bottom_app_bar.dart';
import 'package:gecko/widgets/header_profile.dart';
import 'package:gecko/widgets/history_query.dart';
import 'package:provider/provider.dart';
class ActivityScreen extends StatelessWidget with ChangeNotifier {
ActivityScreen({required this.address, required this.avatar, this.username})
@ -18,19 +19,35 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text('accountActivity'.tr()),
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: true);
return WillPopScope(
onWillPop: () {
duniterIndexer.fetchMoreCursor =
duniterIndexer.pageInfo = duniterIndexer.transBC = null;
return Future<bool>.value(true);
},
child: Scaffold(
appBar: AppBar(
elevation: 0,
toolbarHeight: 60 * ratio,
leading: IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () {
duniterIndexer.fetchMoreCursor =
duniterIndexer.pageInfo = duniterIndexer.transBC = null;
Navigator.of(context).pop();
}),
title: SizedBox(
height: 22,
child: Text('accountActivity'.tr()),
),
),
),
bottomNavigationBar: const GeckoBottomAppBar(),
body: Column(children: <Widget>[
HeaderProfile(address: address, username: username),
HistoryQuery(address: address),
]));
bottomNavigationBar: const GeckoBottomAppBar(),
body: Column(children: <Widget>[
HeaderProfile(address: address, username: username),
HistoryQuery(address: address),
])),
);
}
}

View File

@ -0,0 +1,62 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart';
import 'package:flutter/material.dart';
import 'package:gecko/providers/substrate_sdk.dart';
import 'package:provider/provider.dart';
class DebugScreen extends StatelessWidget {
const DebugScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final sub = Provider.of<SubstrateSdk>(context);
return Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(
toolbarHeight: 60 * ratio,
title: const SizedBox(
height: 22,
child: Text('Debug screen'),
)),
body: SafeArea(
child: Column(children: <Widget>[
const SizedBox(height: 40),
Center(
child: Column(
children: [
Text(
'node: ${sub.getConnectedEndpoint()}',
style: TextStyle(fontSize: 15, color: Colors.grey[700]),
),
const SizedBox(height: 15),
Text(
'blockN'.tr(args: [
sub.blocNumber.toString()
]), //'bloc N°${sub.blocNumber}',
style: TextStyle(fontSize: 15, color: Colors.grey[700]),
),
const SizedBox(height: 20),
SizedBox(
height: 60,
width: 250,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white, elevation: 4,
backgroundColor: orangeC, // foreground
),
onPressed: () async => await sub.spawnBlock(),
child: const Text(
'Spawn a bloc',
style: TextStyle(
fontSize: 20, fontWeight: FontWeight.w600),
),
),
),
],
),
),
]),
));
}
}

View File

@ -1,9 +1,7 @@
// ignore_for_file: use_build_context_synchronously
import 'package:bubble/bubble.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/g1_wallets_list.dart';
@ -12,21 +10,18 @@ import 'package:gecko/providers/chest_provider.dart';
import 'package:gecko/providers/duniter_indexer.dart';
import 'package:gecko/providers/home.dart';
import 'package:gecko/providers/substrate_sdk.dart';
import 'package:gecko/providers/wallets_profiles.dart';
import 'package:flutter/material.dart';
import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/widgets/bubble_speak.dart';
import 'package:gecko/widgets/commons/animated_text.dart';
import 'package:gecko/widgets/commons/common_elements.dart';
import 'package:gecko/screens/myWallets/restore_chest.dart';
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'package:gecko/screens/myWallets/wallets_home.dart';
import 'package:gecko/screens/onBoarding/1.dart';
import 'package:gecko/screens/search.dart';
import 'package:gecko/screens/settings.dart';
import 'package:gecko/widgets/drawer.dart';
import 'package:gecko/widgets/home_buttons.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:provider/provider.dart';
import 'package:gecko/screens/my_contacts.dart';
class HomeScreen extends StatefulWidget {
const HomeScreen({Key? key}) : super(key: key);
@ -80,24 +75,10 @@ class _HomeScreenState extends State<HomeScreen> {
duniterIndexer.getValidIndexerEndpoint();
await homeProviderInit.getValidEndpoints();
// await configBox.delete('isCacheChecked');
if (configBox.get('isCacheChecked') == null) {
configBox.put('isCacheChecked', false);
}
// log.d(await configBox.get('endpoint'));
// var connectivityResult =
// await (Connectivity().checkConnectivity());
// if (connectivityResult != ConnectivityResult.mobile &&
// connectivityResult != ConnectivityResult.wifi) {
// homeProvider.changeMessage(
// "notConnectedToInternet".tr(), 0);
// sub.nodeConnected = false;
// }
// Améliore ce code car il y a un bug: parfois l'app se croit hors ligne, alors que c'est faux, le téléphone est bien connecté à internet
// (GPT vscode extension fixed it for my...)
HomeProvider homeProvider =
Provider.of<HomeProvider>(context, listen: false);
Connectivity()
@ -121,7 +102,6 @@ class _HomeScreenState extends State<HomeScreen> {
}
}
});
// await sub.connectNode(ctx);
}
// _duniterIndexer.checkIndexerEndpointBackground();
});
@ -144,83 +124,15 @@ class _HomeScreenState extends State<HomeScreen> {
}
return Scaffold(
resizeToAvoidBottomInset: false,
drawer: Drawer(
child: Column(
children: <Widget>[
Expanded(
child: ListView(padding: EdgeInsets.zero, children: <Widget>[
DrawerHeader(
decoration: const BoxDecoration(
color: orangeC,
),
child: Column(children: const <Widget>[
SizedBox(height: 0),
Image(
image: AssetImage('assets/icon/gecko_final.png'),
height: 130),
]),
),
ListTile(
key: keyParameters,
title: Text('parameters'.tr()),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return SettingsScreen();
}),
);
},
),
if (isWalletsExists)
ListTile(
key: keyContacts,
title: Text('contactsManagement'.tr()),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const ContactsScreen();
}),
);
},
),
])),
Align(
alignment: FractionalOffset.bottomCenter,
child: 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)
],
),
),
drawer: MainDrawer(isWalletsExists: isWalletsExists),
backgroundColor: const Color(0xffF9F9F1),
body: isWalletsExists ? geckHome(context) : welcomeHome(context));
}
}
Widget geckHome(context) {
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
final homeProvider = Provider.of<HomeProvider>(context, listen: false);
Provider.of<ChestProvider>(context);
WalletsProfilesProvider historyProvider =
Provider.of<WalletsProfilesProvider>(context);
final statusBarHeight = MediaQuery.of(context).padding.top;
return Container(
decoration: const BoxDecoration(
@ -299,172 +211,7 @@ Widget geckHome(context) {
],
),
),
child: Column(children: <Widget>[
const Spacer(),
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
Column(children: <Widget>[
Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
boxShadow: [
BoxShadow(
blurRadius: 2,
offset: Offset(1, 1.5),
spreadRadius: 0.5)
],
),
child: ClipOval(
child: Material(
color: orangeC, // button color
child: InkWell(
key: keyOpenSearch,
child: Padding(
padding: const EdgeInsets.all(18),
child: Image(
image:
const AssetImage('assets/home/loupe.png'),
height: 62 * ratio),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const SearchScreen();
}),
);
}),
),
),
),
const SizedBox(height: 12),
Text(
"searchWallet".tr(),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 15 * ratio,
fontWeight: FontWeight.w500),
)
]),
const SizedBox(width: 120),
Column(children: <Widget>[
Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
boxShadow: [
BoxShadow(
blurRadius: 2,
offset: Offset(1, 1.5),
spreadRadius: 0.5)
],
),
child: ClipOval(
key: keyOpenWalletsHomme,
child: Material(
color: homeProvider.isWalletBoxInit
? orangeC
: Colors.grey[500], // button color
child: InkWell(
onTap: !homeProvider.isWalletBoxInit
? null
: () async {
WalletData? defaultWallet =
myWalletProvider.getDefaultWallet();
String? pin;
if (myWalletProvider.pinCode == '') {
pin = await Navigator.push(
context,
MaterialPageRoute(
builder: (homeContext) {
return UnlockingWallet(
wallet: defaultWallet);
},
),
);
}
if (pin != null ||
myWalletProvider.pinCode != '') {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const WalletsHome();
}),
);
}
// log.d(_myWalletProvider.pinCode);
// Navigator.pushNamed(
// context, '/mywallets')));
},
child: Padding(
padding: const EdgeInsets.all(18),
child: Image(
image: const AssetImage(
'assets/home/wallet.png'),
height: 68 * ratio))),
),
),
),
const SizedBox(height: 12),
Text(
"manageWallets".tr(),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 15 * ratio,
fontWeight: FontWeight.w500),
)
])
]),
Padding(
padding: EdgeInsets.only(top: 35 * ratio),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Column(children: <Widget>[
Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
boxShadow: [
BoxShadow(
blurRadius: 2,
offset: Offset(1, 1.5),
spreadRadius: 0.5)
],
),
child: ClipOval(
child: Material(
color: orangeC, // button color
child: InkWell(
child: Padding(
padding: const EdgeInsets.all(18),
child: Image(
image: const AssetImage(
'assets/home/qrcode.png'),
height: 68 * ratio)),
onTap: () async {
await historyProvider.scan(context);
}),
),
),
),
const SizedBox(height: 12),
Text(
"scanQRCode".tr(),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 15 * ratio,
fontWeight: FontWeight.w500),
)
])
]),
),
SizedBox(height: isTall ? 80 : 40)
]),
child: const HomeButtons(),
),
)
]),
@ -561,7 +308,7 @@ Widget welcomeHome(context) {
),
Positioned(
left: 180,
child: bubbleSpeak("noLizard".tr()),
child: BubbleSpeak(text: "noLizard".tr()),
),
const Positioned(
left: 200,
@ -635,19 +382,3 @@ Widget welcomeHome(context) {
]),
);
}
Widget bubbleSpeak(String text, {double? long, Key? textKey}) {
return Bubble(
padding: long == null
? const BubbleEdges.all(20)
: BubbleEdges.symmetric(horizontal: long, vertical: 30),
elevation: 5,
color: backgroundColor,
child: Text(
text,
key: textKey,
style: const TextStyle(
color: Colors.black, fontSize: 21, fontWeight: FontWeight.w400),
),
);
}

View File

@ -2,7 +2,6 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart';
import 'package:flutter/material.dart';
import 'package:gecko/providers/duniter_indexer.dart';
import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/widgets/bottom_app_bar.dart';
import 'package:gecko/widgets/commons/offline_info.dart';
@ -14,12 +13,11 @@ class ContactsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
WalletsProfilesProvider walletsProfilesClass =
Provider.of<WalletsProfilesProvider>(context, listen: true);
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
Provider.of<WalletsProfilesProvider>(context, listen: true);
double avatarSize = 55;
final myContacts = contactsBox.toMap().values.toList();
// Order contacts by username
myContacts.sort((p1, p2) {
return Comparable.compare(p1.username?.toLowerCase() ?? 'zz',
p2.username?.toLowerCase() ?? 'zz');
@ -39,11 +37,7 @@ class ContactsScreen extends StatelessWidget {
bottomNavigationBar: const GeckoBottomAppBar(),
body: SafeArea(
child: Stack(children: [
ContactsList(
myContacts: myContacts,
avatarSize: avatarSize,
walletsProfilesClass: walletsProfilesClass,
duniterIndexer: duniterIndexer),
ContactsList(myContacts: myContacts, avatarSize: avatarSize),
const OfflineInfo(),
]),
),

View File

@ -1,5 +1,8 @@
// ignore_for_file: file_names
import 'dart:math';
import 'package:confetti/confetti.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
@ -12,36 +15,61 @@ class OnboardingStepEleven extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(
toolbarHeight: 60 * ratio,
title: SizedBox(
height: 22,
child: Text(
'allGood'.tr(),
style: const TextStyle(fontWeight: FontWeight.w600),
final conffetiController =
ConfettiController(duration: const Duration(milliseconds: 300));
conffetiController.play();
return WillPopScope(
onWillPop: () {
return Future<bool>.value(false);
},
child: Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(
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(
child: Column(children: <Widget>[
const SizedBox(height: 40),
BuildText(text: "yourChestAndWalletWereCreatedSuccessfully".tr()),
SizedBox(height: isTall ? 20 : 10),
Image.asset(
'assets/onBoarding/gecko-clin.gif',
height: isTall ? 400 : 300,
),
Expanded(
child: Align(
alignment: Alignment.bottomCenter,
child: finishButton(context)),
),
const SizedBox(height: 40),
]),
));
extendBodyBehindAppBar: true,
body: SafeArea(
child: Stack(children: [
Column(children: <Widget>[
const SizedBox(height: 40),
BuildText(
text: "yourChestAndWalletWereCreatedSuccessfully".tr()),
SizedBox(height: isTall ? 20 : 10),
Image.asset(
'assets/onBoarding/gecko-clin.gif',
height: isTall ? 400 : 300,
),
Expanded(
child: Align(
alignment: Alignment.bottomCenter,
child: finishButton(context)),
),
const SizedBox(height: 40),
]),
Align(
alignment: Alignment.topCenter,
child: ConfettiWidget(
confettiController: conffetiController,
blastDirection: pi / 2,
maxBlastForce: 5,
minBlastForce: 1,
emissionFrequency: 0.01,
numberOfParticles: 10,
shouldLoop: false,
gravity: 0.1,
),
),
]),
)),
);
}
}

View File

@ -1,5 +1,8 @@
// ignore_for_file: use_build_context_synchronously
import 'dart:math';
import 'package:confetti/confetti.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/services.dart';
@ -61,6 +64,16 @@ class WalletViewScreen extends StatelessWidget {
actions: [
Row(
children: [
ConfettiWidget(
confettiController: walletProfile.centerController,
blastDirection: pi / 2,
maxBlastForce: 7,
minBlastForce: 3,
emissionFrequency: 0,
numberOfParticles: 7,
shouldLoop: false,
gravity: 0.001,
),
Consumer<WalletsProfilesProvider>(
builder: (context, walletProfile, _) {
return IconButton(

View File

@ -62,10 +62,6 @@ class GeckoBottomAppBar extends StatelessWidget {
iconSize: 70,
icon: const Image(image: AssetImage('assets/qrcode-scan.png')),
onPressed: () async {
Navigator.popUntil(
context,
ModalRoute.withName('/'),
);
historyProvider.scan(homeContext);
},
),

View File

@ -0,0 +1,33 @@
import 'package:bubble/bubble.dart';
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
class BubbleSpeak extends StatelessWidget {
const BubbleSpeak({
required this.text,
this.long,
this.textKey,
Key? key,
}) : super(key: key);
final String text;
final double? long;
final Key? textKey;
@override
Widget build(BuildContext context) {
return Bubble(
padding: long == null
? const BubbleEdges.all(20)
: BubbleEdges.symmetric(horizontal: long, vertical: 30),
elevation: 5,
color: backgroundColor,
child: Text(
text,
key: textKey,
style: const TextStyle(
color: Colors.black, fontSize: 21, fontWeight: FontWeight.w400),
),
);
}
}

View File

@ -11,29 +11,30 @@ import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/screens/wallet_view.dart';
import 'package:gecko/widgets/balance.dart';
import 'package:gecko/widgets/name_by_address.dart';
import 'package:provider/provider.dart';
class ContactsList extends StatelessWidget {
const ContactsList({
Key? key,
required this.myContacts,
required this.avatarSize,
required this.walletsProfilesClass,
required this.duniterIndexer,
}) : super(key: key);
final List<G1WalletsList> myContacts;
final double avatarSize;
final WalletsProfilesProvider walletsProfilesClass;
final DuniterIndexer duniterIndexer;
@override
Widget build(BuildContext context) {
final walletsProfilesClass =
Provider.of<WalletsProfilesProvider>(context, listen: false);
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SizedBox(height: 20),
const SizedBox(height: 20, width: double.infinity),
if (myContacts.isEmpty)
Text('noContacts'.tr())
else

101
lib/widgets/drawer.dart Normal file
View File

@ -0,0 +1,101 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/screens/debug_screen.dart';
import 'package:gecko/screens/my_contacts.dart';
import 'package:gecko/screens/settings.dart';
class MainDrawer extends StatelessWidget {
const MainDrawer({
Key? key,
required this.isWalletsExists,
}) : super(key: key);
final bool isWalletsExists;
@override
Widget build(BuildContext context) {
return Drawer(
child: Column(
children: <Widget>[
Expanded(
child: ListView(padding: EdgeInsets.zero, children: <Widget>[
DrawerHeader(
decoration: const BoxDecoration(
color: orangeC,
),
child: Column(children: const <Widget>[
SizedBox(height: 0),
Image(
image: AssetImage('assets/icon/gecko_final.png'),
height: 130),
]),
),
ListTile(
key: keyParameters,
title: Text('parameters'.tr()),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return SettingsScreen();
}),
);
},
),
if (isWalletsExists)
ListTile(
key: keyContacts,
title: Text('contactsManagement'.tr()),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const ContactsScreen();
}),
);
},
),
if (kDebugMode)
ListTile(
key: keyParameters,
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

@ -4,7 +4,7 @@ import 'package:gecko/globals.dart';
import 'package:gecko/models/queries_indexer.dart';
import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/duniter_indexer.dart';
import 'package:gecko/widgets/transaction_tile.dart';
import 'package:gecko/widgets/history_view.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart';
@ -116,11 +116,14 @@ class HistoryQuery extends StatelessWidget {
child: ListView(
key: keyListTransactions,
controller: scrollController,
children: <Widget>[historyView(context, result)],
children: <Widget>[HistoryView(result: result)],
),
),
),
onNotification: (dynamic t) {
if (duniterIndexer.pageInfo == null) {
duniterIndexer.reload();
}
if (t is ScrollEndNotification &&
scrollController.position.pixels >=
scrollController.position.maxScrollExtent * 0.7 &&
@ -136,100 +139,4 @@ class HistoryQuery extends StatelessWidget {
)),
);
}
Widget historyView(context, result) {
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
int keyID = 0;
const double avatarSize = 200;
bool isMigrationPassed = false;
List<String> pastDelimiters = [];
return duniterIndexer.transBC == null
? Column(children: <Widget>[
const SizedBox(height: 50),
Text(
"noTransactionToDisplay".tr(),
style: const TextStyle(fontSize: 18),
)
])
: Column(children: <Widget>[
Column(
children: duniterIndexer.transBC!.map((repository) {
final answer = computeHistoryView(repository);
pastDelimiters.add(answer['dateDelimiter']);
bool isMigrationTime = false;
if (answer['isMigrationTime'] && !isMigrationPassed) {
isMigrationPassed = true;
isMigrationTime = true;
}
return Column(children: <Widget>[
if (isMigrationTime)
Padding(
padding: const EdgeInsets.symmetric(vertical: 30),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Image(
image: AssetImage('assets/party.png'), height: 40),
const SizedBox(width: 40),
Text(
'blockchainStart'.tr(),
style: const TextStyle(
fontSize: 25,
color: Colors.blueAccent,
fontWeight: FontWeight.w500),
),
const SizedBox(width: 40),
const Image(
image: AssetImage('assets/party.png'), height: 40),
],
),
),
// if ((countsDelimiter[answer['dateDelimiter']] ?? 0) >= 1)
if (pastDelimiters.length == 1 ||
pastDelimiters.length >= 2 &&
!(pastDelimiters[pastDelimiters.length - 2] ==
answer['dateDelimiter']))
Padding(
padding: const EdgeInsets.symmetric(vertical: 30),
child: Text(
answer['dateDelimiter'],
style: const TextStyle(
fontSize: 23,
color: orangeC,
fontWeight: FontWeight.w300),
),
),
TransactionTile(
keyID: keyID,
avatarSize: avatarSize,
repository: repository,
dateForm: answer['dateForm'],
finalAmount: answer['finalAmount'],
duniterIndexer: duniterIndexer,
context: context),
]);
}).toList()),
if (result.isLoading && duniterIndexer.pageInfo!['hasPreviousPage'])
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
CircularProgressIndicator(),
],
),
if (!duniterIndexer.pageInfo!['hasNextPage'])
Column(
children: <Widget>[
const SizedBox(height: 15),
Text("historyStart".tr(),
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 20)),
const SizedBox(height: 15)
],
)
]);
}
}

View File

@ -0,0 +1,112 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/providers/duniter_indexer.dart';
import 'package:gecko/widgets/transaction_tile.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart';
class HistoryView extends StatelessWidget {
const HistoryView({
Key? key,
required this.result,
}) : super(key: key);
final QueryResult result;
@override
Widget build(BuildContext context) {
final duniterIndexer = Provider.of<DuniterIndexer>(context, listen: false);
int keyID = 0;
const double avatarSize = 200;
bool isMigrationPassed = false;
List<String> pastDelimiters = [];
return duniterIndexer.transBC == null
? Column(children: <Widget>[
const SizedBox(height: 50),
Text(
"noTransactionToDisplay".tr(),
style: const TextStyle(fontSize: 18),
)
])
: Column(children: <Widget>[
Column(
children: duniterIndexer.transBC!.map((repository) {
final answer = computeHistoryView(repository);
pastDelimiters.add(answer['dateDelimiter']);
bool isMigrationTime = false;
if (answer['isMigrationTime'] && !isMigrationPassed) {
isMigrationPassed = true;
isMigrationTime = true;
}
return Column(children: <Widget>[
if (isMigrationTime)
Padding(
padding: const EdgeInsets.symmetric(vertical: 30),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Image(
image: AssetImage('assets/party.png'), height: 40),
const SizedBox(width: 40),
Text(
'blockchainStart'.tr(),
style: const TextStyle(
fontSize: 25,
color: Colors.blueAccent,
fontWeight: FontWeight.w500),
),
const SizedBox(width: 40),
const Image(
image: AssetImage('assets/party.png'), height: 40),
],
),
),
// if ((countsDelimiter[answer['dateDelimiter']] ?? 0) >= 1)
if (pastDelimiters.length == 1 ||
pastDelimiters.length >= 2 &&
!(pastDelimiters[pastDelimiters.length - 2] ==
answer['dateDelimiter']))
Padding(
padding: const EdgeInsets.symmetric(vertical: 30),
child: Text(
answer['dateDelimiter'],
style: const TextStyle(
fontSize: 23,
color: orangeC,
fontWeight: FontWeight.w300),
),
),
TransactionTile(
keyID: keyID,
avatarSize: avatarSize,
repository: repository,
dateForm: answer['dateForm'],
finalAmount: answer['finalAmount'],
duniterIndexer: duniterIndexer,
context: context),
]);
}).toList()),
if (result.isLoading && duniterIndexer.pageInfo!['hasPreviousPage'])
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const <Widget>[
CircularProgressIndicator(),
],
),
if (!duniterIndexer.pageInfo!['hasNextPage'])
Column(
children: <Widget>[
const SizedBox(height: 15),
Text("historyStart".tr(),
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 20)),
const SizedBox(height: 15)
],
)
]);
}
}

View File

@ -0,0 +1,179 @@
// ignore_for_file: use_build_context_synchronously
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/home.dart';
import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'package:gecko/screens/myWallets/wallets_home.dart';
import 'package:gecko/screens/search.dart';
import 'package:provider/provider.dart';
class HomeButtons extends StatelessWidget {
const HomeButtons({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
final homeProvider = Provider.of<HomeProvider>(context, listen: false);
final historyProvider = Provider.of<WalletsProfilesProvider>(context);
return Column(children: <Widget>[
const Spacer(),
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
Column(children: <Widget>[
Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
boxShadow: [
BoxShadow(
blurRadius: 2, offset: Offset(1, 1.5), spreadRadius: 0.5)
],
),
child: ClipOval(
child: Material(
color: orangeC, // button color
child: InkWell(
key: keyOpenSearch,
child: Padding(
padding: const EdgeInsets.all(18),
child: Image(
image: const AssetImage('assets/home/loupe.png'),
height: 62 * ratio),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const SearchScreen();
}),
);
}),
),
),
),
const SizedBox(height: 12),
Text(
"searchWallet".tr(),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 15 * ratio,
fontWeight: FontWeight.w500),
)
]),
const SizedBox(width: 120),
Column(children: <Widget>[
Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
boxShadow: [
BoxShadow(
blurRadius: 2, offset: Offset(1, 1.5), spreadRadius: 0.5)
],
),
child: ClipOval(
key: keyOpenWalletsHomme,
child: Material(
color: homeProvider.isWalletBoxInit
? orangeC
: Colors.grey[500], // button color
child: InkWell(
onTap: !homeProvider.isWalletBoxInit
? null
: () async {
WalletData? defaultWallet =
myWalletProvider.getDefaultWallet();
String? pin;
if (myWalletProvider.pinCode == '') {
pin = await Navigator.push(
context,
MaterialPageRoute(
builder: (homeContext) {
return UnlockingWallet(
wallet: defaultWallet);
},
),
);
}
if (pin != null || myWalletProvider.pinCode != '') {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const WalletsHome();
}),
);
}
},
child: Padding(
padding: const EdgeInsets.all(18),
child: Image(
image: const AssetImage('assets/home/wallet.png'),
height: 68 * ratio))),
),
),
),
const SizedBox(height: 12),
Text(
"manageWallets".tr(),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 15 * ratio,
fontWeight: FontWeight.w500),
)
])
]),
Padding(
padding: EdgeInsets.only(top: 35 * ratio),
child:
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
Column(children: <Widget>[
Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
boxShadow: [
BoxShadow(
blurRadius: 2, offset: Offset(1, 1.5), spreadRadius: 0.5)
],
),
child: ClipOval(
child: Material(
color: orangeC, // button color
child: InkWell(
child: Padding(
padding: const EdgeInsets.all(18),
child: Image(
image: const AssetImage('assets/home/qrcode.png'),
height: 68 * ratio)),
onTap: () async {
await historyProvider.scan(context);
}),
),
),
),
const SizedBox(height: 12),
Text(
"scanQRCode".tr(),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 15 * ratio,
fontWeight: FontWeight.w500),
)
])
]),
),
SizedBox(height: isTall ? 80 : 40)
]);
}
}

View File

@ -265,6 +265,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.17.0"
confetti:
dependency: "direct main"
description:
name: confetti
sha256: "979aafde2428c53947892c95eb244466c109c129b7eee9011f0a66caaca52267"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
connectivity_plus:
dependency: "direct main"
description:

View File

@ -65,6 +65,7 @@ dependencies:
hive_generator: ^2.0.0
riverpod: ^2.1.1
tutorial_coach_mark: ^1.2.4
confetti: ^0.7.0
dev_dependencies:
# flutter_launcher_icons: ^0.9.2
@ -110,5 +111,4 @@ flutter:
- assets/onBoarding/
- assets/onBoarding/progress_bar/
- assets/walletOptions/
- sounds/
- .env
- sounds/