mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
CAKE-360 | added shouldShowYatPopup parameter to settings_store.dart and applied this parameter to dashboard_view_model.dart and dashboard_page.dart; added scrollbar to choose_yat_address_alert.dart; changed yat logo; fixed fetchYatAddress() method in the yat_store.dart; created class YatLink
This commit is contained in:
@@ -156,14 +156,17 @@ 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());
|
||||
});
|
||||
if (walletViewModel.shouldShowYatPopup) {
|
||||
await Future<void>.delayed(Duration(seconds: 1));
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return YatPopup(
|
||||
dashboardViewModel: walletViewModel,
|
||||
onClose: () => Navigator.of(context).pop());
|
||||
});
|
||||
walletViewModel.furtherShowYatPopup(false);
|
||||
}
|
||||
|
||||
autorun((_) async {
|
||||
if (!walletViewModel.isOutdatedElectrumWallet) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cake_wallet/src/widgets/cake_scrollbar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_alert_dialog.dart';
|
||||
|
||||
@@ -22,51 +23,98 @@ class ChooseYatAddressAlert extends BaseAlertDialog {
|
||||
bool get barrierDismissible => false;
|
||||
|
||||
@override
|
||||
Widget actionButtons(BuildContext context) {
|
||||
return Container(
|
||||
width: 300,
|
||||
height: 105,
|
||||
color: Theme.of(context).accentTextTheme.body1.backgroundColor,
|
||||
child: ListView.separated(
|
||||
padding: EdgeInsets.all(0),
|
||||
itemCount: addresses.length,
|
||||
separatorBuilder: (_, __) => Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).dividerColor,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
final address = addresses[index];
|
||||
Widget actionButtons(BuildContext context) =>
|
||||
ChooseYatAddressButtons(addresses);
|
||||
}
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop<String>(address),
|
||||
child: Container(
|
||||
width: 300,
|
||||
height: 52,
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
address,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: 'Lato',
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
)
|
||||
)
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
})
|
||||
class ChooseYatAddressButtons extends StatefulWidget {
|
||||
ChooseYatAddressButtons(this.addresses);
|
||||
|
||||
final List<String> addresses;
|
||||
|
||||
@override
|
||||
ChooseYatAddressButtonsState createState() =>
|
||||
ChooseYatAddressButtonsState(addresses);
|
||||
}
|
||||
|
||||
class ChooseYatAddressButtonsState extends State<ChooseYatAddressButtons> {
|
||||
ChooseYatAddressButtonsState(this.addresses)
|
||||
: itemCount = addresses?.length ?? 0;
|
||||
|
||||
final List<String> addresses;
|
||||
final int itemCount;
|
||||
final double backgroundHeight = 118;
|
||||
final double thumbHeight = 72;
|
||||
ScrollController controller = ScrollController();
|
||||
double fromTop = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
controller.addListener(() {
|
||||
fromTop = controller.hasClients
|
||||
? (controller.offset / controller.position.maxScrollExtent *
|
||||
(backgroundHeight - thumbHeight))
|
||||
: 0;
|
||||
setState(() {});
|
||||
});
|
||||
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Container(
|
||||
width: 300,
|
||||
height: 158,
|
||||
color: Theme.of(context).accentTextTheme.body1.backgroundColor,
|
||||
child: ListView.separated(
|
||||
controller: controller,
|
||||
padding: EdgeInsets.all(0),
|
||||
itemCount: itemCount,
|
||||
separatorBuilder: (_, __) => Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).dividerColor,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
final address = addresses[index];
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop<String>(address),
|
||||
child: Container(
|
||||
width: 300,
|
||||
height: 52,
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
address,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: 'Lato',
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
)
|
||||
)
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
})
|
||||
),
|
||||
if (itemCount > 3) CakeScrollbar(
|
||||
backgroundHeight: backgroundHeight,
|
||||
thumbHeight: thumbHeight,
|
||||
fromTop: fromTop,
|
||||
//rightOffset: -15
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ class YatBar extends StatelessWidget {
|
||||
YatBar({this.onClose});
|
||||
|
||||
final VoidCallback onClose;
|
||||
final image = Image.asset('assets/images/yat_logo.png');
|
||||
final image = Image.asset('assets/images/yat_logo.png', width: 81, height: 28);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -11,7 +11,9 @@ import 'package:lottie/lottie.dart';
|
||||
|
||||
class YatAlert extends StatelessWidget {
|
||||
YatAlert(this.yatStore)
|
||||
: baseUrl = isYatDevMode ? baseDevUrl : baseReleaseUrl;
|
||||
: baseUrl = YatLink.isDevMode
|
||||
? YatLink.baseDevUrl
|
||||
: YatLink.baseReleaseUrl;
|
||||
|
||||
final YatStore yatStore;
|
||||
final String baseUrl;
|
||||
@@ -86,7 +88,7 @@ class YatAlert extends StatelessWidget {
|
||||
.arrow_up_right_square,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
onPressed: () {
|
||||
final url = baseUrl + createSuffix;
|
||||
final url = baseUrl + YatLink.createSuffix;
|
||||
launch(url);
|
||||
}),
|
||||
Padding(
|
||||
@@ -102,11 +104,11 @@ class YatAlert extends StatelessWidget {
|
||||
.arrow_up_right_square,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
onPressed: () {
|
||||
String url = baseUrl + signInSuffix;
|
||||
String url = baseUrl + YatLink.signInSuffix;
|
||||
final parameters =
|
||||
yatStore.defineQueryParameters();
|
||||
if (parameters.isNotEmpty) {
|
||||
url += queryParameter + parameters;
|
||||
url += YatLink.queryParameter + parameters;
|
||||
}
|
||||
launch(url);
|
||||
})
|
||||
|
||||
@@ -14,7 +14,9 @@ import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class YatPopup extends StatelessWidget {
|
||||
YatPopup({this.dashboardViewModel, this.onClose})
|
||||
: baseUrl = isYatDevMode ? baseDevUrl : baseReleaseUrl;
|
||||
: baseUrl = YatLink.isDevMode
|
||||
? YatLink.baseDevUrl
|
||||
: YatLink.baseReleaseUrl;
|
||||
|
||||
static const durationInMilliseconds = 250;
|
||||
|
||||
@@ -157,15 +159,15 @@ class YatPopup extends StatelessWidget {
|
||||
child: ThirdIntroduction(
|
||||
onClose: onClose,
|
||||
onGet: () {
|
||||
final url = baseUrl + createSuffix;
|
||||
final url = baseUrl + YatLink.createSuffix;
|
||||
launch(url);
|
||||
},
|
||||
onConnect: () {
|
||||
String url = baseUrl + signInSuffix;
|
||||
String url = baseUrl + YatLink.signInSuffix;
|
||||
final parameters = dashboardViewModel
|
||||
.yatStore.defineQueryParameters();
|
||||
if (parameters.isNotEmpty) {
|
||||
url += queryParameter + parameters;
|
||||
url += YatLink.queryParameter + parameters;
|
||||
}
|
||||
launch(url);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user