2022-08-26 08:11:35 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import 'package:stackwallet/pages/wallet_view/wallet_view.dart';
|
|
|
|
import 'package:stackwallet/providers/providers.dart';
|
|
|
|
import 'package:stackwallet/utilities/constants.dart';
|
2023-01-02 17:08:13 +00:00
|
|
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
2022-09-19 17:32:33 +00:00
|
|
|
import 'package:stackwallet/widgets/wallet_info_row/wallet_info_row.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:tuple/tuple.dart';
|
|
|
|
|
|
|
|
class WalletSheetCard extends ConsumerWidget {
|
|
|
|
const WalletSheetCard({
|
|
|
|
Key? key,
|
|
|
|
required this.walletId,
|
|
|
|
this.popPrevious = false,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
final String walletId;
|
|
|
|
final bool popPrevious;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
return RoundedWhiteContainer(
|
|
|
|
padding: const EdgeInsets.all(0),
|
|
|
|
child: MaterialButton(
|
2022-09-22 23:48:50 +00:00
|
|
|
// splashColor: Theme.of(context).extension<StackColors>()!.highlight,
|
2022-08-26 08:11:35 +00:00
|
|
|
key: Key("walletsSheetItemButtonKey_$walletId"),
|
|
|
|
padding: const EdgeInsets.all(5),
|
|
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
Constants.size.circularBorderRadius,
|
|
|
|
),
|
|
|
|
),
|
2023-01-02 17:08:13 +00:00
|
|
|
onPressed: () async {
|
|
|
|
final manager = ref
|
|
|
|
.read(walletsChangeNotifierProvider)
|
|
|
|
.getManager(walletId);
|
|
|
|
if (manager.coin == Coin.monero ||
|
|
|
|
manager.coin == Coin.wownero) {
|
|
|
|
await manager.initializeExisting();
|
|
|
|
}
|
2022-08-26 08:11:35 +00:00
|
|
|
if (popPrevious) Navigator.of(context).pop();
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
WalletView.routeName,
|
|
|
|
arguments: Tuple2(
|
|
|
|
walletId,
|
|
|
|
ref
|
|
|
|
.read(walletsChangeNotifierProvider)
|
|
|
|
.getManagerProvider(walletId)),
|
|
|
|
);
|
|
|
|
},
|
2022-09-19 17:32:33 +00:00
|
|
|
child: WalletInfoRow(
|
|
|
|
walletId: walletId,
|
2022-08-26 08:11:35 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|