ToS flow & improvements (#2024)

* remove changenow part of tos, update default route, improve flow

* fix back button on tos (willpopscope -> isReadOnly)
This commit is contained in:
Matthew Fosse 2025-02-12 13:48:09 -08:00 committed by GitHub
parent b16beb37b7
commit 8291132ca1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 42 additions and 60 deletions

View file

@ -284,7 +284,7 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
final statusBarColor = Colors.transparent;
final authenticationStore = getIt.get<AuthenticationStore>();
final initialRoute = authenticationStore.state == AuthenticationState.uninitialized
? Routes.disclaimer
? Routes.welcome
: Routes.login;
final currentTheme = settingsStore.currentTheme;
final statusBarBrightness =

View file

@ -41,7 +41,6 @@ class DisclaimerPageBody extends StatefulWidget {
}
class DisclaimerBodyState extends State<DisclaimerPageBody> {
static const changenowUrl = 'https://changenow.io/terms-of-use';
bool _checked = false;
String _fileText = '';
@ -63,7 +62,7 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async => false,
onWillPop: () async => widget.isReadOnly,
child: Container(
color: Theme.of(context).colorScheme.background,
child: Column(
@ -125,49 +124,6 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
SizedBox(
height: 16.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: Text(
'Other Terms and Conditions',
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.bold,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor),
),
)
],
),
SizedBox(
height: 16.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: GestureDetector(
onTap: () async {
final uri = Uri.parse(changenowUrl);
if (await canLaunchUrl(uri))
await launchUrl(uri, mode: LaunchMode.externalApplication);
},
child: Text(
changenowUrl,
textAlign: TextAlign.left,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 14.0,
fontWeight: FontWeight.normal,
decoration: TextDecoration.underline),
),
))
],
),
SizedBox(
height: 16.0,
)
],
),
),

View file

@ -2,6 +2,7 @@ import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
@ -68,7 +69,7 @@ class CreatePinWelcomePage extends BasePage {
alignment: Alignment.center,
child: ConstrainedBox(
constraints:
BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
@ -122,19 +123,44 @@ class CreatePinWelcomePage extends BasePage {
),
),
),
bottomSection: Padding(
padding: EdgeInsets.only(top: 24),
child: PrimaryImageButton(
key: ValueKey('create_pin_welcome_page_create_a_pin_button_key'),
onPressed: () => Navigator.pushNamed(context, Routes.welcomeWallet),
image: newWalletImage,
text: isWalletPasswordDirectInput ? S.current.set_up_a_wallet : S.current.set_a_pin,
color: Theme.of(context)
.extension<WalletListTheme>()!
.createNewWalletButtonBackgroundColor,
textColor:
Theme.of(context).extension<WalletListTheme>()!.restoreWalletButtonTextColor,
),
bottomSection: Column(
children: [
RichText(
textAlign: TextAlign.center,
text: TextSpan(
style: TextStyle(
fontSize: 14,
color: Theme.of(context).extension<NewWalletTheme>()!.hintTextColor,
),
children: [
TextSpan(text: 'By continuing, you agree to our '),
TextSpan(
text: 'Terms of Service',
style: TextStyle(
color: Theme.of(context).primaryColor,
decoration: TextDecoration.underline,
),
recognizer: TapGestureRecognizer()
..onTap = () => Navigator.pushNamed(context, Routes.readDisclaimer),
),
],
),
),
Padding(
padding: EdgeInsets.only(top: 24),
child: PrimaryImageButton(
key: ValueKey('create_pin_welcome_page_create_a_pin_button_key'),
onPressed: () => Navigator.pushNamed(context, Routes.welcomeWallet),
image: newWalletImage,
text: isWalletPasswordDirectInput ? S.current.set_up_a_wallet : S.current.set_a_pin,
color: Theme.of(context)
.extension<WalletListTheme>()!
.createNewWalletButtonBackgroundColor,
textColor:
Theme.of(context).extension<WalletListTheme>()!.restoreWalletButtonTextColor,
),
),
],
),
),
);