diff --git a/lib/ui/widgets/fourth_screen/transaction_item.dart b/lib/ui/widgets/fourth_screen/transaction_item.dart index ba6618738d1d94644bf8bc559a62a4f5d7d3243c..0e8f2726a5e427eb79b2770ec58d7ee7287c4923 100644 --- a/lib/ui/widgets/fourth_screen/transaction_item.dart +++ b/lib/ui/widgets/fourth_screen/transaction_item.dart @@ -19,17 +19,16 @@ import '../../ui_helpers.dart'; import '../third_screen/contact_form_dialog.dart'; class TransactionListItem extends StatelessWidget { - const TransactionListItem( - {super.key, - required this.pubKey, - required this.transaction, - required this.index, - required this.isG1, - required this.currentUd, - required this.currentSymbol, - required this.isCurrencyBefore, - this.afterCancel, - this.afterRetry}); + const TransactionListItem({super.key, + required this.pubKey, + required this.transaction, + required this.index, + required this.isG1, + required this.currentUd, + required this.currentSymbol, + required this.isCurrencyBefore, + this.afterCancel, + this.afterRetry}); final String pubKey; final Transaction transaction; @@ -99,12 +98,14 @@ class TransactionListItem extends StatelessWidget { final ContactsCubit contactsCubit = context.read<ContactsCubit>(); + const double txFontSize = 14.0; + return Slidable( - // Specify a key if the Slidable is dismissible. + // Specify a key if the Slidable is dismissible. key: ValueKey<int>(index), // The end action pane is the one at the right or the bottom side. startActionPane: - ActionPane(motion: const ScrollMotion(), children: <SlidableAction>[ + ActionPane(motion: const ScrollMotion(), children: <SlidableAction>[ if (transaction.isPending) SlidableAction( onPressed: (BuildContext c) { @@ -128,11 +129,13 @@ class TransactionListItem extends StatelessWidget { SlidableAction( onPressed: (BuildContext c) async { context.read<PaymentCubit>().selectUser( - transaction.to, - ); + transaction.to, + ); context.read<BottomNavCubit>().updateIndex(0); }, - backgroundColor: Theme.of(context).primaryColorDark, + backgroundColor: Theme + .of(context) + .primaryColorDark, foregroundColor: Colors.white, icon: Icons.replay, label: tr('pay_again'), @@ -146,7 +149,9 @@ class TransactionListItem extends StatelessWidget { onPressed: (BuildContext c) async { await _payAgain(context, transaction, true); }, - backgroundColor: Theme.of(context).primaryColorDark, + backgroundColor: Theme + .of(context) + .primaryColorDark, foregroundColor: Colors.white, icon: Icons.replay, label: tr('retry_payment'), @@ -156,7 +161,9 @@ class TransactionListItem extends StatelessWidget { onPressed: (BuildContext c) async { await _payAgain(context, transaction, true); }, - backgroundColor: Theme.of(context).primaryColorDark, + backgroundColor: Theme + .of(context) + .primaryColorDark, foregroundColor: Colors.white, icon: Icons.replay, label: tr('retry_payment'), @@ -185,7 +192,9 @@ class TransactionListItem extends StatelessWidget { }, ); }, - backgroundColor: Theme.of(context).primaryColor, + backgroundColor: Theme + .of(context) + .primaryColor, foregroundColor: Colors.white, icon: Icons.contacts, label: tr('add_contact'), @@ -201,11 +210,11 @@ class TransactionListItem extends StatelessWidget { child: ListTile( leading: (icon != null) ? Padding( - padding: const EdgeInsets.fromLTRB(10, 16, 0, 16), - child: Icon( - icon, - color: iconColor, - )) + padding: const EdgeInsets.fromLTRB(10, 16, 0, 16), + child: Icon( + icon, + color: iconColor, + )) : null, tileColor: tileColor(index, context), title: Row( @@ -236,7 +245,7 @@ class TransactionListItem extends StatelessWidget { myPubKey, transaction.to) }), style: const TextStyle( - fontSize: 14.0, + fontSize: txFontSize, // fontWeight: FontWeight.bold, ), ), @@ -264,21 +273,22 @@ class TransactionListItem extends StatelessWidget { Text.rich(TextSpan( children: <InlineSpan>[ if (isCurrencyBefore) - currencyBalanceWidget(isG1, currentSymbol), + currencyBalanceWidget(isG1, currentSymbol, txFontSize), if (isCurrencyBefore) separatorSpan(), TextSpan( text: amountS, style: TextStyle( // fontWeight: FontWeight.bold, + fontSize: txFontSize, color: transaction.type == TransactionType.received || - transaction.type == TransactionType.receiving + transaction.type == TransactionType.receiving ? positiveAmountColor : negativeAmountColor, ), ), if (!isCurrencyBefore) separatorSpan(), if (!isCurrencyBefore) - currencyBalanceWidget(isG1, currentSymbol), + currencyBalanceWidget(isG1, currentSymbol, txFontSize) ], )), const SizedBox(height: 4.0), @@ -298,14 +308,14 @@ class TransactionListItem extends StatelessWidget { ))); } - Future<void> _payAgain( - BuildContext context, Transaction transaction, bool isRetry) async { + Future<void> _payAgain(BuildContext context, Transaction transaction, + bool isRetry) async { final double amount = transaction.amount.abs(); // positive await payWithRetry( context: context, to: transaction.to, amount: - isG1 ? amount / 100 : ((amount / currentUd) / 100).toPrecision(3), + isG1 ? amount / 100 : ((amount / currentUd) / 100).toPrecision(3), comment: transaction.comment, isG1: isG1, currentUd: currentUd, @@ -315,11 +325,13 @@ class TransactionListItem extends StatelessWidget { } } - InlineSpan currencyBalanceWidget(bool isG1, String currentSymbol) { + InlineSpan currencyBalanceWidget(bool isG1, String currentSymbol, + double txFontSize) { return TextSpan(children: <InlineSpan>[ TextSpan( text: currentSymbol, - style: const TextStyle( + style: TextStyle( + fontSize: txFontSize, color: grey, ), ),