Compare commits

...

2 Commits

Author SHA1 Message Date
poka 6bc09fa79a Improve chest screen 2021-11-11 22:38:28 +01:00
poka 6b146d7917 Fix: Show keyboard when renaming a wallet (thx Boris) 2021-11-11 22:37:27 +01:00
10 changed files with 58 additions and 53 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
assets/avatars/trunc/0.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
assets/avatars/trunc/1.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
assets/avatars/trunc/2.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -273,8 +273,4 @@ class HistoryProvider with ChangeNotifier {
String generateIdenticon(String _pubkey) {
return Jdenticon.toSvg(_pubkey);
}
// num getBalance(_pubkey) {
// getBalance(_pubkey);
// }
}

View File

@ -125,7 +125,7 @@ class WalletOptionsProvider with ChangeNotifier {
return _pinLenght;
}
Future _renameWallet(List<int> _walletID, _newName) async {
void _renameWallet(List<int> _walletID, _newName) async {
MyWalletsProvider myWalletClass = MyWalletsProvider();
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;
if (isEditing) {
if (!nameController.text.contains(':') &&
nameController.text.length <= 39) {
await _renameWallet(_wID, nameController.text);
_renameWallet(_wID, nameController.text);
nameState = true;
} else {
nameState = false;
}
} else {
walletNameFocus.requestFocus();
nameState = true;
}

View File

@ -127,6 +127,7 @@ class WalletOptions extends StatelessWidget {
width: 260,
child: TextField(
key: Key('walletName'),
autofocus: false,
focusNode: _walletOptions.walletNameFocus,
enabled: _walletOptions.isEditing,
controller: _walletOptions.nameController,
@ -223,36 +224,11 @@ class WalletOptions extends StatelessWidget {
InkWell(
key: Key('renameWallet'),
onTap: () async {
// _walletOptions.isEditing = true;
// _walletOptions.reloadBuild();
// _walletOptions.walletNameFocus
// .requestFocus();
_isNewNameValid = await _walletOptions
_isNewNameValid = _walletOptions
.editWalletName(_walletOptions.walletID);
// .then((_) {
// _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'),
// );
// }
// },
// );
await Future.delayed(
Duration(milliseconds: 30));
_walletOptions.walletNameFocus.requestFocus();
},
child: ClipRRect(
child: Image.asset(
@ -262,9 +238,6 @@ class WalletOptions extends StatelessWidget {
width: 20,
height: 20),
)),
// Image.asset(
// 'assets/walletOptions/edit.png',
// ),
SizedBox(
height: 60,
)

View File

@ -1,6 +1,7 @@
import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/myWallets.dart';
import 'package:gecko/models/queries.dart';
import 'package:gecko/models/walletData.dart';
import 'package:gecko/models/walletOptions.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/walletOptions.dart';
import 'package:gecko/screens/onBoarding/0_noKeychainFound.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart';
import 'package:assorted_layout_widgets/assorted_layout_widgets.dart';
class WalletsHome extends StatelessWidget {
final _derivationKey = GlobalKey<FormState>();
@ -146,7 +147,6 @@ class WalletsHome extends StatelessWidget {
mainAxisSpacing: 0,
children: <Widget>[
for (WalletData _repository in _listWallets)
// if (_repository.number.clamp(0, 2) == _repository.number) hasImage = true
Padding(
padding: EdgeInsets.all(16),
child: GestureDetector(
@ -199,6 +199,7 @@ class WalletsHome extends StatelessWidget {
scale: 0.5,
),
)),
// balanceBuilder(context, _walletOptions.pubkey.text),
ListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
@ -213,17 +214,21 @@ class WalletsHome extends StatelessWidget {
// subtitle: Text(_repository.split(':')[3],
// style: TextStyle(fontSize: 12.0, fontFamily: 'Monospace')),
title: Center(
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 5),
child: Text(_repository.name,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16.0,
color: _repository.id()[1] ==
defaultWallet.id()[1]
? Color(0xffF9F9F1)
: Colors.black)))),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5),
child: Text(
'${_repository.name}',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 17.0,
color: _repository.id()[1] ==
defaultWallet.id()[1]
? Color(0xffF9F9F1)
: Colors.black,
fontStyle: FontStyle.italic),
),
),
),
// dense: true,
onTap: () {
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) {
return Padding(
padding: EdgeInsets.all(16),