Cw 150 cake pay introduction card (#486)

* create introducing card

* add ability to close the card

* update walletInfo class

* update localization

* fix intro text

* fix card size

* show card for existing and new wallet types

* disable card for haven wallets

* fixes to PR

* fixes to PR

* fix PR
This commit is contained in:
Serhii
2022-08-30 19:03:02 +01:00
committed by GitHub
parent 5fcbf3634b
commit 7fae9cf9bb
21 changed files with 189 additions and 19 deletions
@@ -7,6 +7,9 @@ import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:auto_size_text/auto_size_text.dart';
import 'package:cake_wallet/src/widgets/introducing_card.dart';
import 'package:cake_wallet/generated/i18n.dart';
class BalancePage extends StatelessWidget{
BalancePage({@required this.dashboardViewModel, @required this.settingsStore});
@@ -44,6 +47,19 @@ class BalancePage extends StatelessWidget{
maxLines: 1,
textAlign: TextAlign.center);
})),
Observer(builder: (_) {
if (dashboardViewModel.balanceViewModel.isShowCard){
return IntroducingCard(
title: S.of(context).introducing_cake_pay,
subTitle: S.of(context).cake_pay_learn_more,
borderColor: settingsStore.currentTheme.type == ThemeType.bright
? Color.fromRGBO(255, 255, 255, 0.2)
: Colors.transparent,
closeCard: dashboardViewModel.balanceViewModel.disableIntroCakePayCard
);
}
return Container ();
}),
Observer(builder: (_) {
return ListView.separated(
physics: NeverScrollableScrollPhysics(),
@@ -180,3 +196,4 @@ class BalancePage extends StatelessWidget{
);
}
}
+89
View File
@@ -0,0 +1,89 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class IntroducingCard extends StatelessWidget {
IntroducingCard(
{this.borderColor, this.closeCard, this.title, this.subTitle});
final String title;
final String subTitle;
final Color borderColor;
final Function() closeCard;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.fromLTRB(16,0,16,16),
child: Container(
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30.0),
border: Border.all(
color: borderColor,
width: 1,
),
color: Theme.of(context).textTheme.title.backgroundColor),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: Padding(
padding: const EdgeInsets.all(24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AutoSizeText(title ?? '',
style: TextStyle(
fontSize: 24,
fontFamily: 'Lato',
fontWeight: FontWeight.bold,
color: Theme.of(context)
.accentTextTheme
.display3
.backgroundColor,
height: 1),
maxLines: 1,
textAlign: TextAlign.center),
SizedBox(height: 14),
Text(subTitle ?? '',
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 12,
fontFamily: 'Lato',
color: Theme.of(context)
.accentTextTheme
.display3
.backgroundColor,
height: 1)),
],
),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(0,16,16,0),
child: GestureDetector(
onTap: closeCard,
child: Container(
height: 23,
width: 23,
decoration: BoxDecoration(
color: Colors.white, shape: BoxShape.circle),
child: Center(
child: Image.asset(
'assets/images/x.png',
color: Palette.darkBlueCraiola,
height: 15,
width: 15,
)),
),
),
)
],
),
),
);
}
}