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

View file

@ -124,13 +124,13 @@ class IoniaBuyGiftCardPage extends BasePage {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
S.of(context).min_amount(merchant.minimumCardPurchase.toString()), S.of(context).min_amount(merchant.minimumCardPurchase.toStringAsFixed(2)),
style: TextStyle( style: TextStyle(
color: Theme.of(context).primaryTextTheme.headline.color, color: Theme.of(context).primaryTextTheme.headline.color,
), ),
), ),
Text( Text(
S.of(context).max_amount(merchant.maximumCardPurchase.toString()), S.of(context).max_amount(merchant.maximumCardPurchase.toStringAsFixed(2)),
style: TextStyle( style: TextStyle(
color: Theme.of(context).primaryTextTheme.headline.color, color: Theme.of(context).primaryTextTheme.headline.color,
), ),
@ -171,7 +171,7 @@ class IoniaBuyGiftCardPage extends BasePage {
text: S.of(context).continue_text, text: S.of(context).continue_text,
isDisabled: !ioniaBuyCardViewModel.isEnablePurchase, isDisabled: !ioniaBuyCardViewModel.isEnablePurchase,
color: Theme.of(context).accentTextTheme.body2.color, 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( buildIoniaTile(
context, context,
title: S.of(context).amount, title: S.of(context).amount,
subTitle: viewModel.giftCard.remainingAmount.toString() ?? '0', subTitle: viewModel.giftCard.remainingAmount.toStringAsFixed(2) ?? '0.00',
)), )),
Divider(height: 50), Divider(height: 50),
TextIconButton( TextIconButton(
@ -178,14 +178,9 @@ class IoniaGiftCardDetailPage extends BasePage {
child: Container( child: Container(
constraints: BoxConstraints( constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 0.5), maxHeight: MediaQuery.of(context).size.height * 0.5),
child: Expanded( child: SingleChildScrollView(
child: ListView.builder( child: Column(children: viewModel.giftCard.usageInstructions.map((instruction) {
itemCount: viewModel.giftCard.usageInstructions.length, return [
itemBuilder: (_, int index) {
final instruction = viewModel.giftCard.usageInstructions[index];
return Expanded(
child: Column(
children: [
Padding( Padding(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Text( child: Text(
@ -200,15 +195,16 @@ class IoniaGiftCardDetailPage extends BasePage {
color: Theme.of(context).textTheme.display2.color, color: Theme.of(context).textTheme.display2.color,
), ),
) )
])); ];
}))) }).expand((e) => e).toList())
), )
)),
SizedBox(height: 35), SizedBox(height: 35),
PrimaryButton( PrimaryButton(
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
text: S.of(context).send_got_it, text: S.of(context).send_got_it,
color: Color.fromRGBO(233, 242, 252, 1), color: Theme.of(context).accentTextTheme.caption.color,
textColor: Theme.of(context).textTheme.display2.color, textColor: Theme.of(context).primaryTextTheme.title.color,
), ),
SizedBox(height: 21), SizedBox(height: 21),
], ],