Add balance again, with new gql style
This commit is contained in:
parent
c2d373b721
commit
bbb0a76a36
|
@ -38,17 +38,21 @@ const String getHistory = r'''
|
||||||
outputs
|
outputs
|
||||||
writtenTime
|
writtenTime
|
||||||
}
|
}
|
||||||
}
|
|
||||||
currentUd {
|
|
||||||
amount
|
|
||||||
base
|
|
||||||
}
|
}
|
||||||
|
currentUd {
|
||||||
|
amount
|
||||||
|
base
|
||||||
|
}
|
||||||
|
balance(script: $pubkey) {
|
||||||
|
amount
|
||||||
|
base
|
||||||
|
}
|
||||||
}
|
}
|
||||||
''';
|
''';
|
||||||
|
|
||||||
const String getBalance = r'''
|
const String getBalance = r'''
|
||||||
query ($pubkey: String!) {
|
query ($pubkey: String!) {
|
||||||
balance(script: "$pubkey") {
|
balance(script: $pubkey) {
|
||||||
amount
|
amount
|
||||||
base
|
base
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,8 @@ class HistoryScreenState extends State<HistoryScreen> {
|
||||||
final TextEditingController _outputPubkey = new TextEditingController();
|
final TextEditingController _outputPubkey = new TextEditingController();
|
||||||
final nRepositories = 20;
|
final nRepositories = 20;
|
||||||
|
|
||||||
String pubkey = 'D2meevcAHFTS2gQMvmRW5Hzi25jDdikk4nC4u1FkwRaU'; // For debug
|
// String pubkey = 'D2meevcAHFTS2gQMvmRW5Hzi25jDdikk4nC4u1FkwRaU'; // For debug
|
||||||
// String pubkey = '';
|
String pubkey = '';
|
||||||
bool isBuilding = true;
|
bool isBuilding = true;
|
||||||
ScrollController _scrollController = new ScrollController();
|
ScrollController _scrollController = new ScrollController();
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ class HistoryScreenState extends State<HistoryScreen> {
|
||||||
print('isBuilding: ' + isBuilding.toString());
|
print('isBuilding: ' + isBuilding.toString());
|
||||||
return Column(children: <Widget>[
|
return Column(children: <Widget>[
|
||||||
TextField(
|
TextField(
|
||||||
|
// Entrée de la pubkey
|
||||||
onChanged: (text) {
|
onChanged: (text) {
|
||||||
print("Clé tappxé: $text");
|
print("Clé tappxé: $text");
|
||||||
this.pubkey = text;
|
this.pubkey = text;
|
||||||
|
@ -98,7 +99,7 @@ class HistoryScreenState extends State<HistoryScreen> {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Expanded historyQuery() {
|
historyQuery() {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
@ -137,6 +138,8 @@ class HistoryScreenState extends State<HistoryScreen> {
|
||||||
|
|
||||||
final String fetchMoreCursor = pageInfo['endCursor'];
|
final String fetchMoreCursor = pageInfo['endCursor'];
|
||||||
|
|
||||||
|
final num balance = result.data['balance']['amount'] / 100;
|
||||||
|
|
||||||
FetchMoreOptions opts = FetchMoreOptions(
|
FetchMoreOptions opts = FetchMoreOptions(
|
||||||
variables: {'cursor': fetchMoreCursor},
|
variables: {'cursor': fetchMoreCursor},
|
||||||
updateQuery: (previousResultData, fetchMoreResultData) {
|
updateQuery: (previousResultData, fetchMoreResultData) {
|
||||||
|
@ -182,10 +185,14 @@ class HistoryScreenState extends State<HistoryScreen> {
|
||||||
"###### DEBUG H Parse blockchainTX list. Cursor: $fetchMoreCursor ######");
|
"###### DEBUG H Parse blockchainTX list. Cursor: $fetchMoreCursor ######");
|
||||||
List _transBC = parseHistory(blockchainTX);
|
List _transBC = parseHistory(blockchainTX);
|
||||||
|
|
||||||
|
// Build history list
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Text(balance.toString() + ' Ğ1',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 30.0, color: Colors.black)),
|
||||||
for (var repository in _transBC)
|
for (var repository in _transBC)
|
||||||
ListTile(
|
ListTile(
|
||||||
contentPadding: const EdgeInsets.all(5.0),
|
contentPadding: const EdgeInsets.all(5.0),
|
||||||
|
@ -254,6 +261,10 @@ class HistoryScreenState extends State<HistoryScreen> {
|
||||||
this._outputPubkey.text = pubkey;
|
this._outputPubkey.text = pubkey;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// setState(() {
|
||||||
|
// this._outputBalance.text = balance.toString();
|
||||||
|
// });
|
||||||
|
|
||||||
return pubkey;
|
return pubkey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue