2023-05-26 21:21:16 +00:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2023-03-28 22:18:11 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
2023-05-09 21:57:40 +00:00
|
|
|
import 'package:stackwallet/themes/stack_colors.dart';
|
2023-03-28 22:18:11 +00:00
|
|
|
import 'package:stackwallet/utilities/assets.dart';
|
|
|
|
import 'package:stackwallet/utilities/constants.dart';
|
2023-10-17 17:21:53 +00:00
|
|
|
import 'package:stackwallet/utilities/util.dart';
|
2024-01-10 18:21:28 +00:00
|
|
|
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
|
2023-03-28 22:18:11 +00:00
|
|
|
import 'package:stackwallet/widgets/animated_widgets/rotate_icon.dart';
|
|
|
|
import 'package:stackwallet/widgets/expandable.dart';
|
|
|
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
|
|
|
import 'package:stackwallet/widgets/wallet_card.dart';
|
|
|
|
import 'package:stackwallet/widgets/wallet_info_row/wallet_info_row.dart';
|
|
|
|
|
|
|
|
class MasterWalletCard extends ConsumerStatefulWidget {
|
|
|
|
const MasterWalletCard({
|
|
|
|
Key? key,
|
|
|
|
required this.walletId,
|
|
|
|
this.popPrevious = false,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
final String walletId;
|
|
|
|
final bool popPrevious;
|
|
|
|
|
|
|
|
@override
|
|
|
|
ConsumerState<MasterWalletCard> createState() => _MasterWalletCardState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MasterWalletCardState extends ConsumerState<MasterWalletCard> {
|
|
|
|
final expandableController = ExpandableController();
|
|
|
|
final rotateIconController = RotateIconController();
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return RoundedWhiteContainer(
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
child: Expandable(
|
|
|
|
controller: expandableController,
|
2023-04-10 15:16:07 +00:00
|
|
|
onExpandWillChange: (toState) {
|
|
|
|
if (toState == ExpandableState.expanded) {
|
|
|
|
rotateIconController.forward?.call();
|
|
|
|
} else {
|
|
|
|
rotateIconController.reverse?.call();
|
|
|
|
}
|
|
|
|
},
|
2023-03-28 22:18:11 +00:00
|
|
|
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<StackColors>()!
|
|
|
|
.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<StackColors>()!.backgroundAppBar,
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(
|
|
|
|
7,
|
|
|
|
),
|
2023-04-10 15:44:38 +00:00
|
|
|
child: SimpleWalletCard(
|
2023-03-28 22:18:11 +00:00
|
|
|
walletId: widget.walletId,
|
|
|
|
popPrevious: true,
|
|
|
|
),
|
|
|
|
),
|
2024-01-10 18:21:28 +00:00
|
|
|
...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,
|
|
|
|
),
|
|
|
|
),
|
2023-03-28 22:18:11 +00:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|