zwallet/lib/transaction.dart

43 lines
1.5 KiB
Dart
Raw Normal View History

2021-07-09 22:44:34 -07:00
import 'package:flutter/material.dart';
2021-07-10 22:20:53 -07:00
import 'package:url_launcher/url_launcher.dart';
2021-07-09 22:44:34 -07:00
2021-08-13 20:44:53 -07:00
import 'main.dart';
2021-07-09 22:44:34 -07:00
import 'store.dart';
2021-08-15 09:18:09 -07:00
import 'generated/l10n.dart';
2021-07-09 22:44:34 -07:00
class TransactionPage extends StatefulWidget {
final Tx tx;
TransactionPage(this.tx);
@override
State<StatefulWidget> createState() => TransactionState();
}
class TransactionState extends State<TransactionPage> {
@override
Widget build(BuildContext context) {
final textTheme = Theme.of(context).textTheme;
return Scaffold(
2021-08-15 09:18:09 -07:00
appBar: AppBar(title: Text(S.of(context).transactionDetails)),
2021-07-09 22:44:34 -07:00
body: ListView(padding: EdgeInsets.all(16), children: [
ListTile(
2021-08-18 23:10:14 -07:00
title: Text(S.of(context).txId), subtitle: SelectableText('${widget.tx.fullTxId}')),
2021-07-09 22:44:34 -07:00
ListTile(
2021-08-15 09:18:09 -07:00
title: Text(S.of(context).height), subtitle: SelectableText('${widget.tx.height}')),
2021-07-09 22:44:34 -07:00
ListTile(
2021-08-15 09:18:09 -07:00
title: Text(S.of(context).timestamp),
2021-07-09 22:44:34 -07:00
subtitle: Text('${widget.tx.timestamp}')),
2021-08-15 09:18:09 -07:00
ListTile(title: Text(S.of(context).amount), subtitle: SelectableText('${widget.tx.value.toStringAsFixed(8)}')),
2021-07-09 22:44:34 -07:00
ListTile(
2021-08-15 09:18:09 -07:00
title: Text(S.of(context).address), subtitle: SelectableText('${widget.tx.address ?? S.of(context).na}')),
ListTile(title: Text(S.of(context).memo), subtitle: SelectableText('${widget.tx.memo ?? S.of(context).na}')),
ElevatedButton(onPressed: _onOpen, child: Text(S.of(context).openInExplorer))
2021-07-09 22:44:34 -07:00
]));
}
2021-07-10 22:20:53 -07:00
_onOpen() {
2021-08-13 20:44:53 -07:00
launch("${coin.explorerUrl}${widget.tx.fullTxId}");
2021-07-10 22:20:53 -07:00
}
2021-07-09 22:44:34 -07:00
}