mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-19 05:58:50 +02:00
CAKE-360 | merged all yat branches into current; saving information about yat to connected wallet; fixed qr widget; applied yat, unstoppable domains and open alias to contact book
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:cake_wallet/core/validator.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -97,8 +98,9 @@ class ContactPage extends BasePage {
|
||||
buttonColor: Theme.of(context).accentTextTheme.display2.color,
|
||||
iconColor: PaletteDark.gray,
|
||||
borderColor: Theme.of(context).primaryTextTheme.title.backgroundColor,
|
||||
validator: AddressValidator(
|
||||
type: contactViewModel.currency),
|
||||
validator: TextValidator()
|
||||
// AddressValidator(
|
||||
// type: contactViewModel.currency),
|
||||
)),
|
||||
)
|
||||
],
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:cake_wallet/entities/wallet_type.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/yat/yat_popup.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
@@ -145,7 +146,7 @@ class DashboardPage extends BasePage {
|
||||
));
|
||||
}
|
||||
|
||||
void _setEffects(BuildContext context) {
|
||||
void _setEffects(BuildContext context) async {
|
||||
if (_isEffectsInstalled) {
|
||||
return;
|
||||
}
|
||||
@@ -155,6 +156,15 @@ class DashboardPage extends BasePage {
|
||||
pages.add(BalancePage(dashboardViewModel: walletViewModel));
|
||||
pages.add(TransactionsPage(dashboardViewModel: walletViewModel));
|
||||
|
||||
await Future<void>.delayed(Duration(seconds: 1));
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return YatPopup(
|
||||
dashboardViewModel: walletViewModel,
|
||||
onClose: () => Navigator.of(context).pop());
|
||||
});
|
||||
|
||||
autorun((_) async {
|
||||
if (!walletViewModel.isOutdatedElectrumWallet) {
|
||||
return;
|
||||
|
||||
@@ -235,6 +235,15 @@ class ExchangePage extends BasePage {
|
||||
await fetchParsedAddress(
|
||||
context, domain, ticker);
|
||||
},
|
||||
onPushAddressBookButton: (context) async {
|
||||
final domain =
|
||||
exchangeViewModel.depositAddress;
|
||||
final ticker = exchangeViewModel
|
||||
.depositCurrency.title.toLowerCase();
|
||||
exchangeViewModel.depositAddress =
|
||||
await fetchParsedAddress(
|
||||
context, domain, ticker);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -291,6 +300,15 @@ class ExchangePage extends BasePage {
|
||||
await fetchParsedAddress(
|
||||
context, domain, ticker);
|
||||
},
|
||||
onPushAddressBookButton: (context) async {
|
||||
final domain =
|
||||
exchangeViewModel.receiveAddress;
|
||||
final ticker = exchangeViewModel
|
||||
.receiveCurrency.title.toLowerCase();
|
||||
exchangeViewModel.receiveAddress =
|
||||
await fetchParsedAddress(
|
||||
context, domain, ticker);
|
||||
},
|
||||
)),
|
||||
)
|
||||
],
|
||||
|
||||
@@ -34,7 +34,8 @@ class ExchangeCard extends StatefulWidget {
|
||||
this.addressFocusNode,
|
||||
this.hasAllAmount = false,
|
||||
this.allAmount,
|
||||
this.onPushPasteButton})
|
||||
this.onPushPasteButton,
|
||||
this.onPushAddressBookButton})
|
||||
: super(key: key);
|
||||
|
||||
final List<CryptoCurrency> currencies;
|
||||
@@ -59,6 +60,7 @@ class ExchangeCard extends StatefulWidget {
|
||||
final bool hasAllAmount;
|
||||
final Function allAmount;
|
||||
final Function(BuildContext context) onPushPasteButton;
|
||||
final Function(BuildContext context) onPushAddressBookButton;
|
||||
|
||||
@override
|
||||
ExchangeCardState createState() => ExchangeCardState();
|
||||
@@ -321,6 +323,7 @@ class ExchangeCardState extends State<ExchangeCard> {
|
||||
buttonColor: widget.addressButtonsColor,
|
||||
validator: widget.addressTextFieldValidator,
|
||||
onPushPasteButton: widget.onPushPasteButton,
|
||||
onPushAddressBookButton: widget.onPushAddressBookButton
|
||||
),
|
||||
)
|
||||
: Padding(
|
||||
@@ -366,6 +369,8 @@ class ExchangeCardState extends State<ExchangeCard> {
|
||||
setState(() =>
|
||||
addressController.text =
|
||||
contact.address);
|
||||
widget.onPushAddressBookButton
|
||||
?.call(context);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
|
||||
@@ -101,7 +101,7 @@ class QRWidget extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 16, bottom: 16),
|
||||
padding: EdgeInsets.only(top: 10, bottom: 10),
|
||||
child: Builder(
|
||||
builder: (context) => Observer(
|
||||
builder: (context) => GestureDetector(
|
||||
@@ -164,7 +164,7 @@ class QRWidget extends StatelessWidget {
|
||||
addressListViewModel.emoji,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontSize: 26,
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -156,8 +156,10 @@ class SendCardState extends State<SendCard>
|
||||
output.resetParsedAddress();
|
||||
await output.fetchParsedAddress(context);
|
||||
},
|
||||
onPushAddressBookButton: (context) =>
|
||||
output.resetParsedAddress(),
|
||||
onPushAddressBookButton: (context) async {
|
||||
output.resetParsedAddress();
|
||||
await output.fetchParsedAddress(context);
|
||||
},
|
||||
validator: validator,
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
import 'package:cake_wallet/src/screens/yat/widgets/yat_bar.dart';
|
||||
import 'package:cake_wallet/src/screens/yat/widgets/yat_page_indicator.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
|
||||
class FirstIntroduction extends StatelessWidget {
|
||||
FirstIntroduction({this.onClose, this.onNext});
|
||||
|
||||
static const aspectRatioImage = 1.133;
|
||||
final VoidCallback onClose;
|
||||
final VoidCallback onNext;
|
||||
final animation = Lottie.asset('assets/animation/anim1.json');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenHeight = MediaQuery.of(context).size.height;
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
|
||||
return Container(
|
||||
height: screenHeight,
|
||||
width: screenWidth,
|
||||
color: Colors.white,
|
||||
child: ScrollableWithBottomSection(
|
||||
contentPadding: EdgeInsets.only(top: 40, bottom: 40),
|
||||
content: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 45,
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: YatBar(onClose: () => Navigator.of(context).pop())
|
||||
),
|
||||
animation,
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 30, right: 30),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Send and receive crypto more easily with Yat',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Lato',
|
||||
color: Colors.black,
|
||||
decoration: TextDecoration.none,
|
||||
)
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Text(
|
||||
'Cake Wallet users can now send and receive all their favorite currencies with a one-of-a-kind emoji-based username.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontFamily: 'Lato',
|
||||
color: Colors.black,
|
||||
decoration: TextDecoration.none,
|
||||
)
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
]
|
||||
),
|
||||
bottomSectionPadding: EdgeInsets.fromLTRB(24, 0, 24, 24),
|
||||
bottomSection: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
PrimaryButton(
|
||||
text: 'Next',
|
||||
textColor: Colors.white,
|
||||
color: Palette.protectiveBlue,
|
||||
onPressed: onNext
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: YatPageIndicator(filled: 0)
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
import 'package:cake_wallet/src/screens/yat/widgets/yat_bar.dart';
|
||||
import 'package:cake_wallet/src/screens/yat/widgets/yat_page_indicator.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
|
||||
class SecondIntroduction extends StatelessWidget {
|
||||
SecondIntroduction({this.onClose, this.onNext});
|
||||
|
||||
final VoidCallback onClose;
|
||||
final VoidCallback onNext;
|
||||
final animation = Lottie.asset('assets/animation/anim2.json');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenHeight = MediaQuery.of(context).size.height;
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
|
||||
return Container(
|
||||
height: screenHeight,
|
||||
width: screenWidth,
|
||||
color: Colors.white,
|
||||
child: ScrollableWithBottomSection(
|
||||
contentPadding: EdgeInsets.only(top: 40, bottom: 40),
|
||||
content: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 45,
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: YatBar(onClose: onClose)
|
||||
),
|
||||
animation,
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 40, left: 30, right: 30),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'One emoji address to rule them all',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Lato',
|
||||
color: Colors.black,
|
||||
decoration: TextDecoration.none,
|
||||
)
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Text(
|
||||
'Your Yat is a single unique emoji address that replaces all of your long hexadecimal addresses for all of your currencies.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontFamily: 'Lato',
|
||||
color: Colors.black,
|
||||
decoration: TextDecoration.none,
|
||||
)
|
||||
)
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
bottomSectionPadding: EdgeInsets.fromLTRB(24, 0, 24, 24),
|
||||
bottomSection: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
PrimaryButton(
|
||||
text: 'Next',
|
||||
textColor: Colors.white,
|
||||
color: Palette.protectiveBlue,
|
||||
onPressed: onNext
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: YatPageIndicator(filled: 1)
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
import 'package:cake_wallet/src/screens/yat/widgets/yat_bar.dart';
|
||||
import 'package:cake_wallet/src/screens/yat/widgets/yat_page_indicator.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
|
||||
class ThirdIntroduction extends StatelessWidget {
|
||||
ThirdIntroduction({this.onClose, this.onGet, this.onConnect});
|
||||
|
||||
final VoidCallback onClose;
|
||||
final VoidCallback onGet;
|
||||
final VoidCallback onConnect;
|
||||
final animation = Lottie.asset('assets/animation/anim3.json');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenHeight = MediaQuery.of(context).size.height;
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
|
||||
return Container(
|
||||
height: screenHeight,
|
||||
width: screenWidth,
|
||||
color: Colors.white,
|
||||
child: ScrollableWithBottomSection(
|
||||
contentPadding: EdgeInsets.only(top: 40, bottom: 40),
|
||||
content: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 90,
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: YatBar(onClose: onClose)
|
||||
),
|
||||
animation,
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 40, left: 30, right: 30),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Yat plays nicely with others',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Lato',
|
||||
color: Colors.black,
|
||||
decoration: TextDecoration.none,
|
||||
)
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Text(
|
||||
'Yats live outside of Cake Wallet, too. Any wallet address on earth can be replaced with a Yat!',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontFamily: 'Lato',
|
||||
color: Colors.black,
|
||||
decoration: TextDecoration.none,
|
||||
)
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
bottomSectionPadding: EdgeInsets.fromLTRB(24, 0, 24, 24),
|
||||
bottomSection: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
PrimaryIconButton(
|
||||
text: 'Get your Yat',
|
||||
textColor: Colors.white,
|
||||
color: Palette.protectiveBlue,
|
||||
borderColor: Palette.protectiveBlue,
|
||||
iconColor: Colors.white,
|
||||
iconBackgroundColor: Colors.transparent,
|
||||
iconData: CupertinoIcons
|
||||
.arrow_up_right_square,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
onPressed: onGet),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 12),
|
||||
child: PrimaryIconButton(
|
||||
text: 'Connect an existing Yat',
|
||||
textColor: Colors.black,
|
||||
color: Palette.blueAlice,
|
||||
borderColor: Palette.blueAlice,
|
||||
iconColor: Colors.black,
|
||||
iconBackgroundColor: Colors.transparent,
|
||||
iconData: CupertinoIcons
|
||||
.arrow_up_right_square,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
onPressed: onConnect)
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: YatPageIndicator(filled: 2)
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class YatPageIndicator extends StatelessWidget {
|
||||
YatPageIndicator({this.filled});
|
||||
|
||||
final int filled;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: 44,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: List.generate(3, (index) {
|
||||
final size = 8.0;
|
||||
final isFilled = index == filled;
|
||||
|
||||
return Container(
|
||||
height: size,
|
||||
width: size,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: isFilled
|
||||
? Palette.frostySky
|
||||
: Palette.stateGray.withOpacity(0.1)
|
||||
)
|
||||
);
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
import 'package:cake_wallet/core/wallet_base.dart';
|
||||
import 'package:cake_wallet/entities/wallet_type.dart';
|
||||
import 'package:cake_wallet/src/screens/yat/widgets/yat_bar.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/store/yat/yat_store.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
@@ -11,22 +10,13 @@ import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
|
||||
class YatAlert extends StatelessWidget {
|
||||
YatAlert({@required this.wallet, this.isYatDevMode = false})
|
||||
: baseUrl = isYatDevMode ? _baseDevUrl : _baseReleaseUrl,
|
||||
address = wallet.walletAddresses.address;
|
||||
YatAlert(this.yatStore)
|
||||
: baseUrl = isYatDevMode ? baseDevUrl : baseReleaseUrl;
|
||||
|
||||
final WalletBase wallet;
|
||||
final bool isYatDevMode;
|
||||
final String address;
|
||||
final YatStore yatStore;
|
||||
final String baseUrl;
|
||||
static const aspectRatioImage = 1.133;
|
||||
static const _baseDevUrl = 'https://yat.fyi';
|
||||
static const _baseReleaseUrl = 'https://y.at';
|
||||
static const _signInSuffix = '/partner/CW/link-email';
|
||||
static const _createSuffix = '/create';
|
||||
static const _queryParameter = '?addresses=';
|
||||
final image = Image.asset('assets/images/yat_crypto.png');
|
||||
final anim = Lottie.asset('assets/animation/anim1.json');
|
||||
final animation = Lottie.asset('assets/animation/anim1.json');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -42,15 +32,11 @@ class YatAlert extends StatelessWidget {
|
||||
content: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 45, // 90
|
||||
height: 45,
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: YatBar(onClose: () => Navigator.of(context).pop())
|
||||
),
|
||||
anim,
|
||||
// AspectRatio(
|
||||
// aspectRatio: aspectRatioImage,
|
||||
// child: FittedBox(child: image, fit: BoxFit.fill)
|
||||
// ),
|
||||
animation,
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 30, right: 30),
|
||||
child: Column(
|
||||
@@ -100,7 +86,7 @@ class YatAlert extends StatelessWidget {
|
||||
.arrow_up_right_square,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
onPressed: () {
|
||||
final url = baseUrl + _createSuffix;
|
||||
final url = baseUrl + createSuffix;
|
||||
launch(url);
|
||||
}),
|
||||
Padding(
|
||||
@@ -116,8 +102,12 @@ class YatAlert extends StatelessWidget {
|
||||
.arrow_up_right_square,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
onPressed: () {
|
||||
final url = baseUrl + _signInSuffix + _queryParameter +
|
||||
_defineTag() + '%3D' + address;
|
||||
String url = baseUrl + signInSuffix;
|
||||
final parameters =
|
||||
yatStore.defineQueryParameters();
|
||||
if (parameters.isNotEmpty) {
|
||||
url += queryParameter + parameters;
|
||||
}
|
||||
launch(url);
|
||||
})
|
||||
)
|
||||
@@ -126,24 +116,4 @@ class YatAlert extends StatelessWidget {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
String _defineTag() {
|
||||
String tag;
|
||||
switch (wallet.type) {
|
||||
case WalletType.monero:
|
||||
tag = address.startsWith('4')
|
||||
? '0x1001'
|
||||
: '0x1002';
|
||||
break;
|
||||
case WalletType.bitcoin:
|
||||
tag = '0x1003';
|
||||
break;
|
||||
case WalletType.litecoin:
|
||||
tag = '0x3fff';
|
||||
break;
|
||||
default:
|
||||
tag = '0x3fff';
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/screens/yat/widgets/first_introduction.dart';
|
||||
import 'package:cake_wallet/src/screens/yat/widgets/second_introduction.dart';
|
||||
import 'package:cake_wallet/src/screens/yat/widgets/third_introduction.dart';
|
||||
import 'package:cake_wallet/src/screens/yat/widgets/yat_close_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_background.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/store/yat/yat_store.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:animate_do/animate_do.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class YatPopup extends StatelessWidget {
|
||||
YatPopup({this.dashboardViewModel, this.onClose})
|
||||
: baseUrl = isYatDevMode ? baseDevUrl : baseReleaseUrl;
|
||||
|
||||
static const durationInMilliseconds = 250;
|
||||
|
||||
final DashboardViewModel dashboardViewModel;
|
||||
final VoidCallback onClose;
|
||||
final String baseUrl;
|
||||
final image = Image.asset('assets/images/emoji_popup.png');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
AlertBackground(
|
||||
child: Container()
|
||||
),
|
||||
SlideInUp(
|
||||
from: 420,
|
||||
duration: Duration(milliseconds: durationInMilliseconds),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(24),
|
||||
topRight: Radius.circular(24)),
|
||||
child: Container(
|
||||
height: 420,
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.fromLTRB(24, 15, 24, 24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
YatCloseButton(onClose: onClose)
|
||||
]
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: 64,
|
||||
width: 165,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius
|
||||
.all(Radius.circular(32)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 15,
|
||||
offset: Offset(0, 5)
|
||||
)
|
||||
]
|
||||
),
|
||||
child: image
|
||||
)
|
||||
]
|
||||
)
|
||||
]
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 6, right: 6),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Your wallet address can be emojified.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Lato',
|
||||
color: Colors.black,
|
||||
decoration: TextDecoration.none,
|
||||
)
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Text(
|
||||
'You can now send and receive crypto in Cake Wallet with your Yat - a short, emoji-based username. Manage Yats at any time on the settings screen',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontFamily: 'Lato',
|
||||
color: Colors.black,
|
||||
decoration: TextDecoration.none,
|
||||
)
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
),
|
||||
PrimaryButton(
|
||||
text: 'Learn More',
|
||||
textColor: Colors.white,
|
||||
color: Palette.protectiveBlue,
|
||||
onPressed: () => dashboardViewModel
|
||||
.isShowFirstYatIntroduction = true
|
||||
)
|
||||
],
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
Observer(builder: (_) => dashboardViewModel.isShowFirstYatIntroduction
|
||||
? SlideInRight(
|
||||
from: screenWidth,
|
||||
duration: Duration(milliseconds: durationInMilliseconds),
|
||||
child: FirstIntroduction(
|
||||
onClose: onClose,
|
||||
onNext: () => dashboardViewModel
|
||||
.isShowSecondYatIntroduction = true
|
||||
))
|
||||
: Container()
|
||||
),
|
||||
Observer(builder: (_) => dashboardViewModel.isShowSecondYatIntroduction
|
||||
? SlideInRight(
|
||||
from: screenWidth,
|
||||
duration: Duration(milliseconds: durationInMilliseconds),
|
||||
child: SecondIntroduction(
|
||||
onClose: onClose,
|
||||
onNext: () => dashboardViewModel
|
||||
.isShowThirdYatIntroduction = true
|
||||
))
|
||||
: Container()
|
||||
),
|
||||
Observer(builder: (_) => dashboardViewModel.isShowThirdYatIntroduction
|
||||
? SlideInRight(
|
||||
from: screenWidth,
|
||||
duration: Duration(milliseconds: durationInMilliseconds),
|
||||
child: ThirdIntroduction(
|
||||
onClose: onClose,
|
||||
onGet: () {
|
||||
final url = baseUrl + createSuffix;
|
||||
launch(url);
|
||||
},
|
||||
onConnect: () {
|
||||
String url = baseUrl + signInSuffix;
|
||||
final parameters = dashboardViewModel
|
||||
.yatStore.defineQueryParameters();
|
||||
if (parameters.isNotEmpty) {
|
||||
url += queryParameter + parameters;
|
||||
}
|
||||
launch(url);
|
||||
}
|
||||
))
|
||||
: Container()
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user