stack_wallet/lib/widgets/eth_wallet_radio.dart

87 lines
2.4 KiB
Dart

/*
* 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 '../providers/providers.dart';
import '../themes/stack_colors.dart';
import '../utilities/text_styles.dart';
import 'wallet_info_row/sub_widgets/wallet_info_row_balance.dart';
import 'wallet_info_row/sub_widgets/wallet_info_row_coin_icon.dart';
class EthWalletRadio extends ConsumerStatefulWidget {
const EthWalletRadio({
Key? key,
required this.walletId,
this.selectedWalletId,
}) : super(key: key);
final String walletId;
final String? selectedWalletId;
@override
ConsumerState<EthWalletRadio> createState() => _EthWalletRadioState();
}
class _EthWalletRadioState extends ConsumerState<EthWalletRadio> {
@override
Widget build(BuildContext context) {
final wallet =
ref.watch(pWallets.select((value) => value.getWallet(widget.walletId)));
return Padding(
padding: EdgeInsets.zero,
child: Container(
color: Colors.transparent,
child: Row(
children: [
IgnorePointer(
child: Radio(
value: widget.walletId,
groupValue: widget.selectedWalletId,
onChanged: (_) {
// do nothing since changing updating the ui is already
// done elsewhere
},
),
),
const SizedBox(
width: 12,
),
WalletInfoCoinIcon(
coin: wallet.info.coin,
size: 40,
),
const SizedBox(
width: 12,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
wallet.info.name,
style: STextStyles.desktopTextExtraSmall(context).copyWith(
color:
Theme.of(context).extension<StackColors>()!.textDark,
),
),
WalletInfoRowBalance(
walletId: widget.walletId,
),
],
),
),
],
),
),
);
}
}