Prev/Next buttons on Tx Details
This commit is contained in:
parent
377536b231
commit
2752aa17c5
|
@ -46,7 +46,7 @@ class SyncStatusWidget extends StatelessWidget {
|
||||||
final simpleMode = settings.simpleMode;
|
final simpleMode = settings.simpleMode;
|
||||||
|
|
||||||
return Column(children: [
|
return Column(children: [
|
||||||
if (simpleMode) Text(s.simpleMode),
|
if (simpleMode) Padding(padding: EdgeInsets.fromLTRB(0, 8, 0, 0), child: Text(s.simpleMode)),
|
||||||
Observer(builder: (context) {
|
Observer(builder: (context) {
|
||||||
final time = eta.eta;
|
final time = eta.eta;
|
||||||
final syncedHeight = syncStatus.syncedHeight;
|
final syncedHeight = syncStatus.syncedHeight;
|
||||||
|
|
|
@ -134,7 +134,7 @@ class HistoryDataSource extends DataTableSource {
|
||||||
DataCell(Text("$m")),
|
DataCell(Text("$m")),
|
||||||
],
|
],
|
||||||
onSelectChanged: (_) {
|
onSelectChanged: (_) {
|
||||||
Navigator.of(this.context).pushNamed('/tx', arguments: tx);
|
Navigator.of(this.context).pushNamed('/tx', arguments: index);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@ void main() {
|
||||||
'/accounts': (context) => AccountManagerPage(),
|
'/accounts': (context) => AccountManagerPage(),
|
||||||
'/settings': (context) => SettingsPage(),
|
'/settings': (context) => SettingsPage(),
|
||||||
'/tx': (context) =>
|
'/tx': (context) =>
|
||||||
TransactionPage(routeSettings.arguments as Tx),
|
TransactionPage(routeSettings.arguments as int),
|
||||||
'/backup': (context) =>
|
'/backup': (context) =>
|
||||||
BackupPage(routeSettings.arguments as AccountId?),
|
BackupPage(routeSettings.arguments as AccountId?),
|
||||||
'/multipay': (context) => MultiPayPage(),
|
'/multipay': (context) => MultiPayPage(),
|
||||||
|
|
|
@ -7,41 +7,67 @@ import 'store.dart';
|
||||||
import 'generated/l10n.dart';
|
import 'generated/l10n.dart';
|
||||||
|
|
||||||
class TransactionPage extends StatefulWidget {
|
class TransactionPage extends StatefulWidget {
|
||||||
final Tx tx;
|
final int txIndex;
|
||||||
|
|
||||||
TransactionPage(this.tx);
|
TransactionPage(this.txIndex);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() => TransactionState();
|
State<StatefulWidget> createState() => TransactionState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class TransactionState extends State<TransactionPage> {
|
class TransactionState extends State<TransactionPage> {
|
||||||
|
late int txIndex;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
txIndex = widget.txIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tx get tx => active.sortedTxs[txIndex];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final textTheme = Theme.of(context).textTheme;
|
final n = active.sortedTxs.length;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: Text(S.of(context).transactionDetails)),
|
appBar: AppBar(title: Text(S.of(context).transactionDetails)),
|
||||||
body: ListView(padding: EdgeInsets.all(16), children: [
|
body: ListView(padding: EdgeInsets.all(16), children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(S.of(context).txId), subtitle: SelectableText('${widget.tx.fullTxId}')),
|
title: Text(S.of(context).txId), subtitle: SelectableText('${tx.fullTxId}')),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(S.of(context).height), subtitle: SelectableText('${widget.tx.height}')),
|
title: Text(S.of(context).height), subtitle: SelectableText('${tx.height}')),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(S.of(context).confs), subtitle: SelectableText('${syncStatus.latestHeight - widget.tx.height + 1}')),
|
title: Text(S.of(context).confs), subtitle: SelectableText('${syncStatus.latestHeight - tx.height + 1}')),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(S.of(context).timestamp),
|
title: Text(S.of(context).timestamp),
|
||||||
subtitle: Text('${widget.tx.timestamp}')),
|
subtitle: Text('${tx.timestamp}')),
|
||||||
ListTile(title: Text(S.of(context).amount), subtitle: SelectableText(decimalFormat(widget.tx.value, 8))),
|
ListTile(title: Text(S.of(context).amount), subtitle: SelectableText(decimalFormat(tx.value, 8))),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(S.of(context).address), subtitle: SelectableText('${widget.tx.address}')),
|
title: Text(S.of(context).address), subtitle: SelectableText('${tx.address}')),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(S.of(context).contactName), subtitle: SelectableText('${widget.tx.contact ?? "N/A"}')),
|
title: Text(S.of(context).contactName), subtitle: SelectableText('${tx.contact ?? "N/A"}')),
|
||||||
ListTile(title: Text(S.of(context).memo), subtitle: SelectableText('${widget.tx.memo}')),
|
ListTile(title: Text(S.of(context).memo), subtitle: SelectableText('${tx.memo}')),
|
||||||
ElevatedButton(onPressed: _onOpen, child: Text(S.of(context).openInExplorer))
|
ButtonBar(alignment: MainAxisAlignment.center, children: [
|
||||||
|
IconButton(onPressed: txIndex > 0 ? _prev : null, icon: Icon(Icons.chevron_left)),
|
||||||
|
ElevatedButton(onPressed: _onOpen, child: Text(S.of(context).openInExplorer)),
|
||||||
|
IconButton(onPressed: txIndex < n-1 ? _next : null, icon: Icon(Icons.chevron_right)),
|
||||||
|
]),
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
_onOpen() {
|
_onOpen() {
|
||||||
launch("${activeCoin().explorerUrl}${widget.tx.fullTxId}");
|
launch("${activeCoin().explorerUrl}${tx.fullTxId}");
|
||||||
|
}
|
||||||
|
|
||||||
|
_prev() {
|
||||||
|
setState(() {
|
||||||
|
txIndex -= 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_next() {
|
||||||
|
setState(() {
|
||||||
|
txIndex += 1;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue