mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-22 06:28:39 +02:00
Transaction details (New UI) (#3070)
* merge * strings * layout fixes * add modal for tx details * add copy option * fix bottomWidget * fix bottomWidget * remove import * add rbf * add observer for rbf * post-review fixes * add mweb explorer * proper formatting for source address
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import 'package:cake_wallet/src/screens/transaction_details/transaction_details_list_item.dart';
|
||||
|
||||
class AddressListItem extends TransactionDetailsListItem {
|
||||
AddressListItem({required super.title, required super.value, super.key});
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import 'package:cake_wallet/src/screens/transaction_details/transaction_details_list_item.dart';
|
||||
|
||||
class ConfirmationsListItem extends TransactionDetailsListItem {
|
||||
late final int current;
|
||||
late final int needed;
|
||||
|
||||
ConfirmationsListItem({required super.title, required super.value, super.key}) {
|
||||
final parts = value.split("/");
|
||||
current = int.tryParse(parts.first)??0;
|
||||
needed = int.tryParse(parts.last)??0;
|
||||
}
|
||||
}
|
||||
@@ -7,14 +7,14 @@ class ListItemStyleWrapper extends StatelessWidget {
|
||||
required this.isLastInSection,
|
||||
required this.builder,
|
||||
this.onTap,
|
||||
this.height = 50,
|
||||
this.iconPath,
|
||||
this.height,
|
||||
});
|
||||
|
||||
final String? iconPath;
|
||||
final bool isFirstInSection;
|
||||
final bool isLastInSection;
|
||||
final double height;
|
||||
final double? height;
|
||||
final VoidCallback? onTap;
|
||||
final Widget Function(BuildContext context, TextStyle textStyle, TextStyle labelStyle) builder;
|
||||
|
||||
@@ -59,7 +59,7 @@ class ListItemStyleWrapper extends StatelessWidget {
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: height == null ? 12 : 0),
|
||||
child: builder(context, textStyle, labelStyle))))),
|
||||
if(iconPath != null && isLastInSection == false) Container(
|
||||
color: theme.colorScheme.surfaceContainer,
|
||||
|
||||
@@ -19,6 +19,8 @@ class ListItemRegularRowWidget extends StatelessWidget {
|
||||
this.truncateTrailingText = false,
|
||||
this.foregroundColor,
|
||||
this.trailingIconSize,
|
||||
this.bottomWidget,
|
||||
this.trailingWidget
|
||||
});
|
||||
|
||||
final String keyValue;
|
||||
@@ -31,6 +33,8 @@ class ListItemRegularRowWidget extends StatelessWidget {
|
||||
final bool isLastInSection;
|
||||
final bool showArrow;
|
||||
final String? trailingIconPath;
|
||||
final Widget? bottomWidget;
|
||||
final Widget? trailingWidget;
|
||||
final bool truncateTrailingText;
|
||||
final Color? foregroundColor;
|
||||
final double? trailingIconSize;
|
||||
@@ -38,74 +42,84 @@ class ListItemRegularRowWidget extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final trailingTextToShow = truncateTrailingText && trailingText != null && trailingText!.length > 20
|
||||
? "${trailingText!.substring(0, 17)}..."
|
||||
: trailingText;
|
||||
final trailingTextToShow =
|
||||
truncateTrailingText && trailingText != null && trailingText!.length > 20
|
||||
? "${trailingText!.substring(0, 17)}..."
|
||||
: trailingText;
|
||||
|
||||
return ListItemStyleWrapper(
|
||||
onTap: onTap,
|
||||
iconPath: iconPath,
|
||||
isFirstInSection: isFirstInSection,
|
||||
isLastInSection: isLastInSection,
|
||||
height: subtitle != null ? 64 : 50,
|
||||
builder: (context, textStyle, labelStyle) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
if(iconPath != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 12.0),
|
||||
child: CakeImageWidget(imageUrl: iconPath!, width: 24,height: 24,)
|
||||
),
|
||||
Flexible(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label, style: foregroundColor == null ? textStyle : textStyle.copyWith(color: foregroundColor)),
|
||||
if (subtitle != null)
|
||||
Text(
|
||||
subtitle!,
|
||||
style: labelStyle.copyWith(fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
if (trailingTextToShow != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: Text(
|
||||
trailingTextToShow,
|
||||
style: labelStyle,
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
if (iconPath != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 12.0),
|
||||
child: CakeImageWidget(imageUrl: iconPath!, width: 24,height: 24,)
|
||||
),
|
||||
Flexible(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label,
|
||||
style: foregroundColor == null
|
||||
? textStyle
|
||||
: textStyle.copyWith(color: foregroundColor)),
|
||||
if (subtitle != null)
|
||||
Text(
|
||||
subtitle!,
|
||||
style: labelStyle.copyWith(fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if(trailingIconPath != null)
|
||||
CakeImageWidget(imageUrl:
|
||||
trailingIconPath!,
|
||||
height: trailingIconSize ?? 18,
|
||||
width:trailingIconSize ?? 18,
|
||||
colorFilter: ColorFilter.mode(foregroundColor ?? Theme.of(context).colorScheme.onSurfaceVariant,BlendMode.srcIn),
|
||||
)
|
||||
else if(showArrow)
|
||||
CakeImageWidget(imageUrl:
|
||||
"assets/new-ui/arrow_forward.svg",
|
||||
height: 14,
|
||||
color: theme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
if (trailingTextToShow != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: Text(
|
||||
trailingTextToShow,
|
||||
style: labelStyle,
|
||||
),
|
||||
),
|
||||
if (trailingWidget != null)
|
||||
trailingWidget!
|
||||
else if (trailingIconPath != null)
|
||||
CakeImageWidget(imageUrl:
|
||||
trailingIconPath!,
|
||||
height: trailingIconSize ?? 18,
|
||||
width:trailingIconSize ?? 18,
|
||||
colorFilter: ColorFilter.mode(foregroundColor ?? Theme.of(context).colorScheme.onSurfaceVariant,BlendMode.srcIn),
|
||||
)
|
||||
else if (showArrow)
|
||||
CakeImageWidget(imageUrl:
|
||||
"assets/new-ui/arrow_forward.svg",
|
||||
height: 14,
|
||||
color: theme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
if (bottomWidget != null) bottomWidget!
|
||||
],
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ class _ListItemTextFieldWidgetState extends State<ListItemTextFieldWidget> {
|
||||
return ListItemStyleWrapper(
|
||||
isFirstInSection: widget.isFirstInSection,
|
||||
isLastInSection: widget.isLastInSection,
|
||||
height:50,
|
||||
builder: (context, textStyle, labelStyle) {
|
||||
return Row(
|
||||
children: [
|
||||
|
||||
@@ -104,6 +104,8 @@ class NewListSections extends StatelessWidget {
|
||||
truncateTrailingText: item.truncateTrailingText,
|
||||
foregroundColor: item.foregroundColor,
|
||||
trailingIconSize: item.trailingIconSize,
|
||||
trailingWidget: item.trailingWidget,
|
||||
bottomWidget: item.bottomWidget,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user