UI fixes for ionia.

This commit is contained in:
M 2022-07-20 12:57:34 +01:00
parent 6e79b3afb4
commit 61bf2f11c2
3 changed files with 71 additions and 44 deletions

View file

@ -15,6 +15,7 @@ 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/standart_list_row.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/themes/dark_theme.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/typography.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
@ -334,8 +335,8 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget {
PrimaryButton(
onPressed: () => Navigator.pop(context),
text: S.of(context).send_got_it,
color: Color.fromRGBO(233, 242, 252, 1),
textColor: Theme.of(context).textTheme.display2.color,
color: Theme.of(context).accentTextTheme.caption.color,
textColor: Theme.of(context).primaryTextTheme.title.color,
),
SizedBox(height: 21),
],
@ -569,6 +570,40 @@ class TipButton extends StatelessWidget {
final bool isSelected;
final void Function() onTap;
bool isDark(BuildContext context) => Theme.of(context).brightness == Brightness.dark;
Color captionTextColor(BuildContext context) {
if (isDark(context)) {
return Theme.of(context).primaryTextTheme.title.color;
}
return isSelected
? Theme.of(context).accentTextTheme.title.color
: Theme.of(context).primaryTextTheme.title.color;
}
Color subTitleTextColor(BuildContext context) {
if (isDark(context)) {
return Theme.of(context).primaryTextTheme.title.color;
}
return isSelected
? Theme.of(context).accentTextTheme.title.color
: Theme.of(context).primaryTextTheme.overline.color;
}
Color backgroundColor(BuildContext context) {
if (isDark(context)) {
return isSelected
? null
: Theme.of(context).accentTextTheme.display4.backgroundColor.withOpacity(0.01);
}
return isSelected
? null
: Theme.of(context).accentTextTheme.display4.backgroundColor.withOpacity(0.1);
}
@override
Widget build(BuildContext context) {
return InkWell(
@ -580,17 +615,13 @@ class TipButton extends StatelessWidget {
children: [
Text(caption,
style: textSmallSemiBold(
color: isSelected
? Theme.of(context).accentTextTheme.title.color
: Theme.of(context).primaryTextTheme.title.color)),
color: captionTextColor(context))),
if (subTitle != null) ...[
SizedBox(height: 4),
Text(
subTitle,
style: textXxSmallSemiBold(
color: isSelected
? Theme.of(context).accentTextTheme.title.color
: Theme.of(context).primaryTextTheme.overline.color,
color: subTitleTextColor(context),
),
),
]
@ -599,7 +630,7 @@ class TipButton extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: 18, vertical: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Color.fromRGBO(242, 240, 250, 1),
color: backgroundColor(context),
gradient: isSelected
? LinearGradient(
colors: [

View file

@ -124,13 +124,13 @@ class IoniaBuyGiftCardPage extends BasePage {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).min_amount(merchant.minimumCardPurchase.toString()),
S.of(context).min_amount(merchant.minimumCardPurchase.toStringAsFixed(2)),
style: TextStyle(
color: Theme.of(context).primaryTextTheme.headline.color,
),
),
Text(
S.of(context).max_amount(merchant.maximumCardPurchase.toString()),
S.of(context).max_amount(merchant.maximumCardPurchase.toStringAsFixed(2)),
style: TextStyle(
color: Theme.of(context).primaryTextTheme.headline.color,
),
@ -171,7 +171,7 @@ class IoniaBuyGiftCardPage extends BasePage {
text: S.of(context).continue_text,
isDisabled: !ioniaBuyCardViewModel.isEnablePurchase,
color: Theme.of(context).accentTextTheme.body2.color,
textColor: Theme.of(context).accentTextTheme.headline.decorationColor,
textColor: Colors.white,
),
);
}),

View file

@ -107,7 +107,7 @@ class IoniaGiftCardDetailPage extends BasePage {
buildIoniaTile(
context,
title: S.of(context).amount,
subTitle: viewModel.giftCard.remainingAmount.toString() ?? '0',
subTitle: viewModel.giftCard.remainingAmount.toStringAsFixed(2) ?? '0.00',
)),
Divider(height: 50),
TextIconButton(
@ -174,41 +174,37 @@ class IoniaGiftCardDetailPage extends BasePage {
),
),
Align(
alignment: Alignment.bottomLeft,
child: Container(
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 0.5),
child: Expanded(
child: ListView.builder(
itemCount: viewModel.giftCard.usageInstructions.length,
itemBuilder: (_, int index) {
final instruction = viewModel.giftCard.usageInstructions[index];
return Expanded(
child: Column(
children: [
Padding(
padding: EdgeInsets.all(10),
child: Text(
instruction.header,
style: textLargeSemiBold(
color: Theme.of(context).textTheme.display2.color,
),
)),
Text(
instruction.body,
style: textMedium(
color: Theme.of(context).textTheme.display2.color,
),
)
]));
})))
),
alignment: Alignment.bottomLeft,
child: Container(
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 0.5),
child: SingleChildScrollView(
child: Column(children: viewModel.giftCard.usageInstructions.map((instruction) {
return [
Padding(
padding: EdgeInsets.all(10),
child: Text(
instruction.header,
style: textLargeSemiBold(
color: Theme.of(context).textTheme.display2.color,
),
)),
Text(
instruction.body,
style: textMedium(
color: Theme.of(context).textTheme.display2.color,
),
)
];
}).expand((e) => e).toList())
)
)),
SizedBox(height: 35),
PrimaryButton(
onPressed: () => Navigator.pop(context),
text: S.of(context).send_got_it,
color: Color.fromRGBO(233, 242, 252, 1),
textColor: Theme.of(context).textTheme.display2.color,
color: Theme.of(context).accentTextTheme.caption.color,
textColor: Theme.of(context).primaryTextTheme.title.color,
),
SizedBox(height: 21),
],