Peer-programming with Hugo: Copy pubkeys on tap and display notif for it. Improve pubkeys fonts
This commit is contained in:
parent
3bf3f85b9c
commit
d80b1190ae
|
@ -28,6 +28,8 @@ Future<void> main() async {
|
||||||
await _homeProvider.createDefaultAvatar();
|
await _homeProvider.createDefaultAvatar();
|
||||||
appVersion = await _homeProvider.getAppVersion();
|
appVersion = await _homeProvider.getAppVersion();
|
||||||
prefs = await SharedPreferences.getInstance();
|
prefs = await SharedPreferences.getInstance();
|
||||||
|
final HiveStore _store =
|
||||||
|
await HiveStore.open(path: '${appPath.path}/gqlCache');
|
||||||
|
|
||||||
String _randomEndpoint;
|
String _randomEndpoint;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -52,21 +54,20 @@ Future<void> main() async {
|
||||||
options.dsn =
|
options.dsn =
|
||||||
'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110';
|
'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110';
|
||||||
},
|
},
|
||||||
appRunner: () => runApp(Gecko(_randomEndpoint)),
|
appRunner: () => runApp(Gecko(_randomEndpoint, _store)),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
print('Debug mode enabled: No sentry alerte');
|
print('Debug mode enabled: No sentry alerte');
|
||||||
|
|
||||||
runApp(Gecko(
|
runApp(Gecko(_randomEndpoint, _store));
|
||||||
_randomEndpoint,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class Gecko extends StatelessWidget {
|
class Gecko extends StatelessWidget {
|
||||||
Gecko(this.randomEndpoint);
|
Gecko(this.randomEndpoint, this._store);
|
||||||
final String randomEndpoint;
|
final String randomEndpoint;
|
||||||
|
final HiveStore _store;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -76,7 +77,7 @@ class Gecko extends StatelessWidget {
|
||||||
|
|
||||||
final _client = ValueNotifier(
|
final _client = ValueNotifier(
|
||||||
GraphQLClient(
|
GraphQLClient(
|
||||||
cache: GraphQLCache(store: null),
|
cache: GraphQLCache(store: _store),
|
||||||
link: _httpLink,
|
link: _httpLink,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -9,7 +9,6 @@ import 'dart:math';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
class HistoryProvider with ChangeNotifier {
|
class HistoryProvider with ChangeNotifier {
|
||||||
// String pubkey = 'D2meevcAHFTS2gQMvmRW5Hzi25jDdikk4nC4u1FkwRaU'; // For debug
|
|
||||||
String pubkey = '';
|
String pubkey = '';
|
||||||
HistoryProvider(this.pubkey);
|
HistoryProvider(this.pubkey);
|
||||||
final TextEditingController outputPubkey = new TextEditingController();
|
final TextEditingController outputPubkey = new TextEditingController();
|
||||||
|
@ -63,8 +62,10 @@ class HistoryProvider with ChangeNotifier {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pi: D2meevcAHFTS2gQMvmRW5Hzi25jDdikk4nC4u1FkwRaU // For debug
|
||||||
// Boris: JE6mkuzSpT3ePciCPRTpuMT9fqPUVVLJz2618d33p7tn
|
// Boris: JE6mkuzSpT3ePciCPRTpuMT9fqPUVVLJz2618d33p7tn
|
||||||
// Matograine portefeuille: 9p5nHsES6xujFR7pw2yGy4PLKKHgWsMvsDHaHF64Uj25
|
// Matograine portefeuille: 9p5nHsES6xujFR7pw2yGy4PLKKHgWsMvsDHaHF64Uj25.
|
||||||
|
// Lion simone: 78jhpprYkMNF6i5kQPXfkAVBpd2aqcpieNsXTSW4c21f
|
||||||
|
|
||||||
List parseHistory(txs, _pubkey) {
|
List parseHistory(txs, _pubkey) {
|
||||||
// print(txs);
|
// print(txs);
|
||||||
|
@ -162,7 +163,7 @@ class HistoryProvider with ChangeNotifier {
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
snackNode(context) {
|
void snackNode(context) {
|
||||||
if (isFirstBuild) {
|
if (isFirstBuild) {
|
||||||
String _message;
|
String _message;
|
||||||
if (endPointGVA == 'HS') {
|
if (endPointGVA == 'HS') {
|
||||||
|
|
|
@ -26,11 +26,9 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
Future importWallet() async {}
|
Future importWallet() async {}
|
||||||
|
|
||||||
Map getAllWalletsNames() {
|
Map getAllWalletsNames() {
|
||||||
print(listWallets);
|
|
||||||
if (listWallets.isNotEmpty) {
|
if (listWallets.isNotEmpty) {
|
||||||
listWallets.clear();
|
listWallets.clear();
|
||||||
}
|
}
|
||||||
print(walletsDirectory.path);
|
|
||||||
|
|
||||||
// int i = 0;
|
// int i = 0;
|
||||||
walletsDirectory
|
walletsDirectory
|
||||||
|
@ -39,7 +37,6 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
String _name = wallet.path.split('/').last;
|
String _name = wallet.path.split('/').last;
|
||||||
List _pubkeyList = File(wallet.path + '/pubkey').readAsLinesSync();
|
List _pubkeyList = File(wallet.path + '/pubkey').readAsLinesSync();
|
||||||
String _pubkey = _pubkeyList[0];
|
String _pubkey = _pubkeyList[0];
|
||||||
print("$_name: $_pubkey");
|
|
||||||
listWallets[_name] = _pubkey;
|
listWallets[_name] = _pubkey;
|
||||||
// i++;
|
// i++;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,6 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
|
|
||||||
Future readLocalWallet(String _name, String _pin) async {
|
Future readLocalWallet(String _name, String _pin) async {
|
||||||
isWalletUnlock = false;
|
isWalletUnlock = false;
|
||||||
print('NOM: ' + _name);
|
|
||||||
try {
|
try {
|
||||||
File _walletFile = File('${walletsDirectory.path}/$_name/wallet.dewif');
|
File _walletFile = File('${walletsDirectory.path}/$_name/wallet.dewif');
|
||||||
String _localDewif = await _walletFile.readAsString();
|
String _localDewif = await _walletFile.readAsString();
|
||||||
|
@ -204,9 +203,15 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
final walletFile = File('${walletNameDirectory.path}/wallet.dewif');
|
final walletFile = File('${walletNameDirectory.path}/wallet.dewif');
|
||||||
|
|
||||||
walletFile.writeAsString('${_newWalletFile.dewif}');
|
walletFile.writeAsString('${_newWalletFile.dewif}');
|
||||||
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
|
||||||
return _name;
|
return _name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snackCopyKey(context) {
|
||||||
|
final snackBar = SnackBar(
|
||||||
|
content:
|
||||||
|
Text("Cette clé publique a été copié dans votre presse-papier."),
|
||||||
|
duration: Duration(seconds: 2));
|
||||||
|
Scaffold.of(context).showSnackBar(snackBar);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
_historyProvider.snackNode(context);
|
_historyProvider.snackNode(context);
|
||||||
});
|
});
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
floatingActionButton: Container(
|
floatingActionButton: Container(
|
||||||
height: 80.0,
|
height: 80.0,
|
||||||
|
@ -78,16 +79,17 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
disabledBorder: InputBorder.none,
|
disabledBorder: InputBorder.none,
|
||||||
),
|
),
|
||||||
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)),
|
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)),
|
||||||
if (_historyProvider.pubkey != '') historyQuery(context),
|
if (_historyProvider.pubkey != '')
|
||||||
|
historyQuery(context, _historyProvider),
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
historyQuery(context) {
|
Widget historyQuery(context, _historyProvider) {
|
||||||
print("I'M HERE 1");
|
|
||||||
_pubkeyFocus.unfocus();
|
_pubkeyFocus.unfocus();
|
||||||
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
// HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
||||||
CesiumPlusProvider _cesiumPlusProvider =
|
CesiumPlusProvider _cesiumPlusProvider =
|
||||||
Provider.of<CesiumPlusProvider>(context);
|
Provider.of<CesiumPlusProvider>(context);
|
||||||
|
print("I'M HERE 1");
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
@ -104,8 +106,10 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
),
|
),
|
||||||
builder: (QueryResult result, {fetchMore, refetch}) {
|
builder: (QueryResult result, {fetchMore, refetch}) {
|
||||||
print("I'M HERE 2 !");
|
print("I'M HERE 2 !");
|
||||||
|
print(result.source.isEager);
|
||||||
|
|
||||||
if (result.isLoading && result.data == null) {
|
if (result.isLoading && result.data == null) {
|
||||||
|
print("I'M HERE 3 !");
|
||||||
return const Center(
|
return const Center(
|
||||||
child: CircularProgressIndicator(),
|
child: CircularProgressIndicator(),
|
||||||
);
|
);
|
||||||
|
|
|
@ -59,7 +59,8 @@ class GenerateWalletsScreen extends StatelessWidget {
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14.0,
|
fontSize: 14.0,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontWeight: FontWeight.bold)),
|
fontWeight: FontWeight.bold,
|
||||||
|
fontFamily: 'Monospace')),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
toolTips(_toolTipSentence, 'Phrase de restauration:',
|
toolTips(_toolTipSentence, 'Phrase de restauration:',
|
||||||
"Notez et gardez cette phrase précieusement sur un papier, elle vous servira à restaurer votre portefeuille sur un autre appareil"),
|
"Notez et gardez cette phrase précieusement sur un papier, elle vous servira à restaurer votre portefeuille sur un autre appareil"),
|
||||||
|
|
|
@ -7,6 +7,7 @@ import 'package:gecko/screens/myWallets/changePin.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
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';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class WalletOptions extends StatelessWidget with ChangeNotifier {
|
class WalletOptions extends StatelessWidget with ChangeNotifier {
|
||||||
|
@ -15,7 +16,7 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
||||||
String walletName;
|
String walletName;
|
||||||
|
|
||||||
StreamController<ErrorAnimationType> errorController;
|
StreamController<ErrorAnimationType> errorController;
|
||||||
TextEditingController _enterPin = new TextEditingController();
|
TextEditingController _enterPin = TextEditingController();
|
||||||
final formKey = GlobalKey<FormState>();
|
final formKey = GlobalKey<FormState>();
|
||||||
bool hasError = false;
|
bool hasError = false;
|
||||||
var pinColor = Color(0xffF9F9F1);
|
var pinColor = Color(0xffF9F9F1);
|
||||||
|
@ -32,6 +33,7 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
errorController = StreamController<ErrorAnimationType>();
|
errorController = StreamController<ErrorAnimationType>();
|
||||||
// _walletOptions.isWalletUnlock = false;
|
// _walletOptions.isWalletUnlock = false;
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
_walletOptions.isWalletUnlock = false;
|
_walletOptions.isWalletUnlock = false;
|
||||||
|
@ -50,33 +52,73 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
||||||
height: 22,
|
height: 22,
|
||||||
child: Text(walletName),
|
child: Text(walletName),
|
||||||
)),
|
)),
|
||||||
body: Center(
|
body: Builder(
|
||||||
child: SafeArea(
|
builder: (ctx) => SafeArea(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: _walletOptions.isWalletUnlock,
|
visible: _walletOptions.isWalletUnlock,
|
||||||
child: Expanded(
|
child: Expanded(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
Text(
|
Text(
|
||||||
'Clé publique:',
|
'Clé publique:',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 15.0,
|
fontSize: 15.0,
|
||||||
color: Colors.grey[600],
|
color: Colors.grey[600],
|
||||||
fontWeight: FontWeight.w400),
|
fontWeight: FontWeight.w400),
|
||||||
),
|
),
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
Text(
|
GestureDetector(
|
||||||
_walletOptions.pubkey.text,
|
onTap: () {
|
||||||
style: TextStyle(
|
Clipboard.setData(ClipboardData(
|
||||||
fontSize: 14.0,
|
text: _walletOptions.pubkey.text));
|
||||||
color: Colors.black,
|
_walletOptions.snackCopyKey(ctx);
|
||||||
fontWeight: FontWeight.bold),
|
},
|
||||||
),
|
child: Text(
|
||||||
Expanded(
|
_walletOptions.pubkey.text,
|
||||||
child: Align(
|
style: TextStyle(
|
||||||
alignment: Alignment.bottomCenter,
|
fontSize: 14.0,
|
||||||
child: SizedBox(
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontFamily: 'Monospace'),
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: SizedBox(
|
||||||
|
height: 50,
|
||||||
|
width: 300,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
elevation: 5,
|
||||||
|
primary: Color(
|
||||||
|
0xffFFD68E), //Color(0xffFFD68E), // background
|
||||||
|
onPrimary:
|
||||||
|
Colors.black, // foreground
|
||||||
|
),
|
||||||
|
onPressed: () => _walletOptions
|
||||||
|
.renameWalletAlerte(
|
||||||
|
context, walletName)
|
||||||
|
.then((_result) {
|
||||||
|
if (_result == true) {
|
||||||
|
WidgetsBinding.instance
|
||||||
|
.addPostFrameCallback(
|
||||||
|
(_) {
|
||||||
|
_myWalletProvider
|
||||||
|
.listWallets =
|
||||||
|
_myWalletProvider
|
||||||
|
.getAllWalletsNames();
|
||||||
|
_myWalletProvider
|
||||||
|
.rebuildWidget();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
child: Text(
|
||||||
|
'Renommer ce portefeuille',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20)))))),
|
||||||
|
SizedBox(height: 30),
|
||||||
|
SizedBox(
|
||||||
height: 50,
|
height: 50,
|
||||||
width: 300,
|
width: 300,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
@ -86,167 +128,146 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
||||||
0xffFFD68E), //Color(0xffFFD68E), // background
|
0xffFFD68E), //Color(0xffFFD68E), // background
|
||||||
onPrimary: Colors.black, // foreground
|
onPrimary: Colors.black, // foreground
|
||||||
),
|
),
|
||||||
onPressed: () => _walletOptions
|
onPressed: () {
|
||||||
.renameWalletAlerte(
|
// changePin(widget.walletName, this.walletPin);
|
||||||
context, walletName)
|
Navigator.push(
|
||||||
.then((_result) {
|
context,
|
||||||
if (_result == true) {
|
MaterialPageRoute(builder: (context) {
|
||||||
WidgetsBinding.instance
|
return ChangePinScreen(
|
||||||
.addPostFrameCallback((_) {
|
walletName: walletName,
|
||||||
_myWalletProvider.listWallets =
|
oldPin: this.walletPin);
|
||||||
_myWalletProvider
|
|
||||||
.getAllWalletsNames();
|
|
||||||
_myWalletProvider.rebuildWidget();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
child: Text('Renommer ce portefeuille',
|
);
|
||||||
style: TextStyle(fontSize: 20)))))),
|
},
|
||||||
SizedBox(height: 30),
|
child: Text('Changer mon code secret',
|
||||||
SizedBox(
|
style: TextStyle(fontSize: 20)))),
|
||||||
height: 50,
|
SizedBox(height: 30),
|
||||||
width: 300,
|
SizedBox(
|
||||||
child: ElevatedButton(
|
height: 50,
|
||||||
style: ElevatedButton.styleFrom(
|
width: 300,
|
||||||
elevation: 5,
|
child: ElevatedButton(
|
||||||
primary: Color(
|
style: ElevatedButton.styleFrom(
|
||||||
0xffFFD68E), //Color(0xffFFD68E), // background
|
elevation: 6,
|
||||||
onPrimary: Colors.black, // foreground
|
primary: Colors
|
||||||
|
.redAccent, //Color(0xffFFD68E), // background
|
||||||
|
onPrimary: Colors.black, // foreground
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
await _walletOptions.deleteWallet(
|
||||||
|
context, walletName);
|
||||||
|
WidgetsBinding.instance
|
||||||
|
.addPostFrameCallback((_) {
|
||||||
|
_myWalletProvider.listWallets =
|
||||||
|
_myWalletProvider
|
||||||
|
.getAllWalletsNames();
|
||||||
|
_myWalletProvider.rebuildWidget();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Text('Supprimer ce portefeuille',
|
||||||
|
style: TextStyle(fontSize: 20)))),
|
||||||
|
SizedBox(height: 50),
|
||||||
|
Text(
|
||||||
|
'Portefeuille déverrouillé',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.green,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 15),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
SizedBox(height: 10)
|
||||||
// changePin(widget.walletName, this.walletPin);
|
]))),
|
||||||
Navigator.push(
|
Visibility(
|
||||||
context,
|
visible: !_walletOptions.isWalletUnlock,
|
||||||
MaterialPageRoute(builder: (context) {
|
child: Expanded(
|
||||||
return ChangePinScreen(
|
child: Column(children: <Widget>[
|
||||||
walletName: walletName,
|
SizedBox(height: 80),
|
||||||
oldPin: this.walletPin);
|
Text(
|
||||||
}),
|
'Veuillez tapper votre code secret pour dévérouiller votre portefeuille.',
|
||||||
);
|
textAlign: TextAlign.center,
|
||||||
},
|
style: TextStyle(
|
||||||
child: Text('Changer mon code secret',
|
fontSize: 15.0,
|
||||||
style: TextStyle(fontSize: 20)))),
|
color: Colors.black,
|
||||||
SizedBox(height: 30),
|
fontWeight: FontWeight.w400),
|
||||||
SizedBox(
|
|
||||||
height: 50,
|
|
||||||
width: 300,
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
elevation: 6,
|
|
||||||
primary: Colors
|
|
||||||
.redAccent, //Color(0xffFFD68E), // background
|
|
||||||
onPrimary: Colors.black, // foreground
|
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
SizedBox(height: 50),
|
||||||
await _walletOptions.deleteWallet(
|
Form(
|
||||||
context, walletName);
|
key: formKey,
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
child: Padding(
|
||||||
_myWalletProvider.listWallets =
|
padding: const EdgeInsets.symmetric(
|
||||||
_myWalletProvider.getAllWalletsNames();
|
vertical: 8.0, horizontal: 30),
|
||||||
_myWalletProvider.rebuildWidget();
|
child: PinCodeTextField(
|
||||||
});
|
autoFocus: true,
|
||||||
},
|
appContext: context,
|
||||||
child: Text('Supprimer ce portefeuille',
|
pastedTextStyle: TextStyle(
|
||||||
style: TextStyle(fontSize: 20)))),
|
color: Colors.green.shade600,
|
||||||
SizedBox(height: 50),
|
fontWeight: FontWeight.bold,
|
||||||
Text(
|
),
|
||||||
'Portefeuille déverrouillé',
|
length: 6,
|
||||||
style: TextStyle(
|
obscureText: false,
|
||||||
color: Colors.green,
|
obscuringCharacter: '*',
|
||||||
fontWeight: FontWeight.w700,
|
animationType: AnimationType.fade,
|
||||||
fontSize: 15),
|
validator: (v) {
|
||||||
),
|
if (v.length < 6) {
|
||||||
SizedBox(height: 10)
|
return "Votre code PIN fait 6 caractères";
|
||||||
]))),
|
} else {
|
||||||
Visibility(
|
return null;
|
||||||
visible: !_walletOptions.isWalletUnlock,
|
}
|
||||||
child: Expanded(
|
},
|
||||||
child: Column(children: <Widget>[
|
pinTheme: PinTheme(
|
||||||
SizedBox(height: 80),
|
shape: PinCodeFieldShape.box,
|
||||||
Text(
|
borderRadius: BorderRadius.circular(5),
|
||||||
'Veuillez tapper votre code secret pour dévérouiller votre portefeuille.',
|
fieldHeight: 60,
|
||||||
textAlign: TextAlign.center,
|
fieldWidth: 50,
|
||||||
style: TextStyle(
|
activeFillColor: hasError
|
||||||
fontSize: 15.0,
|
? Colors.orange
|
||||||
color: Colors.black,
|
: Colors.white,
|
||||||
fontWeight: FontWeight.w400),
|
),
|
||||||
),
|
cursorColor: Colors.black,
|
||||||
SizedBox(height: 50),
|
animationDuration:
|
||||||
Form(
|
Duration(milliseconds: 300),
|
||||||
key: formKey,
|
textStyle:
|
||||||
child: Padding(
|
TextStyle(fontSize: 20, height: 1.6),
|
||||||
padding: const EdgeInsets.symmetric(
|
backgroundColor: pinColor,
|
||||||
vertical: 8.0, horizontal: 30),
|
enableActiveFill: false,
|
||||||
child: PinCodeTextField(
|
errorAnimationController: errorController,
|
||||||
autoFocus: true,
|
controller: _enterPin,
|
||||||
appContext: context,
|
keyboardType: TextInputType.text,
|
||||||
pastedTextStyle: TextStyle(
|
boxShadows: [
|
||||||
color: Colors.green.shade600,
|
BoxShadow(
|
||||||
fontWeight: FontWeight.bold,
|
offset: Offset(0, 1),
|
||||||
),
|
color: Colors.black12,
|
||||||
length: 6,
|
blurRadius: 10,
|
||||||
obscureText: false,
|
)
|
||||||
obscuringCharacter: '*',
|
],
|
||||||
animationType: AnimationType.fade,
|
onCompleted: (_pin) async {
|
||||||
validator: (v) {
|
print("Completed");
|
||||||
if (v.length < 6) {
|
final resultWallet =
|
||||||
return "Votre code PIN fait 6 caractères";
|
await _walletOptions.readLocalWallet(
|
||||||
} else {
|
this.walletName,
|
||||||
return null;
|
_pin.toUpperCase());
|
||||||
}
|
if (resultWallet == 'bad') {
|
||||||
},
|
errorController.add(ErrorAnimationType
|
||||||
pinTheme: PinTheme(
|
.shake); // Triggering error shake animation
|
||||||
shape: PinCodeFieldShape.box,
|
hasError = true;
|
||||||
borderRadius: BorderRadius.circular(5),
|
pinColor = Colors.red[200];
|
||||||
fieldHeight: 60,
|
notifyListeners();
|
||||||
fieldWidth: 50,
|
} else {
|
||||||
activeFillColor:
|
pinColor = Colors.green[200];
|
||||||
hasError ? Colors.orange : Colors.white,
|
// setState(() {});
|
||||||
),
|
// await Future.delayed(Duration(milliseconds: 50));
|
||||||
cursorColor: Colors.black,
|
this.walletPin = _pin.toUpperCase();
|
||||||
animationDuration: Duration(milliseconds: 300),
|
// isWalletUnlock = true;
|
||||||
textStyle: TextStyle(fontSize: 20, height: 1.6),
|
notifyListeners();
|
||||||
backgroundColor: pinColor,
|
}
|
||||||
enableActiveFill: false,
|
},
|
||||||
errorAnimationController: errorController,
|
onChanged: (value) {
|
||||||
controller: _enterPin,
|
if (pinColor != Color(0xffF9F9F1)) {
|
||||||
keyboardType: TextInputType.text,
|
pinColor = Color(0xffF9F9F1);
|
||||||
boxShadows: [
|
}
|
||||||
BoxShadow(
|
print(value);
|
||||||
offset: Offset(0, 1),
|
},
|
||||||
color: Colors.black12,
|
)),
|
||||||
blurRadius: 10,
|
)
|
||||||
)
|
]))),
|
||||||
],
|
])))));
|
||||||
onCompleted: (_pin) async {
|
|
||||||
print("Completed");
|
|
||||||
final resultWallet =
|
|
||||||
await _walletOptions.readLocalWallet(
|
|
||||||
this.walletName, _pin.toUpperCase());
|
|
||||||
if (resultWallet == 'bad') {
|
|
||||||
errorController.add(ErrorAnimationType
|
|
||||||
.shake); // Triggering error shake animation
|
|
||||||
hasError = true;
|
|
||||||
pinColor = Colors.red[200];
|
|
||||||
notifyListeners();
|
|
||||||
} else {
|
|
||||||
pinColor = Colors.green[200];
|
|
||||||
// setState(() {});
|
|
||||||
// await Future.delayed(Duration(milliseconds: 50));
|
|
||||||
this.walletPin = _pin.toUpperCase();
|
|
||||||
// isWalletUnlock = true;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onChanged: (value) {
|
|
||||||
if (pinColor != Color(0xffF9F9F1)) {
|
|
||||||
pinColor = Color(0xffF9F9F1);
|
|
||||||
}
|
|
||||||
print(value);
|
|
||||||
},
|
|
||||||
)),
|
|
||||||
)
|
|
||||||
]))),
|
|
||||||
])))));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ class WalletsHome extends StatelessWidget {
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider _walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context);
|
Provider.of<WalletOptionsProvider>(context);
|
||||||
print('BUILD: WalletsHome');
|
|
||||||
_walletOptions.isWalletUnlock = false;
|
_walletOptions.isWalletUnlock = false;
|
||||||
myWalletProvider.listWallets = myWalletProvider.getAllWalletsNames();
|
myWalletProvider.listWallets = myWalletProvider.getAllWalletsNames();
|
||||||
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
||||||
|
@ -97,8 +96,6 @@ class WalletsHome extends StatelessWidget {
|
||||||
List _listWallets = [];
|
List _listWallets = [];
|
||||||
myWalletProvider.listWallets.forEach((_name, _pubkey) {
|
myWalletProvider.listWallets.forEach((_name, _pubkey) {
|
||||||
_listWallets.add(_name);
|
_listWallets.add(_name);
|
||||||
// _balance[_name] = _historyProvider.getBalance(_pubkey).toString();
|
|
||||||
print(_name + _pubkey);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return Column(children: <Widget>[
|
return Column(children: <Widget>[
|
||||||
|
|
11
pubspec.lock
11
pubspec.lock
|
@ -232,14 +232,14 @@ packages:
|
||||||
name: graphql
|
name: graphql
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.0-beta.6"
|
version: "4.0.0"
|
||||||
graphql_flutter:
|
graphql_flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: graphql_flutter
|
name: graphql_flutter
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.0-beta.6"
|
version: "4.0.0"
|
||||||
hive:
|
hive:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -595,6 +595,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.0"
|
version: "0.2.0"
|
||||||
|
system_info:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: system_info
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.3"
|
||||||
term_glyph:
|
term_glyph:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -5,7 +5,7 @@ description: A new Flutter project.
|
||||||
# pub.dev using `pub publish`. This is preferred for private packages.
|
# pub.dev using `pub publish`. This is preferred for private packages.
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
version: 0.0.1+2
|
version: 0.0.1+3
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
|
Loading…
Reference in New Issue