/* * This file is part of Stack Wallet. * * Copyright (c) 2023 Cypher Stack * All Rights Reserved. * The code is distributed under GPLv3 license, see LICENSE file for details. * Generated by Cypher Stack on 2023-05-26 * */ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import '../themes/stack_colors.dart'; import '../utilities/assets.dart'; import '../utilities/constants.dart'; import '../utilities/util.dart'; import '../wallets/isar/providers/wallet_info_provider.dart'; import 'animated_widgets/rotate_icon.dart'; import 'expandable.dart'; import 'rounded_white_container.dart'; import 'wallet_card.dart'; import 'wallet_info_row/wallet_info_row.dart'; class MasterWalletCard extends ConsumerStatefulWidget { const MasterWalletCard({ super.key, required this.walletId, this.popPrevious = false, }); final String walletId; final bool popPrevious; @override ConsumerState createState() => _MasterWalletCardState(); } class _MasterWalletCardState extends ConsumerState { final expandableController = ExpandableController(); final rotateIconController = RotateIconController(); @override Widget build(BuildContext context) { return RoundedWhiteContainer( padding: EdgeInsets.zero, child: Expandable( controller: expandableController, onExpandWillChange: (toState) { if (toState == ExpandableState.expanded) { rotateIconController.forward?.call(); } else { rotateIconController.reverse?.call(); } }, header: Padding( padding: const EdgeInsets.all(12), child: Row( children: [ Expanded( child: WalletInfoRow( walletId: widget.walletId, ), ), MaterialButton( padding: const EdgeInsets.all(5), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, minWidth: 32, height: 32, color: Theme.of(context) .extension()! .textFieldDefaultBG, elevation: 0, hoverElevation: 0, disabledElevation: 0, highlightElevation: 0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular( Constants.size.circularBorderRadius, ), ), onPressed: () { if (expandableController.state == ExpandableState.collapsed) { rotateIconController.forward?.call(); } else { rotateIconController.reverse?.call(); } expandableController.toggle?.call(); }, child: RotateIcon( controller: rotateIconController, icon: SvgPicture.asset( Assets.svg.chevronDown, width: 14, ), curve: Curves.easeInOut, ), ), ], ), ), body: ListView( shrinkWrap: true, primary: false, children: [ Container( width: double.infinity, height: 1.5, color: Theme.of(context).extension()!.backgroundAppBar, ), Padding( padding: const EdgeInsets.all( 7, ), child: SimpleWalletCard( walletId: widget.walletId, popPrevious: true, ), ), ...ref.watch(pWalletTokenAddresses(widget.walletId)).map( (e) => Padding( padding: const EdgeInsets.only( left: 7, right: 7, bottom: 7, ), child: SimpleWalletCard( walletId: widget.walletId, contractAddress: e, popPrevious: Util.isDesktop, ), ), ), ], ), ), ); } }