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';
|
2024-05-23 00:37:06 +00:00
|
|
|
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';
|
2023-03-28 22:18:11 +00:00
|
|
|
|
|
|
|
class MasterWalletCard extends ConsumerStatefulWidget {
|
|
|
|
const MasterWalletCard({
|
2024-05-27 23:56:22 +00:00
|
|
|
super.key,
|
2023-03-28 22:18:11 +00:00
|
|
|
required this.walletId,
|
|
|
|
this.popPrevious = false,
|
2024-05-27 23:56:22 +00:00
|
|
|
});
|
2023-03-28 22:18:11 +00:00
|
|
|
|
|
|
|
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
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|