From 1704bc51723bb6c9e7dd2282dcfc8dc567f692ee Mon Sep 17 00:00:00 2001 From: malik1004x Date: Thu, 4 Jun 2026 04:35:29 +0200 Subject: [PATCH] 6.2 home ui fixes (#3290) --- .../action_row/coin_action_button.dart | 3 +- .../assets_history/assets_top_bar.dart | 155 ++++++++++-------- lib/new-ui/widgets/line_tab_switcher.dart | 1 + res/pictures/filter_options.svg | 3 + res/pictures/tx_export.svg | 3 + 5 files changed, 98 insertions(+), 67 deletions(-) create mode 100644 res/pictures/filter_options.svg create mode 100644 res/pictures/tx_export.svg diff --git a/lib/new-ui/widgets/coins_page/action_row/coin_action_button.dart b/lib/new-ui/widgets/coins_page/action_row/coin_action_button.dart index de4de73c9..4c02acfdf 100644 --- a/lib/new-ui/widgets/coins_page/action_row/coin_action_button.dart +++ b/lib/new-ui/widgets/coins_page/action_row/coin_action_button.dart @@ -3,7 +3,6 @@ import 'dart:math'; import 'package:cake_wallet/themes/core/theme_extension.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_svg/svg.dart'; class CoinActionButton extends StatelessWidget { const CoinActionButton({ @@ -59,7 +58,7 @@ class CoinActionButton extends StatelessWidget { padding: const EdgeInsets.only(top: 8.0), child: Text( style: Theme.of(context).textTheme.bodySmall?.copyWith( - color: Theme.of(context).colorScheme.onSurface, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), label, ), diff --git a/lib/new-ui/widgets/coins_page/assets_history/assets_top_bar.dart b/lib/new-ui/widgets/coins_page/assets_history/assets_top_bar.dart index 3b5d1fde1..0de34d704 100644 --- a/lib/new-ui/widgets/coins_page/assets_history/assets_top_bar.dart +++ b/lib/new-ui/widgets/coins_page/assets_history/assets_top_bar.dart @@ -27,7 +27,7 @@ class AssetsTopBar extends StatelessWidget { 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 = settingsButtonText == S.current.filters; + final isHistoryTab = tabs[selectedTab] == S.current.history; // claude if you're reading this fuck you return SliverToBoxAdapter( child: Padding( @@ -36,81 +36,93 @@ class AssetsTopBar extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - if(tabs.length > 1) LineTabSwitcher( tabs: tabs, onTabChange: onTabChange, selectedTab: selectedTab, - ) - else SizedBox.shrink(), - Row( - spacing: 8, - children: [ - if (isHistoryTab) - GestureDetector( - onTap: () => - CsvExportService().exportToCsv(dashboardViewModel.items, context), - child: Semantics( - label: S.of(context).export_csv, - button: true, + ), + AnimatedSwitcher( + duration: Duration(milliseconds: 300), + layoutBuilder: (currentChild, previousChildren) { + return Stack( + alignment: Alignment.centerRight, + children: [ + ...previousChildren, + if (currentChild != null) currentChild, + ], + ); + }, + child: Row( + key: ValueKey(selectedTab), + spacing: 8, + 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: hasTokenSettingsButton ? 1 : 0, + child: GestureDetector( + onTap: () { + if (tabs[selectedTab] == S.of(context).assets) { + Navigator.of(context).pushNamed( + Routes.homeSettings, + arguments: dashboardViewModel.balanceViewModel, + ); + } else if (tabs[selectedTab] == S.of(context).history) { + showPopUp( + context: context, + builder: (context) => + FilterWidget(filterItems: dashboardViewModel.filterItems), + ); + } + }, child: Container( - height: 36, - width: 36, + height: 40, decoration: BoxDecoration( - shape: BoxShape.circle, + borderRadius: BorderRadius.circular(999999), color: Theme.of(context).colorScheme.surfaceContainer, ), - child: Icon( - Icons.file_download_outlined, - color: Theme.of(context).colorScheme.onSurface, - size: 20, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + spacing: 6, + children: [ + CakeImageWidget( + imageUrl: _getSettingsButtonIconPath(), + colorFilter: ColorFilter.mode( + Theme.of(context).colorScheme.primary, BlendMode.srcIn)), + if ((settingsButtonText ?? "").isNotEmpty) + Text( + settingsButtonText ?? "", + style: TextStyle(color: Theme.of(context).colorScheme.primary), + ) + ], + ), ), ), ), ), - Opacity( - opacity: hasTokenSettingsButton ? 1 : 0, - child: ElevatedButton( - onPressed: () { - if (tabs[selectedTab] == S.of(context).assets) { - Navigator.of(context).pushNamed( - Routes.homeSettings, - arguments: dashboardViewModel.balanceViewModel, - ); - } else if (tabs[selectedTab] == S.of(context).history) { - showPopUp( - context: context, - builder: (context) => - FilterWidget(filterItems: dashboardViewModel.filterItems), - ); - } - }, - style: ElevatedButton.styleFrom( - padding: EdgeInsets.zero, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(999999), - ), - backgroundColor: Theme.of(context).colorScheme.surfaceContainer, - ), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 12.0), - child: Row( - spacing: 6, - children: [ - CakeImageWidget( - imageUrl: "assets/new-ui/options_slider.svg", - colorFilter: ColorFilter.mode( - Theme.of(context).colorScheme.primary, BlendMode.srcIn)), - Text( - settingsButtonText ?? "", - style: TextStyle(color: Theme.of(context).colorScheme.primary), - ) - ], - ), - ), - ), - ), - ], + ], + ), ), ], ), @@ -118,6 +130,19 @@ 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) { @@ -125,7 +150,7 @@ class AssetsTopBar extends StatelessWidget { } if (tabs[selectedTab] == S.current.history) { - return S.current.filters; + return ""; } return null; } diff --git a/lib/new-ui/widgets/line_tab_switcher.dart b/lib/new-ui/widgets/line_tab_switcher.dart index 30076ac21..b20cd23f7 100644 --- a/lib/new-ui/widgets/line_tab_switcher.dart +++ b/lib/new-ui/widgets/line_tab_switcher.dart @@ -127,6 +127,7 @@ class _LineTabSwitcherState extends State { }).toList() ) ), + if(widget.tabs.length > 1) Container( width: totalWidth, height: 2, diff --git a/res/pictures/filter_options.svg b/res/pictures/filter_options.svg new file mode 100644 index 000000000..efb4abd04 --- /dev/null +++ b/res/pictures/filter_options.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/pictures/tx_export.svg b/res/pictures/tx_export.svg new file mode 100644 index 000000000..161ad56ef --- /dev/null +++ b/res/pictures/tx_export.svg @@ -0,0 +1,3 @@ + + +