Compare commits
2 Commits
a417f9e0d3
...
6bc09fa79a
Author | SHA1 | Date |
---|---|---|
|
6bc09fa79a | |
|
6b146d7917 |
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 9.2 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 11 KiB |
|
@ -273,8 +273,4 @@ class HistoryProvider with ChangeNotifier {
|
||||||
String generateIdenticon(String _pubkey) {
|
String generateIdenticon(String _pubkey) {
|
||||||
return Jdenticon.toSvg(_pubkey);
|
return Jdenticon.toSvg(_pubkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
// num getBalance(_pubkey) {
|
|
||||||
// getBalance(_pubkey);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
return _pinLenght;
|
return _pinLenght;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _renameWallet(List<int> _walletID, _newName) async {
|
void _renameWallet(List<int> _walletID, _newName) async {
|
||||||
MyWalletsProvider myWalletClass = MyWalletsProvider();
|
MyWalletsProvider myWalletClass = MyWalletsProvider();
|
||||||
|
|
||||||
WalletData _walletTarget = myWalletClass.getWalletData(_walletID);
|
WalletData _walletTarget = myWalletClass.getWalletData(_walletID);
|
||||||
|
@ -176,18 +176,17 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> editWalletName(List<int> _wID) async {
|
bool editWalletName(List<int> _wID) {
|
||||||
bool nameState;
|
bool nameState;
|
||||||
if (isEditing) {
|
if (isEditing) {
|
||||||
if (!nameController.text.contains(':') &&
|
if (!nameController.text.contains(':') &&
|
||||||
nameController.text.length <= 39) {
|
nameController.text.length <= 39) {
|
||||||
await _renameWallet(_wID, nameController.text);
|
_renameWallet(_wID, nameController.text);
|
||||||
nameState = true;
|
nameState = true;
|
||||||
} else {
|
} else {
|
||||||
nameState = false;
|
nameState = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
walletNameFocus.requestFocus();
|
|
||||||
nameState = true;
|
nameState = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
width: 260,
|
width: 260,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
key: Key('walletName'),
|
key: Key('walletName'),
|
||||||
|
autofocus: false,
|
||||||
focusNode: _walletOptions.walletNameFocus,
|
focusNode: _walletOptions.walletNameFocus,
|
||||||
enabled: _walletOptions.isEditing,
|
enabled: _walletOptions.isEditing,
|
||||||
controller: _walletOptions.nameController,
|
controller: _walletOptions.nameController,
|
||||||
|
@ -223,36 +224,11 @@ class WalletOptions extends StatelessWidget {
|
||||||
InkWell(
|
InkWell(
|
||||||
key: Key('renameWallet'),
|
key: Key('renameWallet'),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
// _walletOptions.isEditing = true;
|
_isNewNameValid = _walletOptions
|
||||||
// _walletOptions.reloadBuild();
|
|
||||||
// _walletOptions.walletNameFocus
|
|
||||||
// .requestFocus();
|
|
||||||
_isNewNameValid = await _walletOptions
|
|
||||||
.editWalletName(_walletOptions.walletID);
|
.editWalletName(_walletOptions.walletID);
|
||||||
// .then((_) {
|
await Future.delayed(
|
||||||
// _walletOptions.walletNameFocus
|
Duration(milliseconds: 30));
|
||||||
// .requestFocus();
|
_walletOptions.walletNameFocus.requestFocus();
|
||||||
// _walletOptions.reloadBuild();
|
|
||||||
// });
|
|
||||||
|
|
||||||
// .then(
|
|
||||||
// (_result) {
|
|
||||||
// if (_result == true) {
|
|
||||||
// WidgetsBinding.instance
|
|
||||||
// .addPostFrameCallback((_) {
|
|
||||||
// _myWalletProvider.listWallets =
|
|
||||||
// _myWalletProvider
|
|
||||||
// .readAllWallets(
|
|
||||||
// _currentChest);
|
|
||||||
// _myWalletProvider.rebuildWidget();
|
|
||||||
// });
|
|
||||||
// Navigator.popUntil(
|
|
||||||
// context,
|
|
||||||
// ModalRoute.withName('/mywallets'),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
},
|
},
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
|
@ -262,9 +238,6 @@ class WalletOptions extends StatelessWidget {
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 20),
|
height: 20),
|
||||||
)),
|
)),
|
||||||
// Image.asset(
|
|
||||||
// 'assets/walletOptions/edit.png',
|
|
||||||
// ),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 60,
|
height: 60,
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/myWallets.dart';
|
import 'package:gecko/models/myWallets.dart';
|
||||||
|
import 'package:gecko/models/queries.dart';
|
||||||
import 'package:gecko/models/walletData.dart';
|
import 'package:gecko/models/walletData.dart';
|
||||||
import 'package:gecko/models/walletOptions.dart';
|
import 'package:gecko/models/walletOptions.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -8,8 +9,8 @@ import 'package:gecko/screens/commonElements.dart';
|
||||||
import 'package:gecko/screens/myWallets/chooseChest.dart';
|
import 'package:gecko/screens/myWallets/chooseChest.dart';
|
||||||
import 'package:gecko/screens/myWallets/walletOptions.dart';
|
import 'package:gecko/screens/myWallets/walletOptions.dart';
|
||||||
import 'package:gecko/screens/onBoarding/0_noKeychainFound.dart';
|
import 'package:gecko/screens/onBoarding/0_noKeychainFound.dart';
|
||||||
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:assorted_layout_widgets/assorted_layout_widgets.dart';
|
|
||||||
|
|
||||||
class WalletsHome extends StatelessWidget {
|
class WalletsHome extends StatelessWidget {
|
||||||
final _derivationKey = GlobalKey<FormState>();
|
final _derivationKey = GlobalKey<FormState>();
|
||||||
|
@ -146,7 +147,6 @@ class WalletsHome extends StatelessWidget {
|
||||||
mainAxisSpacing: 0,
|
mainAxisSpacing: 0,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
for (WalletData _repository in _listWallets)
|
for (WalletData _repository in _listWallets)
|
||||||
// if (_repository.number.clamp(0, 2) == _repository.number) hasImage = true
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.all(16),
|
padding: EdgeInsets.all(16),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
|
@ -199,6 +199,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
scale: 0.5,
|
scale: 0.5,
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
|
// balanceBuilder(context, _walletOptions.pubkey.text),
|
||||||
ListTile(
|
ListTile(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.vertical(
|
borderRadius: BorderRadius.vertical(
|
||||||
|
@ -214,16 +215,20 @@ class WalletsHome extends StatelessWidget {
|
||||||
// style: TextStyle(fontSize: 12.0, fontFamily: 'Monospace')),
|
// style: TextStyle(fontSize: 12.0, fontFamily: 'Monospace')),
|
||||||
title: Center(
|
title: Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding: EdgeInsets.symmetric(horizontal: 5),
|
||||||
EdgeInsets.symmetric(horizontal: 5),
|
child: Text(
|
||||||
child: Text(_repository.name,
|
'${_repository.name}',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16.0,
|
fontSize: 17.0,
|
||||||
color: _repository.id()[1] ==
|
color: _repository.id()[1] ==
|
||||||
defaultWallet.id()[1]
|
defaultWallet.id()[1]
|
||||||
? Color(0xffF9F9F1)
|
? Color(0xffF9F9F1)
|
||||||
: Colors.black)))),
|
: Colors.black,
|
||||||
|
fontStyle: FontStyle.italic),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
// dense: true,
|
// dense: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
|
@ -255,6 +260,38 @@ class WalletsHome extends StatelessWidget {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget balanceBuilder(context, String _pubkey) {
|
||||||
|
return Query(
|
||||||
|
options: QueryOptions(
|
||||||
|
document: gql(getBalance),
|
||||||
|
variables: {
|
||||||
|
'pubkey': _pubkey,
|
||||||
|
},
|
||||||
|
// pollInterval: Duration(seconds: 1),
|
||||||
|
),
|
||||||
|
builder: (QueryResult result,
|
||||||
|
{VoidCallback refetch, FetchMore fetchMore}) {
|
||||||
|
if (result.hasException) {
|
||||||
|
return Text(result.exception.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.isLoading) {
|
||||||
|
return Text('Loading');
|
||||||
|
}
|
||||||
|
String wBalanceUD;
|
||||||
|
if (result.data['balance'] == null) {
|
||||||
|
wBalanceUD = '0.0';
|
||||||
|
} else {
|
||||||
|
int wBalanceG1 = result.data['balance']['amount'];
|
||||||
|
int currentUD = result.data['currentUd']['amount'];
|
||||||
|
double wBalanceUDBrut = wBalanceG1 / currentUD; // .toString();
|
||||||
|
wBalanceUD =
|
||||||
|
double.parse((wBalanceUDBrut).toStringAsFixed(2)).toString();
|
||||||
|
}
|
||||||
|
return Text(wBalanceUD);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Widget addNewDerivation(context) {
|
Widget addNewDerivation(context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.all(16),
|
padding: EdgeInsets.all(16),
|
||||||
|
|