stack_wallet/lib/pages/paynym/subwidgets/paynym_card.dart

86 lines
2.6 KiB
Dart
Raw Normal View History

2022-12-21 19:46:50 +00:00
import 'package:flutter/material.dart';
import 'package:stackwallet/pages/paynym/subwidgets/paynym_bot.dart';
import 'package:stackwallet/utilities/format.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
2023-01-04 19:00:25 +00:00
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/custom_buttons/paynym_follow_toggle_button.dart';
2022-12-21 19:46:50 +00:00
class PaynymCard extends StatefulWidget {
const PaynymCard({
Key? key,
2022-12-21 23:02:14 +00:00
required this.walletId,
2022-12-21 19:46:50 +00:00
required this.label,
required this.paymentCodeString,
}) : super(key: key);
2022-12-21 23:02:14 +00:00
final String walletId;
2022-12-21 19:46:50 +00:00
final String label;
final String paymentCodeString;
@override
State<PaynymCard> createState() => _PaynymCardState();
}
class _PaynymCardState extends State<PaynymCard> {
2023-01-04 19:00:25 +00:00
final isDesktop = Util.isDesktop;
2022-12-21 19:46:50 +00:00
@override
Widget build(BuildContext context) {
2023-01-04 20:57:29 +00:00
return Padding(
padding: isDesktop
? const EdgeInsets.symmetric(
vertical: 16,
horizontal: 20,
)
: const EdgeInsets.all(12),
child: Row(
children: [
PayNymBot(
size: 32,
paymentCodeString: widget.paymentCodeString,
),
const SizedBox(
width: 12,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.label,
style: isDesktop
? STextStyles.desktopTextExtraExtraSmall(context)
.copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldActiveText,
)
: STextStyles.w500_12(context),
),
const SizedBox(
height: 2,
),
Text(
Format.shorten(widget.paymentCodeString, 12, 5),
style: isDesktop
? STextStyles.desktopTextExtraExtraSmall(context)
: STextStyles.w500_12(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
),
],
2022-12-21 23:24:08 +00:00
),
2023-01-04 20:57:29 +00:00
),
PaynymFollowToggleButton(
walletId: widget.walletId,
paymentCodeStringToFollow: widget.paymentCodeString,
),
],
2022-12-21 23:02:14 +00:00
),
);
}
}