stack_wallet/lib/widgets/eth_wallet_radio.dart

88 lines
2.6 KiB
Dart
Raw Normal View History

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
*
*/
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/text_styles.dart';
2023-04-10 16:02:19 +00:00
import 'package:stackwallet/widgets/wallet_info_row/sub_widgets/wallet_info_row_balance.dart';
import 'package:stackwallet/widgets/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 manager = ref.watch(walletsChangeNotifierProvider
.select((value) => value.getManager(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: manager.coin,
size: 40,
),
const SizedBox(
width: 12,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
manager.walletName,
style: STextStyles.desktopTextExtraSmall(context).copyWith(
color:
Theme.of(context).extension<StackColors>()!.textDark,
),
),
WalletInfoRowBalance(
walletId: widget.walletId,
),
],
),
),
],
),
),
);
}
}