Improve chest screen

This commit is contained in:
poka 2021-11-11 22:38:28 +01:00
parent 6b146d7917
commit 6bc09fa79a
8 changed files with 50 additions and 17 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

@ -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),