2022-09-19 17:32:33 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
import 'package:stackwallet/providers/providers.dart';
|
|
|
|
import 'package:stackwallet/utilities/assets.dart';
|
|
|
|
import 'package:stackwallet/utilities/text_styles.dart';
|
2022-09-22 23:48:50 +00:00
|
|
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
2022-09-19 17:32:33 +00:00
|
|
|
import 'package:stackwallet/utilities/util.dart';
|
|
|
|
import 'package:stackwallet/widgets/wallet_info_row/sub_widgets/wallet_info_row_balance_future.dart';
|
|
|
|
import 'package:stackwallet/widgets/wallet_info_row/sub_widgets/wallet_info_row_coin_icon.dart';
|
|
|
|
|
|
|
|
class WalletInfoRow extends ConsumerWidget {
|
|
|
|
const WalletInfoRow({
|
|
|
|
Key? key,
|
|
|
|
required this.walletId,
|
|
|
|
this.onPressed,
|
2022-11-28 21:21:18 +00:00
|
|
|
this.padding = const EdgeInsets.all(0),
|
2022-09-19 17:32:33 +00:00
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
final String walletId;
|
|
|
|
final VoidCallback? onPressed;
|
2022-11-28 21:21:18 +00:00
|
|
|
final EdgeInsets padding;
|
2022-09-19 17:32:33 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
final manager = ref.watch(ref
|
|
|
|
.watch(walletsChangeNotifierProvider.notifier)
|
|
|
|
.getManagerProvider(walletId));
|
|
|
|
|
2022-10-13 19:07:48 +00:00
|
|
|
if (Util.isDesktop) {
|
2022-11-15 22:44:23 +00:00
|
|
|
return MouseRegion(
|
|
|
|
cursor: SystemMouseCursors.click,
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: onPressed,
|
2022-11-28 21:21:18 +00:00
|
|
|
child: Padding(
|
|
|
|
padding: padding,
|
|
|
|
child: Container(
|
|
|
|
color: Colors.transparent,
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
flex: 4,
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
WalletInfoCoinIcon(coin: manager.coin),
|
|
|
|
const SizedBox(
|
|
|
|
width: 12,
|
2022-11-15 22:44:23 +00:00
|
|
|
),
|
2022-11-28 21:21:18 +00:00
|
|
|
Text(
|
|
|
|
manager.walletName,
|
|
|
|
style: STextStyles.desktopTextExtraSmall(context)
|
|
|
|
.copyWith(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textDark,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-11-15 22:44:23 +00:00
|
|
|
),
|
2022-11-28 21:21:18 +00:00
|
|
|
Expanded(
|
|
|
|
flex: 4,
|
|
|
|
child: WalletInfoRowBalanceFuture(
|
|
|
|
walletId: walletId,
|
|
|
|
),
|
2022-11-15 22:44:23 +00:00
|
|
|
),
|
2022-11-28 21:21:18 +00:00
|
|
|
Expanded(
|
|
|
|
flex: 6,
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
SvgPicture.asset(
|
|
|
|
Assets.svg.chevronRight,
|
|
|
|
width: 20,
|
|
|
|
height: 20,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textSubtitle1,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
2022-11-15 22:44:23 +00:00
|
|
|
),
|
2022-10-13 19:07:48 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return Row(
|
|
|
|
children: [
|
|
|
|
WalletInfoCoinIcon(coin: manager.coin),
|
|
|
|
const SizedBox(
|
|
|
|
width: 12,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
manager.walletName,
|
|
|
|
style: STextStyles.titleBold12(context),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 2,
|
|
|
|
),
|
|
|
|
WalletInfoRowBalanceFuture(walletId: walletId),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
2022-09-19 17:32:33 +00:00
|
|
|
}
|
|
|
|
}
|