mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
tx history improved layout (wip)
This commit is contained in:
@@ -43,6 +43,7 @@ class _AssetsHistorySectionState extends State<AssetsHistorySection> {
|
||||
S.current.history,
|
||||
HistorySection(
|
||||
dashboardViewModel: widget.dashboardViewModel,
|
||||
short: true,
|
||||
)),
|
||||
if (isNFTACtivatedChain(widget.dashboardViewModel.wallet.type,
|
||||
chainId: widget.dashboardViewModel.wallet.chainId))
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/anonpay_history_tile.dart';
|
||||
@@ -22,16 +24,19 @@ import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class HistorySection extends StatelessWidget {
|
||||
const HistorySection({super.key, required this.dashboardViewModel});
|
||||
const HistorySection({super.key, required this.dashboardViewModel, required this.short});
|
||||
|
||||
final DashboardViewModel dashboardViewModel;
|
||||
final bool short;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final items = short ? dashboardViewModel.itemsShort : dashboardViewModel.items;
|
||||
|
||||
return SliverPadding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
sliver: Observer(
|
||||
builder: (_) => (dashboardViewModel.items.isEmpty)
|
||||
builder: (_) => (items.isEmpty)
|
||||
? SliverPadding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
sliver: SliverToBoxAdapter(
|
||||
@@ -48,14 +53,14 @@ class HistorySection extends StatelessWidget {
|
||||
)
|
||||
: SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
childCount: dashboardViewModel.items.length,
|
||||
childCount: items.length,
|
||||
(context, index) => Observer(builder: (_) {
|
||||
final prevItem = index == 0 ? null : dashboardViewModel.items[index - 1];
|
||||
final prevItem = index == 0 ? null : items[index - 1];
|
||||
final topPadding = index == 0 ? 0.0 : 18.0;
|
||||
final item = dashboardViewModel.items[index];
|
||||
final nextItem = index == dashboardViewModel.items.length - 1
|
||||
final item = items[index];
|
||||
final nextItem = index == items.length - 1
|
||||
? null
|
||||
: dashboardViewModel.items[index + 1];
|
||||
: items[index + 1];
|
||||
|
||||
final roundedBottom = (nextItem == null || nextItem is DateSectionItem);
|
||||
final roundedTop = (prevItem == null || prevItem is DateSectionItem);
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'dart:io' show Platform;
|
||||
import 'package:cake_wallet/.secrets.g.dart' as secrets;
|
||||
import 'package:cake_wallet/bitcoin/bitcoin.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:cake_wallet/core/trade_monitor.dart';
|
||||
import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart';
|
||||
@@ -715,6 +716,11 @@ abstract class DashboardViewModelBase with Store {
|
||||
return formattedItemsList(_items);
|
||||
}
|
||||
|
||||
static const shortHistoryLength = 3;
|
||||
|
||||
@computed
|
||||
List<ActionListItem> get itemsShort => items.where((item)=>item is! DateSectionItem).take(3).toList();
|
||||
|
||||
@observable
|
||||
WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo> wallet;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user