mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
6.2 home ui fixes (#3290)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M10.2787 17.5V16H13.7115V17.5H10.2787ZM6.404 12.75V11.25H17.5865V12.75H6.404ZM3.5 8V6.5H20.5V8H3.5Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 232 B |
@@ -0,0 +1,3 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M5.25128 22.0193L4.20703 20.95L7.40703 17.75H4.79153V16.25H9.95128V21.4095H8.45128V18.8193L5.25128 22.0193ZM12.1435 21.5V20H17.6915C17.7814 20 17.8551 19.9712 17.9128 19.9135C17.9704 19.8558 17.9993 19.7821 17.9993 19.6923V8.5H13.4993V4H6.30703C6.2172 4 6.14345 4.02883 6.08578 4.0865C6.02811 4.14417 5.99928 4.21792 5.99928 4.30775V14.0577H4.49928V4.30775C4.49928 3.80908 4.67586 3.38308 5.02903 3.02975C5.38236 2.67658 5.80836 2.5 6.30703 2.5H14.2493L19.4993 7.75V19.6923C19.4993 20.1909 19.3227 20.6169 18.9695 20.9703C18.6162 21.3234 18.1902 21.5 17.6915 21.5H12.1435Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 705 B |
Reference in New Issue
Block a user