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

96 lines
2.7 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
*
*/
2022-12-21 19:46:50 +00:00
import 'package:flutter/material.dart';
import 'paynym_bot.dart';
import '../../../themes/stack_colors.dart';
import '../../../utilities/format.dart';
import '../../../utilities/text_styles.dart';
import '../../../utilities/util.dart';
import '../../../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(
2023-02-01 21:02:41 +00:00
size: 36,
2023-01-04 20:57:29 +00:00
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,
)
2023-02-01 21:02:41 +00:00
: STextStyles.w500_14(context),
2023-01-04 20:57:29 +00:00
),
const SizedBox(
height: 2,
),
Text(
Format.shorten(widget.paymentCodeString, 12, 5),
style: isDesktop
? STextStyles.desktopTextExtraExtraSmall(context)
2023-02-01 21:02:41 +00:00
: STextStyles.w500_14(context).copyWith(
2023-01-04 20:57:29 +00:00
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
),
);
}
}