gecko/lib/widgets/transaction_tile.dart

101 lines
3.1 KiB
Dart
Raw Normal View History

2022-12-09 05:19:34 +01:00
import 'package:flutter/material.dart';
import 'package:gecko/models/widgets_keys.dart';
import 'package:gecko/providers/cesium_plus.dart';
import 'package:gecko/providers/duniter_indexer.dart';
import 'package:gecko/providers/substrate_sdk.dart';
import 'package:gecko/screens/wallet_view.dart';
import 'package:gecko/widgets/page_route_no_transition.dart';
class TransactionTile extends StatelessWidget {
const TransactionTile({
Key? key,
required this.keyID,
required this.avatarSize,
required this.repository,
required this.dateForm,
required this.finalAmount,
required this.duniterIndexer,
required this.context,
}) : super(key: key);
final int keyID;
final double avatarSize;
final List repository;
final String dateForm;
final String finalAmount;
final DuniterIndexer duniterIndexer;
final BuildContext context;
@override
Widget build(BuildContext context) {
final newKey = keyID + 1;
2023-11-26 21:07:17 +01:00
final String? username = repository[2] == '' ? null : repository[2];
2022-12-09 05:19:34 +01:00
return Padding(
padding: const EdgeInsets.only(right: 0),
child: ListTile(
key: keyTransaction(newKey),
contentPadding:
const EdgeInsets.only(left: 20, right: 30, top: 15, bottom: 15),
leading: ClipOval(
child: defaultAvatar(avatarSize),
),
title: Padding(
padding: const EdgeInsets.only(bottom: 5),
child: Text(getShortPubkey(repository[1]),
style: const TextStyle(fontSize: 18, fontFamily: 'Monospace')),
),
subtitle: RichText(
text: TextSpan(
style: TextStyle(
2022-12-10 06:09:05 +01:00
fontSize: 17,
2022-12-09 05:19:34 +01:00
color: Colors.grey[700],
),
children: <TextSpan>[
TextSpan(
text: dateForm,
),
2023-11-26 21:07:17 +01:00
if (username != null)
2022-12-09 05:19:34 +01:00
TextSpan(
text: ' · ',
style: TextStyle(
2022-12-10 06:09:05 +01:00
fontSize: 25,
2022-12-09 05:19:34 +01:00
color: Colors.grey[550],
),
),
TextSpan(
2023-11-26 21:07:17 +01:00
text: username,
2022-12-09 05:19:34 +01:00
style: TextStyle(
2022-12-10 06:09:05 +01:00
fontStyle: FontStyle.italic,
color: Colors.grey[600],
fontSize: 19),
2022-12-09 05:19:34 +01:00
),
],
),
),
trailing: Text(finalAmount,
2022-12-10 06:09:05 +01:00
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: repository[4] == 'RECEIVED'
? Colors.green[700]
: Colors.blue[700]),
2022-12-09 05:19:34 +01:00
textAlign: TextAlign.justify),
dense: false,
isThreeLine: false,
onTap: () {
Navigator.push(
context,
PageNoTransit(builder: (context) {
return WalletViewScreen(
address: repository[1],
2023-11-26 21:07:17 +01:00
username: username,
2022-12-09 05:19:34 +01:00
);
}),
);
// Navigator.pop(context);
}),
);
}
}