mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-19 05:58:50 +02:00
CAKE-356 | added "Manage Yats" item to the settings page; reworked primary icon button; added yat address to qr widget; created yat_alert.dart, yat_webview_page.dart, yat_store.dart, yat_view_model.dart, yat_exception.dart, yat_record.dart
This commit is contained in:
@@ -66,7 +66,7 @@ class QRWidget extends StatelessWidget {
|
||||
]),
|
||||
if (isAmountFieldShow)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
@@ -101,7 +101,7 @@ class QRWidget extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 20),
|
||||
padding: EdgeInsets.only(top: 16, bottom: 16),
|
||||
child: Builder(
|
||||
builder: (context) => Observer(
|
||||
builder: (context) => GestureDetector(
|
||||
@@ -133,7 +133,47 @@ class QRWidget extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
))),
|
||||
)
|
||||
),
|
||||
Observer(builder: (_) {
|
||||
return addressListViewModel.yatAddress.isNotEmpty
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(bottom: 10),
|
||||
child: Builder(
|
||||
builder: (context) => GestureDetector(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(
|
||||
text: addressListViewModel.yatAddress));
|
||||
showBar<void>(
|
||||
context, S.of(context).copied_to_clipboard);
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'Yat Address',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context).accentTextTheme.
|
||||
display3.backgroundColor),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: Text(
|
||||
addressListViewModel.yatAddress,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
),
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
)),
|
||||
)
|
||||
: Container();
|
||||
})
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import 'package:cake_wallet/src/screens/yat/widgets/yat_close_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class YatBar extends StatelessWidget {
|
||||
YatBar({this.onClose});
|
||||
|
||||
final VoidCallback onClose;
|
||||
final image = Image.asset('assets/images/yat_logo.png');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 0,
|
||||
child: YatCloseButton(onClose: onClose)
|
||||
),
|
||||
Positioned(
|
||||
top: 16,
|
||||
child: image
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class YatCloseButton extends StatelessWidget {
|
||||
YatCloseButton({this.onClose});
|
||||
|
||||
final VoidCallback onClose;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onClose,
|
||||
child: Container(
|
||||
height: 28,
|
||||
width: 28,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Palette.manatee,
|
||||
shape: BoxShape.circle
|
||||
),
|
||||
child: Icon(
|
||||
Icons.clear,
|
||||
color: Colors.white,
|
||||
size: 20)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/yat/widgets/yat_bar.dart';
|
||||
import 'package:cake_wallet/src/screens/yat/yat_webview_page.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';
|
||||
|
||||
class YatAlert extends StatelessWidget {
|
||||
static const aspectRatioImage = 1.133;
|
||||
final image = Image.asset('assets/images/yat_crypto.png');
|
||||
|
||||
@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: () => Navigator.of(context).pop())
|
||||
),
|
||||
AspectRatio(
|
||||
aspectRatio: aspectRatioImage,
|
||||
child: FittedBox(child: image, fit: BoxFit.fill)
|
||||
),
|
||||
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, 40),
|
||||
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: () => Navigator.of(context)
|
||||
.popAndPushNamed(Routes.yat, arguments: YatMode.create)),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
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: () => Navigator.of(context)
|
||||
.popAndPushNamed(Routes.yat, arguments: YatMode.connect))
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/view_model/yat_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
enum YatMode {create, connect}
|
||||
|
||||
class YatWebViewPage extends BasePage {
|
||||
YatWebViewPage({this.yatViewModel, this.mode}) {
|
||||
switch (mode) {
|
||||
case YatMode.create:
|
||||
url = _baseUrl + _createSuffix;
|
||||
break;
|
||||
case YatMode.connect:
|
||||
url = _baseUrl + _signInSuffix;
|
||||
break;
|
||||
default:
|
||||
url = _baseUrl + _createSuffix;
|
||||
}
|
||||
}
|
||||
|
||||
static const _baseUrl = 'https://y.at';
|
||||
static const _signInSuffix = '/sign-in';
|
||||
static const _createSuffix = '/create';
|
||||
|
||||
final YatMode mode;
|
||||
final YatViewModel yatViewModel;
|
||||
|
||||
String url;
|
||||
|
||||
@override
|
||||
String get title => 'Yat';
|
||||
|
||||
@override
|
||||
Color get backgroundDarkColor => Colors.white;
|
||||
|
||||
@override
|
||||
Color get titleColor => Palette.darkBlueCraiola;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) => WebView(
|
||||
initialUrl: url,
|
||||
javascriptMode: JavascriptMode.unrestricted);
|
||||
}
|
||||
@@ -110,6 +110,9 @@ class PrimaryIconButton extends StatelessWidget {
|
||||
@required this.borderColor,
|
||||
@required this.iconColor,
|
||||
@required this.iconBackgroundColor,
|
||||
@required this.textColor,
|
||||
this.mainAxisAlignment = MainAxisAlignment.start,
|
||||
this.radius = 26
|
||||
});
|
||||
|
||||
final VoidCallback onPressed;
|
||||
@@ -119,40 +122,44 @@ class PrimaryIconButton extends StatelessWidget {
|
||||
final Color iconColor;
|
||||
final Color iconBackgroundColor;
|
||||
final String text;
|
||||
final MainAxisAlignment mainAxisAlignment;
|
||||
final Color textColor;
|
||||
final double radius;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
height: 56.0,
|
||||
height: 52.0,
|
||||
child: FlatButton(
|
||||
onPressed: onPressed,
|
||||
color: color,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(color: borderColor),
|
||||
borderRadius: BorderRadius.circular(10.0)),
|
||||
borderRadius: BorderRadius.circular(radius)),
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisAlignment: mainAxisAlignment,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 28.0,
|
||||
height: 56.0,
|
||||
width: 26.0,
|
||||
height: 52.0,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle, color: iconBackgroundColor),
|
||||
child: Icon(iconData, color: iconColor, size: 22.0),
|
||||
child: Center(
|
||||
child: Icon(iconData, color: iconColor, size: 22.0)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
height: 56.0,
|
||||
height: 52.0,
|
||||
child: Center(
|
||||
child: Text(text,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
color:
|
||||
Theme.of(context).primaryTextTheme.button.color)),
|
||||
color: textColor)),
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user