Improve history view; WIP

This commit is contained in:
poka 2021-01-29 14:21:57 +01:00
parent 2d136f89cf
commit 45aa28ab70
2 changed files with 41 additions and 24 deletions

View File

@ -22,7 +22,7 @@ List parseHistory(txs) {
transBC[i] = [];
final dateBrut =
DateTime.fromMillisecondsSinceEpoch(transaction['writtenTime'] * 1000);
final DateFormat formatter = DateFormat('dd-MM-yy - HH:mm');
final DateFormat formatter = DateFormat('dd-MM-yy\nHH:mm');
final date = formatter.format(dateBrut);
transBC[i].add(transaction['writtenTime']);
transBC[i].add(date);
@ -33,15 +33,14 @@ List parseHistory(txs) {
final int applyBase = base - currentBase;
final num amount = removeDecimalZero(amountBrut * pow(10, applyBase) / 100);
num amountUD = amount / currentUD;
int padNbr = 14 - amount.toString().length;
if (direction == "RECEIVED") {
transBC[i].add(transaction['issuers'][0]);
transBC[i].add(' ' + amount.toString().padRight(padNbr));
transBC[i].add(amount.toString());
transBC[i].add(amountUD.toStringAsFixed(2));
} else if (direction == "SENT") {
final outPubkey = output.split("SIG(")[1].replaceAll(')', '');
transBC[i].add(outPubkey);
transBC[i].add(' -' + amount.toString().padRight(padNbr - 1));
transBC[i].add(amount.toString());
transBC[i].add(amountUD.toStringAsFixed(2));
}
transBC[i].add(transaction['comment']);

View File

@ -155,29 +155,47 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
children: <Widget>[
SizedBox(height: 7),
if (_historyProvider.pubkey != '')
Text(balance.toString() + ' Ğ1',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 30.0)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(width: 32.0, height: 0.0),
Text(balance.toString() + ' Ğ1',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 30.0)),
Container(
padding: const EdgeInsets.only(right: 80),
child: Text("Payer")),
]),
SizedBox(height: 12),
for (var repository in _transBC)
ListTile(
contentPadding: const EdgeInsets.all(5.0),
leading: Text(repository[3],
style: TextStyle(fontSize: 14.0)),
title: Text(
repository[1].toString() +
'\n' +
truncate(repository[2], 17,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: ListTile(
contentPadding: const EdgeInsets.all(5.0),
leading: Text(repository[1].toString(),
style: TextStyle(
fontSize: 12,
color: Colors.grey[800],
fontWeight: FontWeight.w700),
textAlign: TextAlign.center),
title: Text(repository[5],
style: TextStyle(fontSize: 14.0),
textAlign: TextAlign.center),
subtitle: Text(
truncate(repository[2], 20,
omission: "...",
position: TruncatePosition.end),
style: TextStyle(fontSize: 14.0)),
subtitle: Text(repository[5],
style: TextStyle(fontSize: 14.0)),
dense: true,
onTap: () {
// this._outputPubkey.text = repository[2];
_historyProvider.isPubkey(repository[2]);
}),
style: TextStyle(fontSize: 11.0),
textAlign: TextAlign.center),
trailing: Text("${repository[3]} Ğ1",
style: TextStyle(fontSize: 14.0),
textAlign: TextAlign.justify),
dense: true,
isThreeLine: false,
onTap: () {
// this._outputPubkey.text = repository[2];
_historyProvider.isPubkey(repository[2]);
})),
if (result.isLoading)
Row(
mainAxisAlignment: MainAxisAlignment.center,
@ -198,7 +216,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
onNotification: (t) {
if (t is ScrollEndNotification &&
scrollController.position.pixels >=
scrollController.position.maxScrollExtent * 0.8) {
scrollController.position.maxScrollExtent * 0.7) {
fetchMore(opts);
}
return true;