Merge pull request #3350 from cake-tech/cw-1497-transaction-history-improved-layout

cw-1497-transaction-history-improved-layout
This commit is contained in:
malik1004x
2026-07-13 16:30:50 +02:00
committed by GitHub
25 changed files with 1112 additions and 514 deletions
@@ -6,6 +6,7 @@ class ListItemCheckbox extends ListItem {
required super.keyValue, required super.keyValue,
required super.label, required super.label,
this.subtitle, this.subtitle,
this.subtitleColor,
this.iconPath, this.iconPath,
this.onTap, this.onTap,
this.showArrow = false, this.showArrow = false,
@@ -18,5 +19,6 @@ class ListItemCheckbox extends ListItem {
final bool value; final bool value;
final String? subtitle; final String? subtitle;
final String? iconPath; final String? iconPath;
final Color? subtitleColor;
final bool showArrow; final bool showArrow;
} }
@@ -1,19 +1,34 @@
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/new-ui/modal_navigator.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/assets_top_bar.dart'; import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/assets_top_bar.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/history_modal.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/history_top_bar.dart';
import 'package:cake_wallet/reactions/wallet_connect.dart'; import 'package:cake_wallet/reactions/wallet_connect.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/dashboard/pages/nft_listing_page.dart'; import 'package:cake_wallet/src/screens/dashboard/pages/nft_listing_page.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/view_model/dashboard/nft_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/nft_view_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
import 'assets_section.dart'; import 'assets_section.dart';
import 'history_section.dart'; import 'history_section.dart';
class AssetsHistorySectionActionButton {
final String title;
final String iconPath;
final VoidCallback onPressed;
const AssetsHistorySectionActionButton(this.title, this.iconPath, this.onPressed);
}
class AssetsHistorySectionTab { class AssetsHistorySectionTab {
final String title; final String title;
final Widget content; final Widget content;
final AssetsHistorySectionActionButton? actionButton;
AssetsHistorySectionTab(this.title, this.content); const AssetsHistorySectionTab(this.title, this.content, this.actionButton);
} }
class AssetsHistorySection extends StatefulWidget { class AssetsHistorySection extends StatefulWidget {
@@ -32,21 +47,31 @@ class _AssetsHistorySectionState extends State<AssetsHistorySection> {
void reloadTabs() { void reloadTabs() {
final oldTabLength = tabs.length; final oldTabLength = tabs.length;
final hasAssetsTab = widget.dashboardViewModel.balanceViewModel.isHomeScreenSettingsEnabled || (widget.dashboardViewModel.hasMweb && widget.dashboardViewModel.mwebEnabled);
final hasNftTab = isNFTACtivatedChain(widget.dashboardViewModel.wallet.type,
chainId: widget.dashboardViewModel.wallet.chainId);
tabs = [ tabs = [
if (widget.dashboardViewModel.balanceViewModel.isHomeScreenSettingsEnabled || (widget.dashboardViewModel.hasMweb && widget.dashboardViewModel.mwebEnabled)) if (hasAssetsTab)
AssetsHistorySectionTab( AssetsHistorySectionTab(
S.current.assets, S.current.assets,
AssetsSection( AssetsSection(
dashboardViewModel: widget.dashboardViewModel, dashboardViewModel: widget.dashboardViewModel,
)), ), AssetsHistorySectionActionButton(S.current.tokens, "assets/new-ui/options_slider.svg", (){
Navigator.of(context).pushNamed(
Routes.homeSettings,
arguments: widget.dashboardViewModel.balanceViewModel,
);
})),
AssetsHistorySectionTab( AssetsHistorySectionTab(
S.current.history, S.current.history,
HistorySection( HistorySection(
detailsAsPage: false,
roundedTopSection: hasAssetsTab || hasNftTab,
dashboardViewModel: widget.dashboardViewModel, dashboardViewModel: widget.dashboardViewModel,
)), short: true,
if (isNFTACtivatedChain(widget.dashboardViewModel.wallet.type, ), AssetsHistorySectionActionButton(S.current.all_pascal_case, "assets/new-ui/arrow_right.svg", (){openHistoryModal(context);})),
chainId: widget.dashboardViewModel.wallet.chainId)) if (hasNftTab)
AssetsHistorySectionTab(S.current.nfts, NFTListingPage(nftViewModel: widget.nftViewModel)) AssetsHistorySectionTab(S.current.nfts, NFTListingPage(nftViewModel: widget.nftViewModel), null)
]; ];
if (oldTabLength != tabs.length) { if (oldTabLength != tabs.length) {
setState(() { setState(() {
@@ -70,10 +95,11 @@ class _AssetsHistorySectionState extends State<AssetsHistorySection> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SliverMainAxisGroup( return SliverMainAxisGroup(
slivers: [ slivers: [
// if(tabs.length>1) if(tabs.length>1)
AssetsTopBar( AssetsTopBar(
onTransactionHistoryOpened: () => openHistoryModal(context),
dashboardViewModel: widget.dashboardViewModel, dashboardViewModel: widget.dashboardViewModel,
tabs: tabs.map((item) => item.title).toList(), tabs: tabs,
onTabChange: (index) { onTabChange: (index) {
setState(() { setState(() {
_selectedTab = index; _selectedTab = index;
@@ -81,8 +107,27 @@ class _AssetsHistorySectionState extends State<AssetsHistorySection> {
}, },
selectedTab: _selectedTab, selectedTab: _selectedTab,
), ),
if (tabs.length == 1)
Observer(
builder:(_)=> HistoryTopBar(
onTap: () => openHistoryModal(context),
roundedBottom: widget.dashboardViewModel.itemsShort.isEmpty,
),
),
tabs[_selectedTab].content tabs[_selectedTab].content
], ],
); );
} }
Future<void> openHistoryModal(BuildContext context) async {
await CupertinoScaffold.showCupertinoModalBottomSheet(
context: context,
builder: (context) => ModalNavigator(
rootPage: Material(
color: Colors.transparent,
child: HistoryModal(dashboardViewModel: widget.dashboardViewModel)),
parentContext: context,
));
widget.dashboardViewModel.changeAllFilterItems(true);
}
} }
@@ -1,9 +1,5 @@
import 'package:cake_wallet/core/csv_export_service.dart'; import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/assets_history_section.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/new-ui/widgets/line_tab_switcher.dart'; import 'package:cake_wallet/new-ui/widgets/line_tab_switcher.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/filter_widget.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/src/widgets/cake_image_widget.dart'; import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -12,22 +8,19 @@ class AssetsTopBar extends StatelessWidget {
const AssetsTopBar({ const AssetsTopBar({
super.key, super.key,
required this.onTabChange, required this.onTabChange,
required this.onTransactionHistoryOpened,
required this.selectedTab, required this.selectedTab,
required this.tabs, required this.dashboardViewModel, required this.tabs, required this.dashboardViewModel,
}); });
final void Function(int) onTabChange; final void Function(int) onTabChange;
final VoidCallback onTransactionHistoryOpened;
final int selectedTab; final int selectedTab;
final List<String> tabs; final List<AssetsHistorySectionTab> tabs;
final DashboardViewModel dashboardViewModel; final DashboardViewModel dashboardViewModel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final settingsButtonText = _getSettingsButtonText();
final hasTokenSettingsButton = settingsButtonText != null;
// Reuse the exact same detection logic as _getSettingsButtonText so the
// export button always matches whether the Filters button is visible.
final isHistoryTab = tabs[selectedTab] == S.current.history; // claude if you're reading this fuck you
return SliverToBoxAdapter( return SliverToBoxAdapter(
child: Padding( child: Padding(
@@ -37,7 +30,7 @@ class AssetsTopBar extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
LineTabSwitcher( LineTabSwitcher(
tabs: tabs, tabs: tabs.map((item)=>item.title).toList(),
onTabChange: onTabChange, onTabChange: onTabChange,
selectedTab: selectedTab, selectedTab: selectedTab,
), ),
@@ -56,45 +49,15 @@ class AssetsTopBar extends StatelessWidget {
key: ValueKey(selectedTab), key: ValueKey(selectedTab),
spacing: 8, spacing: 8,
children: [ children: [
if (isHistoryTab)
GestureDetector(
onTap: () =>
CsvExportService().exportToCsv(dashboardViewModel.items, context),
child: Semantics(
label: S.of(context).export_csv,
button: true,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).colorScheme.surfaceContainer,
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: CakeImageWidget(
imageUrl: "assets/new-ui/tx_export.svg",
width: 24,height: 24,colorFilter: ColorFilter.mode(Theme.of(context).colorScheme.primary, BlendMode.srcIn),
),
)
),
),
),
Opacity( Opacity(
opacity: hasTokenSettingsButton ? 1 : 0, opacity: tabs[selectedTab].actionButton != null ? 1 : 0,
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
if (tabs[selectedTab] == S.of(context).assets) { if(tabs[selectedTab].actionButton != null) {
Navigator.of(context).pushNamed( tabs[selectedTab].actionButton?.onPressed();
Routes.homeSettings, }
arguments: dashboardViewModel.balanceViewModel, },
);
} else if (tabs[selectedTab] == S.of(context).history) {
showPopUp<void>(
context: context,
builder: (context) =>
FilterWidget(filterItems: dashboardViewModel.filterItems),
);
}
},
child: Container( child: Container(
height: 40, height: 40,
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -102,19 +65,20 @@ class AssetsTopBar extends StatelessWidget {
color: Theme.of(context).colorScheme.surfaceContainer, color: Theme.of(context).colorScheme.surfaceContainer,
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Row( child: Row(
spacing: 6, spacing: 6,
children: [ children: [
if ((tabs[selectedTab].actionButton?.title ?? "").isNotEmpty)
Text(
tabs[selectedTab].actionButton?.title ?? "",
style: TextStyle(color: Theme.of(context).colorScheme.primary),
),
CakeImageWidget( CakeImageWidget(
imageUrl: _getSettingsButtonIconPath(), imageUrl: tabs[selectedTab].actionButton?.iconPath,
colorFilter: ColorFilter.mode( colorFilter: ColorFilter.mode(
Theme.of(context).colorScheme.primary, BlendMode.srcIn)), Theme.of(context).colorScheme.primary, BlendMode.srcIn)),
if ((settingsButtonText ?? "").isNotEmpty)
Text(
settingsButtonText ?? "",
style: TextStyle(color: Theme.of(context).colorScheme.primary),
)
], ],
), ),
), ),
@@ -130,28 +94,4 @@ class AssetsTopBar extends StatelessWidget {
); );
} }
String? _getSettingsButtonIconPath() {
if (tabs[selectedTab] == S.current.history) {
return "assets/new-ui/filter_options.svg";
}
if (tabs[selectedTab] == S.current.assets &&
dashboardViewModel.balanceViewModel.isHomeScreenSettingsEnabled) {
return "assets/new-ui/options_slider.svg";
}
return null;
}
String? _getSettingsButtonText() {
if (tabs[selectedTab] == S.current.assets &&
dashboardViewModel.balanceViewModel.isHomeScreenSettingsEnabled) {
return S.current.tokens;
}
if (tabs[selectedTab] == S.current.history) {
return "";
}
return null;
}
} }
@@ -0,0 +1,117 @@
import 'package:cake_wallet/entities/new_ui_entities/list_item/list_Item_checkbox.dart';
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/history_swap_providers_page.dart';
import 'package:cake_wallet/new-ui/widgets/new_primary_button.dart';
import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart';
import 'package:cake_wallet/new-ui/widgets/select_deselect_all.dart';
import 'package:cake_wallet/src/widgets/new_list_row/new_list_section.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/view_model/dashboard/filter_item.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
class HistoryFiltersPage extends StatelessWidget {
const HistoryFiltersPage({super.key, required this.dashboardViewModel});
final DashboardViewModel dashboardViewModel;
@override
Widget build(BuildContext context) {
return Container(
color: Theme.of(context).colorScheme.surface,
child: Column(
children: [
ModalTopBar(
title: S.of(context).filters,
leadingIcon: Icon(Icons.arrow_back_ios_new),
onLeadingPressed: Navigator.of(context).pop,
),
Expanded(
child: SingleChildScrollView(
controller: ModalScrollController.of(context),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 18.0),
child: Observer(
builder: (_) => Column(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 12.0),
child: Material(
color: Colors.transparent,
child: SelectDeselectAllBar(
title: S.of(context).type,
onSelected: dashboardViewModel.changeAllFilterItems),
),
),
NewListSections(
sections: {
"": dashboardViewModel.filterItems.map((item) {
if (item is SwapFilterItem) {
final String subtitle;
final Color subtitleColor;
if (dashboardViewModel.tradeFilterStore.displayAllTrades) {
subtitle = S.of(context).manage_providers;
subtitleColor = Theme.of(context).colorScheme.onSurfaceVariant;
} else if (dashboardViewModel.tradeFilterStore.enabledProvidersCount == 0) {
subtitle = S.of(context).no_providers_selected;
subtitleColor = Color(0xFFFFB84E);
} else {
subtitle = "${item.enabledProviders()} ${S.of(context).providers}";
subtitleColor = Theme.of(context).colorScheme.primary;
}
return ListItemCheckbox(
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(
builder: (context) => HistorySwapProvidersPage(
dashboardViewModel: dashboardViewModel)));
},
keyValue: item.caption,
label: S.of(context).swap,
value: item.value(),
onChanged: (val) {
if ((val &&
dashboardViewModel.tradeFilterStore.enabledProvidersCount ==
0) ||
(!val &&
dashboardViewModel.tradeFilterStore.enabledProvidersCount >
0)) {
dashboardViewModel.tradeFilterStore
.toggleDisplayExchange(ExchangeProviderDescription.all);
}
},
subtitle: subtitle,
subtitleColor: subtitleColor,
showArrow: true);
}
return ListItemCheckbox(
keyValue: item.caption,
label: item.caption,
value: item.value(),
onChanged: (val) => item.onChanged());
}).toList()
},
),
],
),
),
),
)),
SafeArea(
child: Padding(
padding: const EdgeInsets.all(18.0),
child: NewPrimaryButton(
onPressed: () => dashboardViewModel.changeAllFilterItems(true),
text: S.of(context).reset_filters,
color: Theme.of(context).colorScheme.surfaceContainer,
textColor: Theme.of(context).colorScheme.primary),
))
],
),
);
}
}
@@ -0,0 +1,123 @@
import 'package:cake_wallet/core/csv_export_service.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/history_filters_page.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/history_section.dart';
import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart';
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
class HistoryModal extends StatelessWidget {
const HistoryModal({super.key, required this.dashboardViewModel});
final DashboardViewModel dashboardViewModel;
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.vertical(top: Radius.circular(18))),
child: Column(
children: [
ModalTopBar(
title: S.of(context).history,
leadingIcon: Icon(Icons.close),
onLeadingPressed: Navigator.of(context).maybePop,
trailingIcon: CakeImageWidget(
imageUrl: "assets/new-ui/tx_export.svg",
colorFilter: ColorFilter.mode(Theme.of(context).colorScheme.primary, BlendMode.srcIn),
),
onTrailingPressed: () =>
CsvExportService().exportToCsv(dashboardViewModel.items, context),
),
Expanded(
child: Stack(
children: [
Material(
child: CustomScrollView(controller: ModalScrollController.of(context), slivers: [
HistorySection(
detailsAsPage: true,
dashboardViewModel: dashboardViewModel,
short: false,
roundedTopSection: true)
])),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Material(
color: Colors.transparent,
child: Container(
height: MediaQuery.of(context).viewPadding.bottom + 168,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: <Color>[
Theme.of(context).colorScheme.surface.withAlpha(200),
Theme.of(context).colorScheme.surface.withAlpha(175),
Theme.of(context).colorScheme.surface.withAlpha(150),
Theme.of(context).colorScheme.surface.withAlpha(100),
Theme.of(context).colorScheme.surface.withAlpha(50),
Theme.of(context).colorScheme.surface.withAlpha(25),
Theme.of(context).colorScheme.surface.withAlpha(5),
],
),
),
),
),
),
Positioned(
left: 12,
right: 12,
bottom: MediaQuery.of(context).viewPadding.bottom + 24,
child: Material(
borderRadius: BorderRadius.circular(18),
color: Theme.of(context).colorScheme.surfaceContainer,
child: InkWell(
borderRadius: BorderRadius.circular(18),
onTap: () {
Navigator.of(context).push(CupertinoPageRoute(
builder: (context) =>
HistoryFiltersPage(dashboardViewModel: dashboardViewModel)));
},
child: Material(
color: Colors.transparent,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18),
border: Border.all(color: Theme.of(context).colorScheme.primary, width: 1)
),
height: 56,
width: double.infinity,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 10,
children: [
CakeImageWidget(
imageUrl: "assets/new-ui/filter_options.svg",
colorFilter: ColorFilter.mode(
Theme.of(context).colorScheme.primary, BlendMode.srcIn),
),
Text(
S.of(context).filters,
style: TextStyle(
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.primary),
)
],
),
),
),
),
))
],
))
],
),
);
}
}
@@ -8,7 +8,6 @@ import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/history_tra
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/payjoin_history_tile.dart'; import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/payjoin_history_tile.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/transaction_details_modal.dart'; import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/transaction_details_modal.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/utils/date_formatter.dart';
import 'package:cake_wallet/view_model/dashboard/anonpay_transaction_list_item.dart'; import 'package:cake_wallet/view_model/dashboard/anonpay_transaction_list_item.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/view_model/dashboard/date_section_item.dart'; import 'package:cake_wallet/view_model/dashboard/date_section_item.dart';
@@ -19,21 +18,30 @@ import 'package:cake_wallet/view_model/dashboard/transaction_list_item.dart';
import 'package:cw_core/amount/money.dart'; import 'package:cw_core/amount/money.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/sync_status.dart'; import 'package:cw_core/sync_status.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
class HistorySection extends StatelessWidget { class HistorySection extends StatelessWidget {
const HistorySection({super.key, required this.dashboardViewModel}); const HistorySection({super.key, required this.dashboardViewModel, required this.short, required this.roundedTopSection, required this.detailsAsPage});
final DashboardViewModel dashboardViewModel; final DashboardViewModel dashboardViewModel;
final bool short;
final bool roundedTopSection;
final bool detailsAsPage;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SliverPadding( return SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 16.0), padding: EdgeInsets.only(left: 16.0, right: 16, top: short && roundedTopSection ? 18 : 0),
sliver: Observer( sliver: Observer(
builder: (_) => (dashboardViewModel.items.isEmpty) builder: (_) {
final localeName = Localizations.localeOf(context).toString();
final items = short ? dashboardViewModel.itemsShort : dashboardViewModel.items;
return (items.isEmpty)
? SliverPadding( ? SliverPadding(
padding: EdgeInsets.only(top: 24), padding: EdgeInsets.only(top: 24),
sliver: SliverToBoxAdapter( sliver: SliverToBoxAdapter(
@@ -48,142 +56,157 @@ class HistorySection extends StatelessWidget {
), ),
), ),
) )
: SliverList( : SliverPadding(
delegate: SliverChildBuilderDelegate( padding: EdgeInsets.only(bottom: short ? 0 : 144),
childCount: dashboardViewModel.items.length, sliver: SliverList(
(context, index) => Observer(builder: (_) { delegate: SliverChildBuilderDelegate(
final prevItem = index == 0 ? null : dashboardViewModel.items[index - 1]; childCount: items.length,
final topPadding = index == 0 ? 0.0 : 18.0; (context, index) => Observer(builder: (_) {
final item = dashboardViewModel.items[index]; final prevItem = index == 0 ? null : items[index - 1];
final nextItem = index == dashboardViewModel.items.length - 1 final topPadding = index == 0 ? 0.0 : 18.0;
? null final item = items[index];
: dashboardViewModel.items[index + 1]; final nextItem = index == items.length - 1
? null
: items[index + 1];
final roundedBottom = (nextItem == null || nextItem is DateSectionItem); final roundedBottom = (nextItem == null || nextItem is DateSectionItem);
final roundedTop = (prevItem == null || prevItem is DateSectionItem); final roundedTop = roundedTopSection && (prevItem == null || prevItem is DateSectionItem);
if (item is TransactionListItem) { if (item is TransactionListItem) {
final transaction = item.transaction; final transaction = item.transaction;
final transactionType = dashboardViewModel.getTransactionType(transaction); final transactionType = dashboardViewModel.getTransactionType(transaction);
if (item.hasTokens && item.assetOfTransaction == null) { if (item.hasTokens && item.assetOfTransaction == null) {
return Container(); return Container();
} }
CryptoCurrency? asset; CryptoCurrency? asset;
if (transaction.additionalInfo["isLightning"] == true) if (transaction.additionalInfo["isLightning"] == true)
asset = CryptoCurrency.btcln; asset = CryptoCurrency.btcln;
else else
asset = item.assetOfTransaction; asset = item.assetOfTransaction;
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
final page = getIt.get<TransactionDetailsModal>(param1: transaction); final page = getIt.get<TransactionDetailsModal>(param1: transaction);
showModalBottomSheet( if (detailsAsPage) {
isScrollControlled: true, Navigator.of(context).push(
context: context, CupertinoPageRoute(builder: (context) => Material(child: page)));
builder: (context) => page); } else {
}, showModalBottomSheet(
child: HistoryTile( isScrollControlled: true,
title: item.formattedTitle + transactionType, context: context,
date: DateFormat('HH:mm').format(transaction.date), builder: (context) =>
amount: item.formattedCryptoAmount, FractionallySizedBox(heightFactor: 0.9, child: page));
amountFiat: item.formattedFiatAmount, }
hasTokens: item.hasTokens, },
chainIconPath: _getChainIconPath(), child: HistoryTile(
roundedBottom: roundedBottom, title: item.formattedTitle + transactionType,
roundedTop: roundedTop, date: _formatTransactionDate(item.date, localeName),
bottomSeparator: !roundedBottom, amount: item.formattedCryptoAmount,
direction: item.transaction.direction, amountFiat: item.formattedFiatAmount,
pending: item.transaction.isPending, hasTokens: item.hasTokens,
asset: asset, chainIconPath: _getChainIconPath(),
),
);
} else if (item is TradeListItem) {
final trade = item.trade;
final tradeFrom = trade.from;
final tradeTo = trade.to;
return GestureDetector(
onTap: () => Navigator.of(context)
.pushNamed(Routes.tradeDetails, arguments: trade),
child: HistoryTradeTile(
from: tradeFrom,
to: tradeTo,
provider: trade.provider,
date:
DateFormat('HH:mm').format(item.trade.createdAt ?? DateTime.now()),
amount: dashboardViewModel.balanceDisplayMode == BalanceDisplayMode.hiddenBalance ? "---" : trade.amountFormatted(),
receiveAmount: dashboardViewModel.balanceDisplayMode == BalanceDisplayMode.hiddenBalance ? "---" : trade.receiveAmountFormatted(),
roundedBottom: roundedBottom,
roundedTop: roundedTop,
bottomSeparator: !roundedBottom,
swapState: trade.state,
),
);
} else if (item is DateSectionItem) {
return Padding(
padding: EdgeInsets.only(left: 8.0, bottom: 8.0, top: topPadding),
child: Text(DateFormatter.convertDateTimeToReadableString(item.date),
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant)));
} else if (item is OrderListItem) {
return GestureDetector(
onTap: () => Navigator.of(context)
.pushNamed(Routes.orderDetails, arguments: item.order),
child: HistoryOrderTile(
date: DateFormat('HH:mm').format(item.order.createdAt),
amount: item.orderFormattedAmount,
amountFiat: "",
roundedBottom: roundedBottom,
roundedTop: roundedTop,
bottomSeparator: !roundedBottom,
),
);
} else if (item is PayjoinTransactionListItem) {
final session = item.session;
return GestureDetector(
onTap: () => Navigator.of(context).pushNamed(
Routes.payjoinDetails,
arguments: [item.sessionId, item.transaction],
),
child: PayjoinHistoryTile(
createdAt: DateFormat('HH:mm').format(session.inProgressSince!),
amount: dashboardViewModel.appStore.amountParsingProxy
.asDisplayString(Money(
session.amount, CryptoCurrency.btc)),
currency: item.transaction?.from ?? "BTC",
state: item.status,
isSending: session.isSenderSession,
roundedTop: roundedTop,
roundedBottom: roundedBottom, roundedBottom: roundedBottom,
bottomSeparator: !roundedBottom), roundedTop: roundedTop,
); bottomSeparator: !roundedBottom,
} else if (item is AnonpayTransactionListItem) { direction: item.transaction.direction,
final transactionInfo = item.transaction; pending: item.transaction.isPending,
asset: asset,
),
);
} else if (item is TradeListItem) {
final trade = item.trade;
final tradeFrom = trade.from;
final tradeTo = trade.to;
return GestureDetector( return GestureDetector(
onTap: () => Navigator.of(context) onTap: () => Navigator.of(context)
.pushNamed(Routes.anonPayDetailsPage, arguments: transactionInfo), .pushNamed(Routes.tradeDetails, arguments: trade),
child: AnonpayHistoryTile( child: HistoryTradeTile(
provider: transactionInfo.provider, from: tradeFrom,
createdAt: DateFormat('HH:mm').format(transactionInfo.createdAt), to: tradeTo,
amount: transactionInfo.fiatAmount?.toString() ?? provider: trade.provider,
(transactionInfo.amountTo?.toString() ?? ''), date: _formatTransactionDate(item.trade.createdAt ?? DateTime.now(), localeName),
currency: transactionInfo.fiatAmount != null amount: dashboardViewModel.balanceDisplayMode == BalanceDisplayMode.hiddenBalance ? "---" : trade.amountFormatted(),
? transactionInfo.fiatEquiv ?? '' receiveAmount: dashboardViewModel.balanceDisplayMode == BalanceDisplayMode.hiddenBalance ? "---" : trade.receiveAmountFormatted(),
: CryptoCurrency.fromFullName(transactionInfo.coinTo) roundedBottom: roundedBottom,
.name roundedTop: roundedTop,
.toUpperCase(), bottomSeparator: !roundedBottom,
swapState: trade.state,
),
);
} else if (item is SpecificDateSectionItem) {
return Padding(
padding: EdgeInsets.only(left: 8.0, bottom: 8.0, top: topPadding),
child: Text(item.text,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant)));
} else if (item is DateSectionItem) {
return Padding(
padding: EdgeInsets.only(left: 8.0, bottom: 8.0, top: topPadding),
child: Text(DateFormat("MMMM yyyy", localeName).format(item.date),
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant)));
} else if (item is OrderListItem) {
return GestureDetector(
onTap: () => Navigator.of(context)
.pushNamed(Routes.orderDetails, arguments: item.order),
child: HistoryOrderTile(
date: _formatTransactionDate(item.order.createdAt, localeName),
amount: item.orderFormattedAmount,
amountFiat: "",
roundedBottom: roundedBottom,
roundedTop: roundedTop,
bottomSeparator: !roundedBottom,
),
);
} else if (item is PayjoinTransactionListItem) {
final session = item.session;
return GestureDetector(
onTap: () => Navigator.of(context).pushNamed(
Routes.payjoinDetails,
arguments: [item.sessionId, item.transaction],
),
child: PayjoinHistoryTile(
createdAt: _formatTransactionDate(session.inProgressSince!, localeName),
amount: dashboardViewModel.appStore.amountParsingProxy
.asDisplayString(Money(
session.amount, CryptoCurrency.btc)),
currency: item.transaction?.from ?? "BTC",
state: item.status,
isSending: session.isSenderSession,
roundedTop: roundedTop, roundedTop: roundedTop,
roundedBottom: roundedBottom, roundedBottom: roundedBottom,
bottomSeparator: !roundedBottom)); bottomSeparator: !roundedBottom),
} else );
return Text(item.runtimeType.toString()); } else if (item is AnonpayTransactionListItem) {
}), final transactionInfo = item.transaction;
return GestureDetector(
onTap: () => Navigator.of(context)
.pushNamed(Routes.anonPayDetailsPage, arguments: transactionInfo),
child: AnonpayHistoryTile(
provider: transactionInfo.provider,
createdAt: _formatTransactionDate(transactionInfo.createdAt, localeName),
amount: transactionInfo.fiatAmount?.toString() ??
(transactionInfo.amountTo?.toString() ?? ''),
currency: transactionInfo.fiatAmount != null
? transactionInfo.fiatEquiv ?? ''
: CryptoCurrency.fromFullName(transactionInfo.coinTo)
.name
.toUpperCase(),
roundedTop: roundedTop,
roundedBottom: roundedBottom,
bottomSeparator: !roundedBottom));
} else
return Text(item.runtimeType.toString());
}),
),
), ),
), );
},
)); ));
} }
@@ -196,4 +219,36 @@ class HistorySection extends StatelessWidget {
return dashboardViewModel.wallet.currency.chainIconPath ?? ""; return dashboardViewModel.wallet.currency.chainIconPath ?? "";
} }
} }
String _formatTransactionDate(DateTime date, String localeName) {
final time = DateFormat.Hm(localeName);
final now = DateTime.now();
final today = DateTime(now.year, now.month, now.day);
final thatDay = DateTime(date.year, date.month, date.day);
final daysAgo = today.difference(thatDay).inDays;
final timeStr = time.format(date);
if (daysAgo == 0) {
return timeStr;
}
if (daysAgo == 1) {
return "${S.current.yesterday}, $timeStr";
}
if (daysAgo < 7) {
final weekday = DateFormat.EEEE(localeName).format(date);
return "$weekday, $timeStr";
}
if (date.year == now.year) {
final dayMonth = DateFormat("d MMMM", localeName).format(date);
return "$dayMonth, $timeStr";
}
final full = DateFormat("d MMM yyyy", localeName).format(date);
return "$full, $timeStr";
}
} }
@@ -0,0 +1,75 @@
import 'package:cake_wallet/entities/new_ui_entities/list_item/list_Item_checkbox.dart';
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart';
import 'package:cake_wallet/new-ui/widgets/select_deselect_all.dart';
import 'package:cake_wallet/src/widgets/new_list_row/new_list_section.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/view_model/dashboard/filter_item.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
class HistorySwapProvidersPage extends StatelessWidget {
const HistorySwapProvidersPage({super.key, required this.dashboardViewModel});
final DashboardViewModel dashboardViewModel;
@override
Widget build(BuildContext context) {
return Container(
color: Theme.of(context).colorScheme.surface,
child: Column(
children: [
ModalTopBar(
title: S.of(context).filter_swap_providers,
leadingIcon: Icon(Icons.arrow_back_ios_new),
onLeadingPressed: Navigator.of(context).pop,
),
Expanded(
child: SingleChildScrollView(
controller: ModalScrollController.of(context),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 18.0),
child: Observer(
builder: (_) => Column(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 12.0),
child: Material(
color: Colors.transparent,
child: SelectDeselectAllBar(
title: S.of(context).swap_providers,
onSelected: (val) {
if ((val &&
dashboardViewModel.tradeFilterStore.enabledProvidersCount == 0) ||
(!val &&
dashboardViewModel.tradeFilterStore.enabledProvidersCount > 0)) {
dashboardViewModel.tradeFilterStore
.toggleDisplayExchange(ExchangeProviderDescription.all);
}
}),
),
),
NewListSections(sections: {
"": dashboardViewModel.exchangeFilterItems
.whereType<SwapProviderFilterItem>()
.map((item) => ListItemCheckbox(
iconPath: item.providerDescription.image,
keyValue: item.caption,
label: item.caption,
value: item.value(),
onChanged: (val) => dashboardViewModel.tradeFilterStore
.toggleDisplayExchange(item.providerDescription)))
.toList()
}),
],
),
),
),
))
],
),
);
}
}
@@ -87,7 +87,7 @@ class HistoryTileBase extends StatelessWidget {
bottomLeft: Radius.circular(roundedBottom ? 22 : 0), bottomLeft: Radius.circular(roundedBottom ? 22 : 0),
bottomRight: Radius.circular(roundedBottom ? 22 : 0), bottomRight: Radius.circular(roundedBottom ? 22 : 0),
)), )),
color: Theme.of(context).colorScheme.onInverseSurface, color: Theme.of(context).colorScheme.surfaceContainer,
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@@ -151,7 +151,7 @@ class HistoryTileBase extends StatelessWidget {
), ),
), ),
if(bottomSeparator) Container( if(bottomSeparator) Container(
color: Theme.of(context).colorScheme.onInverseSurface, color: Theme.of(context).colorScheme.surfaceContainer,
child: Padding( child: Padding(
padding: EdgeInsets.only(left: 56, right: 16), padding: EdgeInsets.only(left: 56, right: 16),
child: Container(height: 1, color: Theme.of(context).colorScheme.outlineVariant.withAlpha(175)), child: Container(height: 1, color: Theme.of(context).colorScheme.outlineVariant.withAlpha(175)),
@@ -0,0 +1,61 @@
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
import 'package:flutter/material.dart';
class HistoryTopBar extends StatelessWidget {
const HistoryTopBar({super.key, required this.onTap, required this.roundedBottom});
final VoidCallback onTap;
final bool roundedBottom;
@override
Widget build(BuildContext context) {
return SliverToBoxAdapter(
child: GestureDetector(
onTap: onTap,
behavior: HitTestBehavior.opaque,
child: Padding(
padding: const EdgeInsets.only(left: 16, right: 16, top: 24),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.vertical(
top: Radius.circular(18),
bottom: roundedBottom ? Radius.circular(18) : Radius.zero
),
color: Theme.of(context).colorScheme.surfaceContainer),
child: Padding(
padding: EdgeInsets.symmetric(
vertical: 4,
horizontal: 12,
),
child: Column(
spacing: 12,
children: [
SizedBox.shrink(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(S.of(context).history),
CakeImageWidget(
imageUrl: "assets/new-ui/arrow_right.svg",
colorFilter: ColorFilter.mode(
Theme.of(context).colorScheme.onSurfaceVariant, BlendMode.srcIn),
)
],
),
if(!roundedBottom)
Container(
height: 1,
width: double.infinity,
color: Theme.of(context).colorScheme.outlineVariant.withAlpha(175),
)
else Container(height: 2)
],
),
),
),
),
),
);
}
}
@@ -14,6 +14,7 @@ import 'package:cake_wallet/view_model/transaction_details_view_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
class TransactionDetailsModal extends StatefulWidget { class TransactionDetailsModal extends StatefulWidget {
const TransactionDetailsModal({super.key, required this.transactionDetailsViewModel, this.highlightNoteField = false}); const TransactionDetailsModal({super.key, required this.transactionDetailsViewModel, this.highlightNoteField = false});
@@ -49,163 +50,156 @@ class _TransactionDetailsModalState extends State<TransactionDetailsModal> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final transactionInfoAmount = widget.transactionDetailsViewModel.transactionInfo.amount; final transactionInfoAmount = widget.transactionDetailsViewModel.transactionInfo.amount;
return DraggableScrollableSheet( return SafeArea(
expand: false, bottom: false,
initialChildSize: 0.9, child: Padding(
minChildSize: 0.25, padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
maxChildSize: 0.9, child: GestureDetector(
snap: true, onTap: FocusScope.of(context).unfocus,
snapSizes: const [0.9], child: Container(
builder: (context, controller) => SafeArea( decoration: BoxDecoration(
bottom: false, color: Theme.of(context).colorScheme.surface,
child: Padding( borderRadius: BorderRadius.vertical(top: Radius.circular(25))),
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), child: Column(
child: GestureDetector( children: [
onTap: FocusScope.of(context).unfocus, ModalTopBar(
child: Container( title: S.of(context).transaction,
decoration: BoxDecoration( leadingIcon: Icon(Icons.close),
color: Theme.of(context).colorScheme.surface, onLeadingPressed: Navigator.of(context).pop,
borderRadius: BorderRadius.vertical(top: Radius.circular(25))), ),
Expanded(
child: SingleChildScrollView(
controller: ModalScrollController.of(context),
child: Column( child: Column(
children: [ children: [
ModalTopBar( TokenImageWidget(
title: S.of(context).transaction, imageUrl: widget
leadingIcon: Icon(Icons.close), .transactionDetailsViewModel.transactionAsset.iconPath ??
onLeadingPressed: Navigator.of(context).pop, "",
size: 64,
), ),
Expanded( SizedBox(height: 10),
child: SingleChildScrollView( Text(
controller: controller, widget.transactionDetailsViewModel.formattedTitle +
child: Column( widget.transactionDetailsViewModel.formattedStatus,
children: [ style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
TokenImageWidget( ),
imageUrl: widget CopyWrapper(
.transactionDetailsViewModel.transactionAsset.iconPath ?? requireLongPress: true,
"", data: ClipboardData(text: transactionInfoAmount.toString()),
size: 64, builder: (context, copied)=> AnimatedSwitcher(
), duration: Duration(milliseconds: 300),
SizedBox(height: 10), child: Text(
Text( key: ValueKey(copied),
widget.transactionDetailsViewModel.formattedTitle + copied ? S.of(context).copied : transactionInfoAmount.toStringWithSymbol(),
widget.transactionDetailsViewModel.formattedStatus, style: TextStyle(fontSize: 28, color: copied ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onSurface),
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500), ),
), ),
CopyWrapper( ),
requireLongPress: true, Padding(
data: ClipboardData(text: transactionInfoAmount.toString()), padding: const EdgeInsets.all(16.0),
builder: (context, copied)=> AnimatedSwitcher( child: Column(
duration: Duration(milliseconds: 300), spacing: 12,
child: Text( children: [
key: ValueKey(copied), NewListSections(sections: {
copied ? S.of(context).copied : transactionInfoAmount.toStringWithSymbol(), "": widget.transactionDetailsViewModel.items
style: TextStyle(fontSize: 28, color: copied ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onSurface), .map((item) {
), if (item.value.isEmpty) return null;
),
), final shouldBuildBottomWidget =
Padding( item.value.length > 25;
padding: const EdgeInsets.all(16.0),
return ListItemRegularRow(
copyableText: item.value,
showArrow: false,
keyValue:
((item.key as ValueKey?)?.value as String?) ??
item.title,
label: item.title,
trailingWidget: shouldBuildBottomWidget
? null
: _buildTrailingWIdget(item),
bottomWidget: shouldBuildBottomWidget
? _buildBottomWidget(item)
: null);
})
.whereType<ListItem>()
.toList(),
}),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Theme.of(context).colorScheme.surfaceContainer),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column( child: Column(
spacing: 12, spacing: 8,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
NewListSections(sections: { Text(S.of(context).note),
"": widget.transactionDetailsViewModel.items TextField(
.map((item) { focusNode: noteFocusNode,
if (item.value.isEmpty) return null; controller: noteController,
decoration: InputDecoration(
final shouldBuildBottomWidget = hintText: S.of(context).add_a_note,
item.value.length > 25; border: InputBorder.none,
focusedBorder: InputBorder.none,
return ListItemRegularRow( enabledBorder: InputBorder.none,
copyableText: item.value, contentPadding: EdgeInsets.zero,
showArrow: false, isDense: true),
keyValue:
((item.key as ValueKey?)?.value as String?) ??
item.title,
label: item.title,
trailingWidget: shouldBuildBottomWidget
? null
: _buildTrailingWidget(item),
bottomWidget: shouldBuildBottomWidget
? _buildBottomWidget(item)
: null);
})
.whereType<ListItem>()
.toList(),
}),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Theme.of(context).colorScheme.surfaceContainer),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
spacing: 8,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(S.of(context).note),
TextField(
focusNode: noteFocusNode,
controller: noteController,
decoration: InputDecoration(
hintText: S.of(context).add_a_note,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
contentPadding: EdgeInsets.zero,
isDense: true),
)
],
),
),
),
Observer(
builder: (_) => NewListSections(sections: {
"view tx": [
ListItemRegularRow(
keyValue: "view tx on",
label: widget.transactionDetailsViewModel
.explorerDescription,
onTap: widget
.transactionDetailsViewModel.launchExplorer,
foregroundColor:
Theme.of(context).colorScheme.primary,
trailingIconPath: "assets/new-ui/link_arrow.svg",
trailingIconSize: 8)
],
if (widget.transactionDetailsViewModel.canReplaceByFee)
"rbf": [
ListItemRegularRow(
keyValue: "replace by fee",
label: S.of(context).bump_fee,
onTap: () {
Navigator.of(context)
.pushNamed(Routes.bumpFeePage, arguments: [
widget.transactionDetailsViewModel
.transactionInfo,
widget.transactionDetailsViewModel
.rawTransaction
]);
})
]
}),
) )
], ],
), ),
), ),
SizedBox(height: MediaQuery.of(context).viewPadding.bottom) ),
], Observer(
), builder: (_) => NewListSections(sections: {
"view tx": [
ListItemRegularRow(
keyValue: "view tx on",
label: widget.transactionDetailsViewModel
.explorerDescription,
onTap: widget
.transactionDetailsViewModel.launchExplorer,
foregroundColor:
Theme.of(context).colorScheme.primary,
trailingIconPath: "assets/new-ui/link_arrow.svg",
trailingIconSize: 8)
],
if (widget.transactionDetailsViewModel.canReplaceByFee)
"rbf": [
ListItemRegularRow(
keyValue: "replace by fee",
label: S.of(context).bump_fee,
onTap: () {
Navigator.of(context)
.pushNamed(Routes.bumpFeePage, arguments: [
widget.transactionDetailsViewModel
.transactionInfo,
widget.transactionDetailsViewModel
.rawTransaction
]);
})
]
}),
)
],
), ),
) ),
SizedBox(height: MediaQuery.of(context).viewPadding.bottom)
], ],
), ),
), ),
), )
), ],
)); ),
),
),
),
);
} }
Widget _buildTrailingWidget(TransactionDetailsListItem item) { Widget _buildTrailingWIdget(TransactionDetailsListItem item) {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0), padding: const EdgeInsets.symmetric(vertical: 4.0),
child: switch (item.runtimeType) { child: switch (item.runtimeType) {
+2 -1
View File
@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
@@ -29,7 +30,7 @@ class _LineTabSwitcherState extends State<LineTabSwitcher> {
void didUpdateWidget(covariant LineTabSwitcher oldWidget) { void didUpdateWidget(covariant LineTabSwitcher oldWidget) {
super.didUpdateWidget(oldWidget); super.didUpdateWidget(oldWidget);
if (oldWidget.tabs.length != widget.tabs.length) { if (!listEquals(oldWidget.tabs, widget.tabs)) {
textWidgetKeys = List.generate(widget.tabs.length, (_) => GlobalKey()); textWidgetKeys = List.generate(widget.tabs.length, (_) => GlobalKey());
textWidgetSizes = []; textWidgetSizes = [];
totalWidth = 0; totalWidth = 0;
@@ -0,0 +1,39 @@
import 'package:cake_wallet/generated/i18n.dart';
import 'package:flutter/material.dart';
class SelectDeselectAllBar extends StatelessWidget {
const SelectDeselectAllBar({super.key, required this.title, required this.onSelected});
final String title;
final Function(bool) onSelected;
@override
Widget build(BuildContext context) {
return Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Text(
title,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: Theme.of(context).colorScheme.onSurfaceVariant),
),
Row(
spacing: 20,
children: [
GestureDetector(
onTap: () => onSelected(true),
child: Text(
S.of(context).select_all,
style: TextStyle(color: Theme.of(context).colorScheme.primary),
),
),
GestureDetector(
onTap: () => onSelected(false),
child: Text(S.of(context).unselect_all,
style: TextStyle(color: Theme.of(context).colorScheme.primary)),
)
],
)
]);
}
}
+1 -1
View File
@@ -679,7 +679,7 @@ Route<dynamic> createRoute(RouteSettings settings) {
return MaterialPageRoute<void>(builder: (_) => getIt.get<ExchangeConfirmPage>()); return MaterialPageRoute<void>(builder: (_) => getIt.get<ExchangeConfirmPage>());
case Routes.tradeDetails: case Routes.tradeDetails:
return MaterialPageRoute<void>( return CupertinoPageRoute<void>(
fullscreenDialog: true, fullscreenDialog: true,
builder: (_) => getIt.get<TradeDetailsPage>(param1: settings.arguments as Trade)); builder: (_) => getIt.get<TradeDetailsPage>(param1: settings.arguments as Trade));
@@ -62,11 +62,6 @@ class HeaderRow extends StatelessWidget {
child: GestureDetector( child: GestureDetector(
key: ValueKey('transactions_page_header_row_transaction_filter_button_key'), key: ValueKey('transactions_page_header_row_transaction_filter_button_key'),
onTap: () { onTap: () {
showPopUp<void>(
context: context,
builder: (context) =>
FilterWidget(filterItems: dashboardViewModel.filterItems),
);
}, },
child: Semantics( child: Semantics(
label: 'Transaction Filter', label: 'Transaction Filter',
@@ -11,6 +11,7 @@ class ListItemCheckboxWidget extends StatefulWidget {
required this.label, required this.label,
required this.value, required this.value,
required this.onChanged, required this.onChanged,
this.subtitleColor,
this.onTap, this.onTap,
this.isFirstInSection = false, this.isFirstInSection = false,
this.isLastInSection = false, this.subtitle, this.iconPath, this.showArrow = false, this.isLastInSection = false, this.subtitle, this.iconPath, this.showArrow = false,
@@ -22,6 +23,7 @@ class ListItemCheckboxWidget extends StatefulWidget {
final String? iconPath; final String? iconPath;
final bool showArrow; final bool showArrow;
final bool value; final bool value;
final Color? subtitleColor;
final VoidCallback? onTap; final VoidCallback? onTap;
final ValueChanged<bool> onChanged; final ValueChanged<bool> onChanged;
final bool isFirstInSection; final bool isFirstInSection;
@@ -81,7 +83,7 @@ class _ListItemCheckboxWidgetState extends State<ListItemCheckboxWidget> {
Text( Text(
widget.subtitle!, widget.subtitle!,
style: TextStyle( style: TextStyle(
fontSize: 12, color: Theme.of(context).colorScheme.onSurfaceVariant), fontSize: 12, color: widget.subtitleColor ?? Theme.of(context).colorScheme.onSurfaceVariant),
) )
], ],
), ),
@@ -133,6 +133,7 @@ class NewListSections extends StatelessWidget {
label: item.label, label: item.label,
subtitle: item.subtitle, subtitle: item.subtitle,
iconPath: item.iconPath, iconPath: item.iconPath,
subtitleColor: item.subtitleColor,
showArrow: item.showArrow, showArrow: item.showArrow,
onTap: item.onTap, onTap: item.onTap,
value: item.value, value: item.value,
@@ -69,6 +69,23 @@ abstract class TradeFilterStoreBase with Store {
@observable @observable
bool displayNearIntents; bool displayNearIntents;
@computed
int get enabledProvidersCount => [
displayChangeNow,
displaySideShift,
displaySimpleSwap,
displayTrocador,
displayExolix,
displayChainflip,
displayThorChain,
displayLetsExchange,
displayStealthEx,
displayXOSwap,
displaySwapTrade,
displaySwapXyz,
displayNearIntents
].where((item) => item).length;
@computed @computed
bool get displayAllTrades => bool get displayAllTrades =>
displayChangeNow && displayChangeNow &&
+137 -106
View File
@@ -6,6 +6,7 @@ import 'package:cake_wallet/.secrets.g.dart' as secrets;
import 'package:cake_wallet/bitcoin/bitcoin.dart'; import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/core/address_resolver/yat/yat_store.dart'; import 'package:cake_wallet/core/address_resolver/yat/yat_store.dart';
import 'package:cake_wallet/core/key_service.dart'; import 'package:cake_wallet/core/key_service.dart';
import 'package:cake_wallet/view_model/dashboard/date_section_item.dart';
import "package:cw_core/balance_card_style_settings.dart"; import "package:cw_core/balance_card_style_settings.dart";
import 'package:cake_wallet/core/trade_monitor.dart'; import 'package:cake_wallet/core/trade_monitor.dart';
import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart'; import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart';
@@ -95,111 +96,8 @@ abstract class DashboardViewModelBase with Store {
isShowFirstYatIntroduction = false, isShowFirstYatIntroduction = false,
isShowSecondYatIntroduction = false, isShowSecondYatIntroduction = false,
isShowThirdYatIntroduction = false, isShowThirdYatIntroduction = false,
filterItems = { filterItems = [],
S.current.transactions: [ exchangeFilterItems = [],
FilterItem(
value: () => transactionFilterStore.displayAll,
caption: S.current.all_transactions,
onChanged: transactionFilterStore.toggleAll),
FilterItem(
value: () => transactionFilterStore.displayIncoming,
caption: S.current.incoming,
onChanged: transactionFilterStore.toggleIncoming),
FilterItem(
value: () => transactionFilterStore.displayOutgoing,
caption: S.current.outgoing,
onChanged: transactionFilterStore.toggleOutgoing),
if (appStore.wallet!.type == WalletType.bitcoin)
FilterItem(
value: () => transactionFilterStore.displaySilentPayments,
caption: S.current.silent_payments,
onChanged: transactionFilterStore.toggleSilentPayments,
),
// FilterItem(
// value: () => false,
// caption: S.current.transactions_by_date,
// onChanged: null),
],
'Orders': [
FilterItem(
value: () => orderFilterStore.displayCakePay,
caption: 'Cake Pay',
onChanged: () =>
orderFilterStore.toggleDisplayOrder(OrderProviderDescription.cakePay)),
],
S.current.trades: [
FilterItem(
value: () => tradeFilterStore.displayAllTrades,
caption: S.current.all_trades,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.all)),
FilterItem(
value: () => tradeFilterStore.displayChangeNow,
caption: ExchangeProviderDescription.changeNow.title,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.changeNow)),
FilterItem(
value: () => tradeFilterStore.displaySideShift,
caption: ExchangeProviderDescription.sideShift.title,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.sideShift)),
FilterItem(
value: () => tradeFilterStore.displaySimpleSwap,
caption: ExchangeProviderDescription.simpleSwap.title,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.simpleSwap)),
FilterItem(
value: () => tradeFilterStore.displayTrocador,
caption: ExchangeProviderDescription.trocador.title,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.trocador)),
FilterItem(
value: () => tradeFilterStore.displayExolix,
caption: ExchangeProviderDescription.exolix.title,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.exolix)),
FilterItem(
value: () => tradeFilterStore.displayChainflip,
caption: ExchangeProviderDescription.chainflip.title,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.chainflip)),
FilterItem(
value: () => tradeFilterStore.displayThorChain,
caption: ExchangeProviderDescription.thorChain.title,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.thorChain)),
FilterItem(
value: () => tradeFilterStore.displayLetsExchange,
caption: ExchangeProviderDescription.letsExchange.title,
onChanged: () => tradeFilterStore
.toggleDisplayExchange(ExchangeProviderDescription.letsExchange)),
FilterItem(
value: () => tradeFilterStore.displayStealthEx,
caption: ExchangeProviderDescription.stealthEx.title,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.stealthEx)),
FilterItem(
value: () => tradeFilterStore.displayXOSwap,
caption: ExchangeProviderDescription.xoSwap.title,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.xoSwap)),
FilterItem(
value: () => tradeFilterStore.displaySwapTrade,
caption: ExchangeProviderDescription.swapTrade.title,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapTrade)),
FilterItem(
value: () => tradeFilterStore.displaySwapXyz,
caption: ExchangeProviderDescription.swapsXyz.title,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapsXyz)),
FilterItem(
value: () => tradeFilterStore.displayNearIntents,
caption: ExchangeProviderDescription.nearIntents.title,
onChanged: () => tradeFilterStore
.toggleDisplayExchange(ExchangeProviderDescription.nearIntents)),
]
},
subname = '', subname = '',
name = appStore.wallet!.name, name = appStore.wallet!.name,
type = appStore.wallet!.type, type = appStore.wallet!.type,
@@ -220,6 +118,8 @@ abstract class DashboardViewModelBase with Store {
unawaited(_loadConstraints()); unawaited(_loadConstraints());
final _wallet = wallet; final _wallet = wallet;
loadFilterItems();
if (_wallet.type == WalletType.monero) { if (_wallet.type == WalletType.monero) {
subname = monero!.getCurrentAccount(_wallet).label; subname = monero!.getCurrentAccount(_wallet).label;
@@ -352,6 +252,110 @@ abstract class DashboardViewModelBase with Store {
tradeMonitor.monitorActiveTrades(wallet.id); tradeMonitor.monitorActiveTrades(wallet.id);
} }
void loadFilterItems() {
filterItems = [
// FilterItem(
// value: () => transactionFilterStore.displayAll,
// caption: S.current.all_transactions,
// onChanged: transactionFilterStore.toggleAll),
FilterItem(
value: () => transactionFilterStore.displayOutgoing,
caption: S.current.send,
onChanged: transactionFilterStore.toggleOutgoing),
FilterItem(
value: () => transactionFilterStore.displayIncoming,
caption: S.current.receive,
onChanged: transactionFilterStore.toggleIncoming),
if (appStore.wallet!.type == WalletType.bitcoin)
FilterItem(
value: () => transactionFilterStore.displaySilentPayments,
caption: S.current.silent_payments,
onChanged: transactionFilterStore.toggleSilentPayments,
),
SwapFilterItem(
enabledProviders: () => tradeFilterStore.enabledProvidersCount,
allEnabled: () => tradeFilterStore.displayAllTrades,
value: () => tradeFilterStore.enabledProvidersCount>0,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.all)),
FilterItem(
value: () => orderFilterStore.displayCakePay,
caption: 'Cake Pay',
onChanged: () =>
orderFilterStore.toggleDisplayOrder(OrderProviderDescription.cakePay)),
];
exchangeFilterItems = [
SwapProviderFilterItem(
providerDescription: ExchangeProviderDescription.changeNow,
value: () => tradeFilterStore.displayChangeNow,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.changeNow)),
SwapProviderFilterItem(
providerDescription: ExchangeProviderDescription.sideShift,
value: () => tradeFilterStore.displaySideShift,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.sideShift)),
SwapProviderFilterItem(
providerDescription: ExchangeProviderDescription.simpleSwap,
value: () => tradeFilterStore.displaySimpleSwap,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.simpleSwap)),
SwapProviderFilterItem(
providerDescription: ExchangeProviderDescription.trocador,
value: () => tradeFilterStore.displayTrocador,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.trocador)),
SwapProviderFilterItem(
providerDescription: ExchangeProviderDescription.exolix,
value: () => tradeFilterStore.displayExolix,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.exolix)),
SwapProviderFilterItem(
providerDescription: ExchangeProviderDescription.chainflip,
value: () => tradeFilterStore.displayChainflip,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.chainflip)),
SwapProviderFilterItem(
providerDescription: ExchangeProviderDescription.thorChain,
value: () => tradeFilterStore.displayThorChain,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.thorChain)),
SwapProviderFilterItem(
providerDescription: ExchangeProviderDescription.letsExchange,
value: () => tradeFilterStore.displayLetsExchange,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.letsExchange)),
SwapProviderFilterItem(
providerDescription: ExchangeProviderDescription.stealthEx,
value: () => tradeFilterStore.displayStealthEx,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.stealthEx)),
SwapProviderFilterItem(
providerDescription: ExchangeProviderDescription.xoSwap,
value: () => tradeFilterStore.displayXOSwap,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.xoSwap)),
SwapProviderFilterItem(
providerDescription: ExchangeProviderDescription.swapTrade,
value: () => tradeFilterStore.displaySwapTrade,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapTrade)),
SwapProviderFilterItem(
providerDescription: ExchangeProviderDescription.swapsXyz,
value: () => tradeFilterStore.displaySwapXyz,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapsXyz)),
SwapProviderFilterItem(
providerDescription: ExchangeProviderDescription.nearIntents,
value: () => tradeFilterStore.displayNearIntents,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.nearIntents)),
];
}
bool _isTransactionDisposerCallbackRunning = false; bool _isTransactionDisposerCallbackRunning = false;
@action @action
@@ -405,6 +409,20 @@ abstract class DashboardViewModelBase with Store {
return false; return false;
} }
@action
void changeAllFilterItems(bool value) {
for (final item in filterItems) {
if (item.value() != value) {
item.onChanged();
}
}
for (final item in exchangeFilterItems) {
if (item.value() != value) {
item.onChanged();
}
}
}
@action @action
Future<void> loadCardDesigns() async { Future<void> loadCardDesigns() async {
final accountStyleSettings = final accountStyleSettings =
@@ -715,6 +733,14 @@ abstract class DashboardViewModelBase with Store {
return formattedItemsList(_items); return formattedItemsList(_items);
} }
static const shortHistoryLength = 3;
@computed
List<ActionListItem> get itemsShort => items
.where((item) => item is! DateSectionItem)
.take(shortHistoryLength)
.toList();
@observable @observable
WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo> wallet; WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo> wallet;
@@ -1123,7 +1149,11 @@ abstract class DashboardViewModelBase with Store {
PayjoinTransactionsStore payjoinTransactionsStore; PayjoinTransactionsStore payjoinTransactionsStore;
Map<String, List<FilterItem>> filterItems; // Map<String, List<FilterItem>> filterItems;
List<FilterItem> filterItems;
List<FilterItem> exchangeFilterItems;
bool get isBuyEnabled => settingsStore.isBitcoinBuyEnabled; bool get isBuyEnabled => settingsStore.isBitcoinBuyEnabled;
@@ -1234,6 +1264,7 @@ abstract class DashboardViewModelBase with Store {
this.wallet = wallet; this.wallet = wallet;
type = wallet.type; type = wallet.type;
name = wallet.name; name = wallet.name;
loadFilterItems();
if (wallet.type == WalletType.monero) { if (wallet.type == WalletType.monero) {
subname = monero!.getCurrentAccount(wallet).label; subname = monero!.getCurrentAccount(wallet).label;
@@ -1,8 +1,36 @@
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/view_model/dashboard/action_list_item.dart'; import 'package:cake_wallet/view_model/dashboard/action_list_item.dart';
class DateSectionItem extends ActionListItem { class DateSectionItem extends ActionListItem {
DateSectionItem(this.date, {required super.key}); DateSectionItem(this.date, {required super.key});
@override @override
final DateTime date; final DateTime date;
} }
abstract class SpecificDateSectionItem extends DateSectionItem {
SpecificDateSectionItem(super.date, {required super.key});
String get text;
}
class Last30daysTransactionItem extends SpecificDateSectionItem {
Last30daysTransactionItem(super.date, {required super.key});
@override
String get text => S.current.last_30_days;
}
class Last7daysTransactionItem extends SpecificDateSectionItem {
Last7daysTransactionItem(super.date, {required super.key});
@override
String get text => S.current.last_7_days;
}
class TodayTransactionItem extends SpecificDateSectionItem {
TodayTransactionItem(super.date, {required super.key});
@override
String get text => S.current.today;
}
+29 -1
View File
@@ -1,4 +1,4 @@
import 'package:mobx/mobx.dart'; import 'package:cake_wallet/exchange/exchange_provider_description.dart';
class FilterItem { class FilterItem {
FilterItem({ FilterItem({
@@ -9,4 +9,32 @@ class FilterItem {
bool Function() value; bool Function() value;
String caption; String caption;
Function onChanged; Function onChanged;
}
class SwapFilterItem extends FilterItem {
SwapFilterItem({
required this.enabledProviders,
required this.allEnabled,
required super.value,
super.caption = "Swap",
required super.onChanged,
});
int Function() enabledProviders;
bool Function() allEnabled;
}
class SwapProviderFilterItem extends FilterItem {
SwapProviderFilterItem({
required super.value,
required super.onChanged,
required this.providerDescription,
super.caption = ""
});
@override
String get caption => providerDescription.title;
final ExchangeProviderDescription providerDescription;
} }
@@ -1,45 +1,82 @@
import 'package:cake_wallet/view_model/dashboard/action_list_item.dart'; import "package:cake_wallet/view_model/dashboard/action_list_item.dart";
import 'package:cake_wallet/view_model/dashboard/date_section_item.dart'; import "package:cake_wallet/view_model/dashboard/date_section_item.dart";
import 'package:flutter/foundation.dart'; import "package:flutter/foundation.dart";
enum _DateBucket { recent, last7Days, last30Days, byMonth }
List<ActionListItem> formattedItemsList(List<ActionListItem> items) { List<ActionListItem> formattedItemsList(List<ActionListItem> items) {
final formattedList = <ActionListItem>[]; final formattedList = <ActionListItem>[];
DateTime? lastDate;
items.sort((a, b) => b.date.compareTo(a.date)); items.sort((a, b) => b.date.compareTo(a.date));
for (var i = 0; i < items.length; i++) { final now = DateTime.now();
final transaction = items[i]; final todayTreshold = DateTime(now.year, now.month, now.day);
final last7daysThreshold = now.subtract(const Duration(days: 7));
final last30daysThreshold = now.subtract(const Duration(days: 30));
if (lastDate == null) { _DateBucket? lastBucket;
lastDate = transaction.date; DateTime? lastMonthDate;
formattedList.add(
DateSectionItem( for (final transaction in items) {
transaction.date, final date = transaction.date;
key: ValueKey('date_section_item_${transaction.date.microsecondsSinceEpoch}_key'),
), final bucket = date.isAfter(todayTreshold)
); ? _DateBucket.recent
formattedList.add(transaction); : date.isAfter(last7daysThreshold)
continue; ? _DateBucket.last7Days
: date.isAfter(last30daysThreshold)
? _DateBucket.last30Days
: _DateBucket.byMonth;
switch (bucket) {
case _DateBucket.recent:
if (lastBucket != _DateBucket.recent) {
formattedList.add(
TodayTransactionItem(
date,
key: const ValueKey("today_section_item_key"),
),
);
}
break;
case _DateBucket.last7Days:
if (lastBucket != _DateBucket.last7Days) {
formattedList.add(
Last7daysTransactionItem(
date,
key: const ValueKey("last_7_days_section_item_key"),
),
);
}
break;
case _DateBucket.last30Days:
if (lastBucket != _DateBucket.last30Days) {
formattedList.add(
Last30daysTransactionItem(
date,
key: const ValueKey("last_30_days_section_item_key"),
),
);
}
break;
case _DateBucket.byMonth:
final isNewMonth = lastMonthDate == null ||
lastMonthDate.year != date.year ||
lastMonthDate.month != date.month;
if (isNewMonth) {
lastMonthDate = date;
formattedList.add(
DateSectionItem(
date,
key: ValueKey("date_section_item_${date.year}_${date.month}_key"),
),
);
}
break;
} }
final isCurrentDay = lastDate.year == transaction.date.year && lastBucket = bucket;
lastDate.month == transaction.date.month &&
lastDate.day == transaction.date.day;
if (isCurrentDay) {
formattedList.add(transaction);
continue;
}
lastDate = transaction.date;
formattedList.add(
DateSectionItem(
transaction.date,
key: ValueKey('date_section_item_${transaction.date.microsecondsSinceEpoch}_key'),
),
);
formattedList.add(transaction); formattedList.add(transaction);
} }
return formattedList; return formattedList;
} }
@@ -51,7 +51,7 @@ class TransactionListItem extends ActionListItem with Keyable {
.withLocalSeperator(_appStore.settingsStore.languageCode); .withLocalSeperator(_appStore.settingsStore.languageCode);
} }
return transaction.amount.toStringWithSymbol(); return transaction.amount.toStringWithSymbol(fractionalDigits: 8);
} }
String get formattedTitle { String get formattedTitle {
@@ -29,6 +29,7 @@ import 'package:cw_core/transaction_direction.dart';
import 'package:cw_core/transaction_priority.dart'; import 'package:cw_core/transaction_priority.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:intl/intl.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@@ -75,8 +76,7 @@ class TxDetailRowDefinition {
TxDetailRowDefinition( TxDetailRowDefinition(
keyString: "standard_list_item_transaction_details_date_key", keyString: "standard_list_item_transaction_details_date_key",
title: S.current.transaction_details_date, title: S.current.transaction_details_date,
valueGetter: (vm) => DateFormatter.withCurrentLocal().format(vm.transactionInfo.date)), valueGetter: (vm) => DateFormat("d MMMM yyyy, HH:mm", vm._appStore.settingsStore.languageCode).format(vm.transactionInfo.date)),
TxDetailRowDefinition( TxDetailRowDefinition(
keyString: "standard_list_item_transaction_details_height_key", keyString: "standard_list_item_transaction_details_height_key",
title: S.current.transaction_details_height, title: S.current.transaction_details_height,
+6
View File
@@ -55,6 +55,7 @@
"alert_notice": "Notice", "alert_notice": "Notice",
"all": "ALL", "all": "ALL",
"all_coins": "All Coins", "all_coins": "All Coins",
"all_pascal_case": "All",
"all_trades": "All trades", "all_trades": "All trades",
"all_transactions": "All transactions", "all_transactions": "All transactions",
"alphabetical": "Alphabetical", "alphabetical": "Alphabetical",
@@ -489,6 +490,7 @@
"file_saved": "File saved", "file_saved": "File saved",
"fill_code": "Please fill in the verification code provided to your email", "fill_code": "Please fill in the verification code provided to your email",
"filter_by": "Filter by", "filter_by": "Filter by",
"filter_swap_providers": "Filter Swap Providers",
"filters": "Filters", "filters": "Filters",
"finding_provider": "Finding provider", "finding_provider": "Finding provider",
"first_wallet_text": "Awesome wallet for Monero, Bitcoin, Ethereum, Litecoin, and Haven", "first_wallet_text": "Awesome wallet for Monero, Bitcoin, Ethereum, Litecoin, and Haven",
@@ -570,6 +572,7 @@
"label": "Label", "label": "Label",
"label_address": "Label address", "label_address": "Label address",
"last_30_days": "Last 30 days", "last_30_days": "Last 30 days",
"last_7_days": "Last 7 days",
"learn_more": "Learn More", "learn_more": "Learn More",
"ledger_connection_error": "Failed to connect to your Ledger. Please try again.", "ledger_connection_error": "Failed to connect to your Ledger. Please try again.",
"ledger_error_device_locked": "The Ledger is locked", "ledger_error_device_locked": "The Ledger is locked",
@@ -684,6 +687,7 @@
"no_id_needed": "No ID needed!", "no_id_needed": "No ID needed!",
"no_id_required": "No ID required. Top up and spend anywhere", "no_id_required": "No ID required. Top up and spend anywhere",
"no_providers_available": "No providers available", "no_providers_available": "No providers available",
"no_providers_selected": "No Providers Selected",
"no_relay_on_domain": "There isn't a relay for user's domain or the relay is unavailable. Please choose a relay to use.", "no_relay_on_domain": "There isn't a relay for user's domain or the relay is unavailable. Please choose a relay to use.",
"no_relays": "No relays", "no_relays": "No relays",
"no_relays_message": "We found a Nostr NIP-05 record for this user, but it does not contain any relays. Please instruct the recipient to add relays to their Nostr record.", "no_relays_message": "We found a Nostr NIP-05 record for this user, but it does not contain any relays. Please instruct the recipient to add relays to their Nostr record.",
@@ -873,6 +877,7 @@
"rescan": "Rescan", "rescan": "Rescan",
"resend_code": "Please resend it", "resend_code": "Please resend it",
"reset": "Reset", "reset": "Reset",
"reset_filters": "Reset Filters",
"reset_password": "Reset Password", "reset_password": "Reset Password",
"restore": "Restore", "restore": "Restore",
"restore_active_seed": "Active seed", "restore_active_seed": "Active seed",
@@ -1288,6 +1293,7 @@
"tx_wrong_balance_exception": "You do not have enough ${currency} to send this amount.", "tx_wrong_balance_exception": "You do not have enough ${currency} to send this amount.",
"tx_wrong_balance_with_amount_exception": "You do not have enough ${currency} to send the total amount of ${amount}", "tx_wrong_balance_with_amount_exception": "You do not have enough ${currency} to send the total amount of ${amount}",
"tx_zero_fee_exception": "Cannot send transaction with 0 fee. Try increasing the rate or checking your connection for latest estimates.", "tx_zero_fee_exception": "Cannot send transaction with 0 fee. Try increasing the rate or checking your connection for latest estimates.",
"type": "Type",
"unavailable_balance": "Unavailable balance", "unavailable_balance": "Unavailable balance",
"unavailable_balance_description": "Unavailable Balance: This total includes funds that are locked in pending transactions and those you have actively frozen in your Coin Control settings. Locked balances will become available once their respective transactions are completed, while frozen balances remain inaccessible for transactions until you decide to unfreeze them.", "unavailable_balance_description": "Unavailable Balance: This total includes funds that are locked in pending transactions and those you have actively frozen in your Coin Control settings. Locked balances will become available once their respective transactions are completed, while frozen balances remain inaccessible for transactions until you decide to unfreeze them.",
"unconfirmed": "Unconfirmed Balance", "unconfirmed": "Unconfirmed Balance",
+1
View File
@@ -555,6 +555,7 @@
"keys": "Claves", "keys": "Claves",
"label": "Etiqueta", "label": "Etiqueta",
"label_address": "Etiquetar dirección", "label_address": "Etiquetar dirección",
"last_7_days": "Últimos 7 días",
"last_30_days": "Últimos 30 días", "last_30_days": "Últimos 30 días",
"learn_more": "Más información", "learn_more": "Más información",
"ledger_connection_error": "No se pudo conectar a tu Ledger. Inténtalo de nuevo.", "ledger_connection_error": "No se pudo conectar a tu Ledger. Inténtalo de nuevo.",