mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-23 07:38:49 +00:00
clean up tx details w/ more than one output address displayed
This commit is contained in:
parent
bb0511d468
commit
3e767f7778
1 changed files with 173 additions and 80 deletions
|
@ -400,6 +400,20 @@ class _TransactionV2DetailsViewState
|
||||||
final currentHeight = ref.watch(walletsChangeNotifierProvider
|
final currentHeight = ref.watch(walletsChangeNotifierProvider
|
||||||
.select((value) => value.getManager(walletId).currentHeight));
|
.select((value) => value.getManager(walletId).currentHeight));
|
||||||
|
|
||||||
|
final String outputLabel;
|
||||||
|
|
||||||
|
if (_transaction.subType == TransactionSubType.cashFusion) {
|
||||||
|
outputLabel = "Outputs";
|
||||||
|
} else if (_transaction.type == TransactionType.incoming) {
|
||||||
|
if (data.length == 1 && data.first.addresses.length == 1) {
|
||||||
|
outputLabel = "Receiving address";
|
||||||
|
} else {
|
||||||
|
outputLabel = "Receiving addresses";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
outputLabel = "Sent to";
|
||||||
|
}
|
||||||
|
|
||||||
return ConditionalParent(
|
return ConditionalParent(
|
||||||
condition: !isDesktop,
|
condition: !isDesktop,
|
||||||
builder: (child) => Background(
|
builder: (child) => Background(
|
||||||
|
@ -626,8 +640,11 @@ class _TransactionV2DetailsViewState
|
||||||
context)
|
context)
|
||||||
.copyWith(
|
.copyWith(
|
||||||
color: _transaction.type ==
|
color: _transaction.type ==
|
||||||
TransactionType.outgoing && _transaction.subType !=
|
TransactionType
|
||||||
TransactionSubType.cashFusion
|
.outgoing &&
|
||||||
|
_transaction.subType !=
|
||||||
|
TransactionSubType
|
||||||
|
.cashFusion
|
||||||
? Theme.of(context)
|
? Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.accentColorOrange
|
.accentColorOrange
|
||||||
|
@ -731,10 +748,7 @@ class _TransactionV2DetailsViewState
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
_transaction.type ==
|
outputLabel,
|
||||||
TransactionType.outgoing
|
|
||||||
? "Sent to"
|
|
||||||
: "Received at",
|
|
||||||
style: isDesktop
|
style: isDesktop
|
||||||
? STextStyles
|
? STextStyles
|
||||||
.desktopTextExtraExtraSmall(
|
.desktopTextExtraExtraSmall(
|
||||||
|
@ -750,8 +764,51 @@ class _TransactionV2DetailsViewState
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
if (data.length == 1 &&
|
||||||
|
data.first.addresses.length ==
|
||||||
|
1)
|
||||||
|
FutureBuilder(
|
||||||
|
future: fetchContactNameFor(
|
||||||
|
data.first.addresses
|
||||||
|
.first),
|
||||||
|
builder: (builderContext,
|
||||||
|
AsyncSnapshot<String>
|
||||||
|
snapshot) {
|
||||||
|
String
|
||||||
|
addressOrContactName =
|
||||||
|
data.first.addresses
|
||||||
|
.first;
|
||||||
|
if (snapshot.connectionState ==
|
||||||
|
ConnectionState
|
||||||
|
.done &&
|
||||||
|
snapshot.hasData) {
|
||||||
|
addressOrContactName =
|
||||||
|
snapshot.data!;
|
||||||
|
}
|
||||||
|
return SelectableText(
|
||||||
|
addressOrContactName,
|
||||||
|
style: isDesktop
|
||||||
|
? STextStyles
|
||||||
|
.desktopTextExtraExtraSmall(
|
||||||
|
context)
|
||||||
|
.copyWith(
|
||||||
|
color: Theme.of(
|
||||||
|
context)
|
||||||
|
.extension<
|
||||||
|
StackColors>()!
|
||||||
|
.textDark,
|
||||||
|
)
|
||||||
|
: STextStyles
|
||||||
|
.itemSubtitle12(
|
||||||
|
context),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (!(data.length == 1 &&
|
||||||
|
data.first.addresses.length ==
|
||||||
|
1))
|
||||||
...data.map(
|
...data.map(
|
||||||
(e) {
|
(group) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.all(
|
const EdgeInsets.all(
|
||||||
|
@ -761,7 +818,8 @@ class _TransactionV2DetailsViewState
|
||||||
CrossAxisAlignment
|
CrossAxisAlignment
|
||||||
.start,
|
.start,
|
||||||
children: [
|
children: [
|
||||||
...e.addresses.map(
|
...group.addresses
|
||||||
|
.map(
|
||||||
(e) {
|
(e) {
|
||||||
return FutureBuilder(
|
return FutureBuilder(
|
||||||
future:
|
future:
|
||||||
|
@ -786,41 +844,17 @@ class _TransactionV2DetailsViewState
|
||||||
e;
|
e;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SelectableText(
|
return OutputCard(
|
||||||
|
address:
|
||||||
addressOrContactName,
|
addressOrContactName,
|
||||||
style: isDesktop
|
amount: group
|
||||||
? STextStyles.desktopTextExtraExtraSmall(context).copyWith(
|
.amount,
|
||||||
color: Theme.of(context)
|
coin: coin,
|
||||||
.extension<StackColors>()!
|
|
||||||
.textDark,
|
|
||||||
)
|
|
||||||
: STextStyles.itemSubtitle12(context),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SelectableText(
|
|
||||||
ref
|
|
||||||
.watch(
|
|
||||||
pAmountFormatter(
|
|
||||||
coin))
|
|
||||||
.format(e.amount),
|
|
||||||
style: isDesktop
|
|
||||||
? STextStyles
|
|
||||||
.desktopTextExtraExtraSmall(
|
|
||||||
context)
|
|
||||||
.copyWith(
|
|
||||||
color: Theme.of(
|
|
||||||
context)
|
|
||||||
.extension<
|
|
||||||
StackColors>()!
|
|
||||||
.textDark,
|
|
||||||
)
|
|
||||||
: STextStyles
|
|
||||||
.titleBold12(
|
|
||||||
context),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -1479,6 +1513,65 @@ class _TransactionV2DetailsViewState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class OutputCard extends ConsumerWidget {
|
||||||
|
const OutputCard({
|
||||||
|
super.key,
|
||||||
|
required this.address,
|
||||||
|
required this.amount,
|
||||||
|
required this.coin,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String address;
|
||||||
|
final Amount amount;
|
||||||
|
final Coin coin;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Address",
|
||||||
|
style: Util.isDesktop
|
||||||
|
? STextStyles.desktopTextExtraExtraSmall(context)
|
||||||
|
: STextStyles.itemSubtitle(context),
|
||||||
|
),
|
||||||
|
SelectableText(
|
||||||
|
address,
|
||||||
|
style: Util.isDesktop
|
||||||
|
? STextStyles.desktopTextExtraExtraSmall(context).copyWith(
|
||||||
|
color: Theme.of(context).extension<StackColors>()!.textDark,
|
||||||
|
)
|
||||||
|
: STextStyles.itemSubtitle12(context),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Amount",
|
||||||
|
style: Util.isDesktop
|
||||||
|
? STextStyles.desktopTextExtraExtraSmall(context)
|
||||||
|
: STextStyles.itemSubtitle(context),
|
||||||
|
),
|
||||||
|
SelectableText(
|
||||||
|
ref.watch(pAmountFormatter(coin)).format(amount),
|
||||||
|
style: Util.isDesktop
|
||||||
|
? STextStyles.desktopTextExtraExtraSmall(context).copyWith(
|
||||||
|
color:
|
||||||
|
Theme.of(context).extension<StackColors>()!.textDark,
|
||||||
|
)
|
||||||
|
: STextStyles.itemSubtitle12(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class _Divider extends StatelessWidget {
|
class _Divider extends StatelessWidget {
|
||||||
const _Divider({Key? key}) : super(key: key);
|
const _Divider({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue