Add copy for ionia gift card info.

This commit is contained in:
M 2022-07-18 17:25:09 +01:00
parent d47887e1ec
commit 8ad3a4065b
2 changed files with 26 additions and 24 deletions

View file

@ -8,9 +8,11 @@ import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/typography.dart'; import 'package:cake_wallet/typography.dart';
import 'package:cake_wallet/utils/show_bar.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/ionia/ionia_gift_card_details_view_model.dart'; import 'package:cake_wallet/view_model/ionia/ionia_gift_card_details_view_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/src/widgets/framework.dart'; import 'package:flutter/src/widgets/framework.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
@ -89,18 +91,21 @@ class IoniaGiftCardDetailPage extends BasePage {
child: SizedBox(height: 96, width: double.infinity, child: Image.network(viewModel.giftCard.barcodeUrl)), child: SizedBox(height: 96, width: double.infinity, child: Image.network(viewModel.giftCard.barcodeUrl)),
), ),
SizedBox(height: 24), SizedBox(height: 24),
IoniaTile( buildIoniaTile(
context,
title: S.of(context).gift_card_number, title: S.of(context).gift_card_number,
subTitle: viewModel.giftCard.cardNumber, subTitle: viewModel.giftCard.cardNumber,
), ),
Divider(height: 30), Divider(height: 30),
IoniaTile( buildIoniaTile(
context,
title: S.of(context).pin_number, title: S.of(context).pin_number,
subTitle: viewModel.giftCard.cardPin ?? '', subTitle: viewModel.giftCard.cardPin ?? '',
), ),
Divider(height: 30), Divider(height: 30),
Observer(builder: (_) => Observer(builder: (_) =>
IoniaTile( buildIoniaTile(
context,
title: S.of(context).amount, title: S.of(context).amount,
subTitle: viewModel.giftCard.remainingAmount.toString() ?? '0', subTitle: viewModel.giftCard.remainingAmount.toString() ?? '0',
)), )),
@ -128,6 +133,17 @@ class IoniaGiftCardDetailPage extends BasePage {
); );
} }
Widget buildIoniaTile(BuildContext context, {@required String title, @required String subTitle}) {
return IoniaTile(
title: title,
subTitle: subTitle,
onTap: () {
Clipboard.setData(ClipboardData(text: subTitle));
showBar<void>(context,
S.of(context).transaction_details_copied(title));
});
}
void _showHowToUseCard( void _showHowToUseCard(
BuildContext context, BuildContext context,
IoniaGiftCard merchant, IoniaGiftCard merchant,

View file

@ -6,18 +6,18 @@ class IoniaTile extends StatelessWidget {
Key key, Key key,
@required this.title, @required this.title,
@required this.subTitle, @required this.subTitle,
this.trailing, this.onTap,
this.onTapTrailing,
}) : super(key: key); }) : super(key: key);
final Widget trailing; final VoidCallback onTap;
final VoidCallback onTapTrailing;
final String title; final String title;
final String subTitle; final String subTitle;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return GestureDetector(
onTap: () => onTap(),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Column( Column(
@ -37,22 +37,8 @@ class IoniaTile extends StatelessWidget {
), ),
), ),
], ],
),
trailing != null
? InkWell(
onTap: () => onTapTrailing,
child: Center(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 6, vertical: 6),
decoration: BoxDecoration(
color: Theme.of(context).accentTextTheme.display4.backgroundColor.withOpacity(0.1),
borderRadius: BorderRadius.circular(4)),
child: trailing,
),
),
) )
: Offstage(),
], ],
); ));
} }
} }