Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix softwrap in Tx-History button #1251

Merged
merged 9 commits into from
Jun 5, 2023
127 changes: 57 additions & 70 deletions app/lib/page/assets/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -228,74 +228,29 @@ class _AssetsViewState extends State<AssetsView> {
),
Row(
children: [
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(15)),
),
),
key: const Key('qr-receive'),
onPressed: () => Navigator.pushNamed(context, ReceivePage.route),
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 16, 8, 16),
child: Column(
children: [
const Icon(Iconsax.receive_square_2),
const SizedBox(height: 4),
Text(dic!.assets.receive),
],
),
),
),
ActionButton(
key: const Key('qr-receive'),
icon: const Icon(Iconsax.receive_square_2),
label: dic!.assets.receive,
onPressed: () => Navigator.pushNamed(context, ReceivePage.route),
),
const SizedBox(width: 3),
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(15)),
),
),
key: const Key('go-transfer-history'),
onPressed: widget.store.encointer.communityBalance != null
? () => Navigator.pushNamed(context, TransferHistoryView.route)
: null,
child: Padding(
padding: const EdgeInsets.fromLTRB(0, 16, 0, 16),
child: Column(
children: [
Assets.images.assets.receiveSquare2.svg(),
const SizedBox(height: 4),
Text(dic!.home.transferHistory),
],
),
),
),
ActionButton(
key: const Key('go-transfer-history'),
azackmatoff marked this conversation as resolved.
Show resolved Hide resolved
icon: Assets.images.assets.receiveSquare2.svg(),
label: dic!.home.transferHistory,
onPressed: widget.store.encointer.communityBalance != null
? () => Navigator.pushNamed(context, TransferHistoryView.route)
: null,
),
const SizedBox(width: 3),
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(15)),
),
),
key: const Key('transfer'),
onPressed: widget.store.encointer.communityBalance != null
? () => Navigator.pushNamed(context, TransferPage.route)
: null,
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 16, 8, 16),
child: Column(
children: [
const Icon(Iconsax.send_sqaure_2),
const SizedBox(height: 4),
Text(dic!.assets.transfer),
],
),
),
),
ActionButton(
key: const Key('transfer'),
azackmatoff marked this conversation as resolved.
Show resolved Hide resolved
icon: const Icon(Iconsax.send_sqaure_2),
label: dic!.assets.transfer,
onPressed: widget.store.encointer.communityBalance != null
? () => Navigator.pushNamed(context, TransferPage.route)
: null,
),
],
),
Expand Down Expand Up @@ -546,12 +501,6 @@ class _AssetsViewState extends State<AssetsView> {
? community.applyDemurrage!(oldBalanceEntry) ?? 0
: 0;

// =======
// double newBalance = community.applyDemurrage(balanceEntry) as double;
// double oldBalance = community.applyDemurrage(widget.store.encointer
// .accountStores![widget.store.account.currentAddress]!.balanceEntries[cidStr]) as double? ??
// 0;
// >>>>>>> 9d4143d3262181f3ad0429032d40bcd3c94c1b9f
final delta = newBalance - oldBalance;
Log.d('[home:refreshBalanceAndNotify] balance for $cidStr was $oldBalance, changed by $delta', 'Assets');
if (delta.abs() > demurrageRate) {
Expand Down Expand Up @@ -584,3 +533,41 @@ class _AssetsViewState extends State<AssetsView> {
});
}
}

class ActionButton extends StatelessWidget {
const ActionButton({
super.key,
required this.icon,
required this.label,
this.onPressed,
});

final Widget icon;
final String label;
final void Function()? onPressed;

@override
Widget build(BuildContext context) {
return Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(15)),
),
),
key: key,
onPressed: onPressed,
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 16, 8, 16),
child: Column(
children: [
icon,
const SizedBox(height: 4),
Text(label, softWrap: false, overflow: TextOverflow.ellipsis),
],
),
),
),
);
}
}
2 changes: 1 addition & 1 deletion app/lib/utils/translations/translations_assets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ class TranslationsFrAssets implements TranslationsAssets {
@override
String get issuancePending => 'Demander le paiement communautaire en cours';
@override
String get receive => 'Demander';
String get receive => 'Exiger';
@override
String get scan => 'Scanner';
@override
Expand Down
6 changes: 3 additions & 3 deletions app/lib/utils/translations/translations_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class TranslationsEnHome implements TranslationsHome {
@override
String get noTransactions => 'No Transactions';
@override
String get transferHistory => 'Transactions';
String get transferHistory => 'Transfers';
@override
String get error => 'Error';
@override
Expand Down Expand Up @@ -284,7 +284,7 @@ class TranslationsDeHome implements TranslationsHome {
@override
String get noTransactions => 'Keine Transaktionen';
@override
String get transferHistory => 'Transaktionen';
String get transferHistory => 'Transfers';
@override
String get error => 'Fehler';
@override
Expand Down Expand Up @@ -412,7 +412,7 @@ class TranslationsFrHome implements TranslationsHome {
@override
String get noTransactions => 'Aucune transaction';
@override
String get transferHistory => 'Transactions';
String get transferHistory => 'Transferts';
@override
String get error => 'Erreur';
@override
Expand Down