Merge branch 'improveUX' into 'master'

Improve ux

See merge request clients/gecko!11
This commit is contained in:
pokapow 2021-03-30 00:11:34 +00:00
commit 644785707b
6 changed files with 35 additions and 32 deletions

View File

@ -13,6 +13,8 @@ SharedPreferences prefs;
String endPointGVA; String endPointGVA;
int ramSys; int ramSys;
String cesiumPod = "https://g1.data.le-sou.org";
// Responsive ratios // Responsive ratios
bool isTall; bool isTall;
double ratio; double ratio;

View File

@ -51,7 +51,6 @@ class CesiumPlusProvider with ChangeNotifier {
"indices_boost": {"user": 100, "page": 1, "group": 0.01} "indices_boost": {"user": 100, "page": 1, "group": 0.01}
}); });
String cesiumPod = "https://g1.data.le-sou.org";
String requestUrl = "/user,page,group/profile,record/_search"; String requestUrl = "/user,page,group/profile,record/_search";
String podRequest = cesiumPod + requestUrl; String podRequest = cesiumPod + requestUrl;

View File

@ -9,7 +9,7 @@ class MyWalletsProvider with ChangeNotifier {
String listWallets; String listWallets;
Future initWalletFolder() async { Future initWalletFolder() async {
await getDefaultWallet(); getDefaultWallet();
final bool isWalletFolderExist = await walletsDirectory.exists(); final bool isWalletFolderExist = await walletsDirectory.exists();
if (!isWalletFolderExist) { if (!isWalletFolderExist) {
@ -84,17 +84,17 @@ class MyWalletsProvider with ChangeNotifier {
return listWallets; return listWallets;
} }
Future getDefaultWallet() async { void getDefaultWallet() {
defaultWalletFile = File('${appPath.path}/defaultWallet'); defaultWalletFile = File('${appPath.path}/defaultWallet');
bool isdefaultWalletFile = await defaultWalletFile.exists(); bool isdefaultWalletFile = defaultWalletFile.existsSync();
if (!isdefaultWalletFile) { if (!isdefaultWalletFile) {
await File(defaultWalletFile.path).create(); File(defaultWalletFile.path).createSync();
} }
try { try {
defaultWallet = await defaultWalletFile.readAsString(); defaultWallet = defaultWalletFile.readAsStringSync();
} catch (e) { } catch (e) {
defaultWallet = '0:0'; defaultWallet = '0:0';
} }

View File

@ -22,6 +22,7 @@ class WalletOptionsProvider with ChangeNotifier {
FocusNode walletNameFocus = FocusNode(); FocusNode walletNameFocus = FocusNode();
TextEditingController nameController = TextEditingController(); TextEditingController nameController = TextEditingController();
String walletID; String walletID;
bool isDefaultWallet;
Future<NewWallet> get badWallet => null; Future<NewWallet> get badWallet => null;
@ -356,12 +357,11 @@ class WalletOptionsProvider with ChangeNotifier {
return await scanner.generateBarCode(_pubkey); return await scanner.generateBarCode(_pubkey);
} }
Future defAsDefaultWallet(String _id) async { void defAsDefaultWallet(String _id) {
await defaultWalletFile.delete(); defaultWalletFile.deleteSync();
await defaultWalletFile.create(); defaultWalletFile.createSync();
await defaultWalletFile defaultWalletFile.writeAsStringSync(_id);
.writeAsString(_id) notifyListeners();
.then((value) => notifyListeners());
} }
Future changeAvatar() async { Future changeAvatar() async {

View File

@ -144,7 +144,7 @@ class UnlockingWallet extends StatelessWidget {
pinColor = Colors.green[400]; pinColor = Colors.green[400];
// await Future.delayed(Duration(milliseconds: 50)); // await Future.delayed(Duration(milliseconds: 50));
Navigator.push( Navigator.push(
context, formKey.currentContext,
SmoothTransition( SmoothTransition(
page: WalletOptions( page: WalletOptions(
walletNbr: walletNbr, walletNbr: walletNbr,

View File

@ -12,7 +12,7 @@ import 'package:provider/provider.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class WalletOptions extends StatelessWidget with ChangeNotifier { class WalletOptions extends StatelessWidget {
WalletOptions( WalletOptions(
{Key keyMyWallets, {Key keyMyWallets,
@required this.walletNbr, @required this.walletNbr,
@ -24,7 +24,6 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
int derivation; int derivation;
int _nbrLinesName = 1; int _nbrLinesName = 1;
bool _isNewNameValid = false; bool _isNewNameValid = false;
bool isDefaultWallet;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -46,7 +45,6 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
} else { } else {
walletName = _walletOptions.nameController.text; walletName = _walletOptions.nameController.text;
} }
_walletOptions.walletID = '0:$walletNbr';
_walletOptions.nameController.text.length >= 15 _walletOptions.nameController.text.length >= 15
? _nbrLinesName = 2 ? _nbrLinesName = 2
@ -54,9 +52,13 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
if (_walletOptions.nameController.text.length >= 26 && isTall) if (_walletOptions.nameController.text.length >= 26 && isTall)
_nbrLinesName = 3; _nbrLinesName = 3;
_walletOptions.walletID = '0:$walletNbr';
_myWalletProvider.getDefaultWallet();
defaultWallet == _walletOptions.walletID defaultWallet == _walletOptions.walletID
? isDefaultWallet = true ? _walletOptions.isDefaultWallet = true
: isDefaultWallet = false; : _walletOptions.isDefaultWallet = false;
// print(_walletOptions.generateQRcode(_walletOptions.pubkey.text)); // print(_walletOptions.generateQRcode(_walletOptions.pubkey.text));
@ -160,7 +162,7 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
variables: { variables: {
'pubkey': _walletOptions.pubkey.text, 'pubkey': _walletOptions.pubkey.text,
}, },
pollInterval: Duration(seconds: 1), // pollInterval: Duration(seconds: 1),
), ),
builder: (QueryResult result, builder: (QueryResult result,
{VoidCallback refetch, FetchMore fetchMore}) { {VoidCallback refetch, FetchMore fetchMore}) {
@ -171,6 +173,9 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
if (result.isLoading) { if (result.isLoading) {
return Text('Loading'); return Text('Loading');
} }
print(result);
// List repositories = result.data['viewer']['repositories']['nodes']; // List repositories = result.data['viewer']['repositories']['nodes'];
String wBalanceUD; String wBalanceUD;
if (result.data['balance'] == null) { if (result.data['balance'] == null) {
@ -362,15 +367,12 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
]))), ]))),
SizedBox(height: 12 * ratio), SizedBox(height: 12 * ratio),
InkWell( InkWell(
onTap: !isDefaultWallet onTap: !_walletOptions.isDefaultWallet
? () async { ? () {
await _walletOptions defaultWallet = '0:$walletNbr';
.defAsDefaultWallet(_walletOptions.walletID) _walletOptions
.then((value) => { .defAsDefaultWallet(_walletOptions.walletID);
_myWalletProvider _myWalletProvider.getAllWalletsNames(_currentChest);
.getAllWalletsNames(_currentChest),
_myWalletProvider.rebuildWidget()
});
} }
: null, : null,
child: SizedBox( child: SizedBox(
@ -378,19 +380,19 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 31), SizedBox(width: 31),
CircleAvatar( CircleAvatar(
backgroundColor: backgroundColor: Colors.grey[
Colors.grey[isDefaultWallet ? 300 : 500], _walletOptions.isDefaultWallet ? 300 : 500],
child: Image.asset( child: Image.asset(
'assets/walletOptions/android-checkmark.png', 'assets/walletOptions/android-checkmark.png',
)), )),
SizedBox(width: 12), SizedBox(width: 12),
Text( Text(
isDefaultWallet _walletOptions.isDefaultWallet
? 'Ce portefeuille est celui par defaut' ? 'Ce portefeuille est celui par defaut'
: 'Définir comme portefeuille par défaut', : 'Définir comme portefeuille par défaut',
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
color: isDefaultWallet color: _walletOptions.isDefaultWallet
? Colors.grey[500] ? Colors.grey[500]
: Colors.black)), : Colors.black)),
]))), ]))),