6.2 home ui fixes (#3290)

This commit is contained in:
malik1004x
2026-06-04 04:35:29 +02:00
committed by GitHub
parent 281725fa5b
commit 1704bc5172
5 changed files with 98 additions and 67 deletions
@@ -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,
),
@@ -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: <Widget>[
...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<void>(
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<void>(
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;
}
@@ -127,6 +127,7 @@ class _LineTabSwitcherState extends State<LineTabSwitcher> {
}).toList()
)
),
if(widget.tabs.length > 1)
Container(
width: totalWidth,
height: 2,