ToS flow & improvements (#2024)

* remove changenow part of tos, update default route, improve flow * fix back button on tos (willpopscope -> isReadOnly)

Matthew Fosse committed Feb 12, 2025 at 13:48 UTC 8291132ca1149444fb74d6c725b8656b412114e2
3 files changed +42 -60
lib/main.dart
+1 -1
@@ -284,7 +284,7 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
284 final statusBarColor = Colors.transparent;
285 final authenticationStore = getIt.get<AuthenticationStore>();
286 final initialRoute = authenticationStore.state == AuthenticationState.uninitialized
287 - ? Routes.disclaimer
287 + ? Routes.welcome
288 : Routes.login;
289 final currentTheme = settingsStore.currentTheme;
290 final statusBarBrightness =
lib/src/screens/disclaimer/disclaimer_page.dart
+1 -45
@@ -41,7 +41,6 @@ class DisclaimerPageBody extends StatefulWidget {
41 }
42
43 class DisclaimerBodyState extends State<DisclaimerPageBody> {
44 - static const changenowUrl = 'https://changenow.io/terms-of-use';
44
45 bool _checked = false;
46 String _fileText = '';
@@ -63,7 +62,7 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
62 @override
63 Widget build(BuildContext context) {
64 return WillPopScope(
66 - onWillPop: () async => false,
65 + onWillPop: () async => widget.isReadOnly,
66 child: Container(
67 color: Theme.of(context).colorScheme.background,
68 child: Column(
@@ -125,49 +124,6 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
124 SizedBox(
125 height: 16.0,
126 ),
128 - Row(
129 - mainAxisAlignment: MainAxisAlignment.start,
130 - children: <Widget>[
131 - Expanded(
132 - child: Text(
133 - 'Other Terms and Conditions',
134 - textAlign: TextAlign.left,
135 - style: TextStyle(
136 - fontSize: 14.0,
137 - fontWeight: FontWeight.bold,
138 - color: Theme.of(context).extension<CakeTextTheme>()!.titleColor),
139 - ),
140 - )
141 - ],
142 - ),
143 - SizedBox(
144 - height: 16.0,
145 - ),
146 - Row(
147 - mainAxisAlignment: MainAxisAlignment.start,
148 - children: <Widget>[
149 - Expanded(
150 - child: GestureDetector(
151 - onTap: () async {
152 - final uri = Uri.parse(changenowUrl);
153 - if (await canLaunchUrl(uri))
154 - await launchUrl(uri, mode: LaunchMode.externalApplication);
155 - },
156 - child: Text(
157 - changenowUrl,
158 - textAlign: TextAlign.left,
159 - style: TextStyle(
160 - color: Theme.of(context).primaryColor,
161 - fontSize: 14.0,
162 - fontWeight: FontWeight.normal,
163 - decoration: TextDecoration.underline),
164 - ),
165 - ))
166 - ],
167 - ),
168 - SizedBox(
169 - height: 16.0,
170 - )
127 ],
128 ),
129 ),
lib/src/screens/welcome/create_pin_welcome_page.dart
+40 -14
@@ -2,6 +2,7 @@ import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
2 import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
3 import 'package:cake_wallet/themes/theme_base.dart';
4 import 'package:cake_wallet/utils/responsive_layout_util.dart';
5 +import 'package:flutter/gestures.dart';
6 import 'package:flutter/material.dart';
7 import 'package:cake_wallet/routes.dart';
8 import 'package:cake_wallet/src/widgets/primary_button.dart';
@@ -68,7 +69,7 @@ class CreatePinWelcomePage extends BasePage {
69 alignment: Alignment.center,
70 child: ConstrainedBox(
71 constraints:
71 - BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
72 + BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
73 child: Column(
74 mainAxisAlignment: MainAxisAlignment.spaceBetween,
75 children: <Widget>[
@@ -122,19 +123,44 @@ class CreatePinWelcomePage extends BasePage {
123 ),
124 ),
125 ),
125 - bottomSection: Padding(
126 - padding: EdgeInsets.only(top: 24),
127 - child: PrimaryImageButton(
128 - key: ValueKey('create_pin_welcome_page_create_a_pin_button_key'),
129 - onPressed: () => Navigator.pushNamed(context, Routes.welcomeWallet),
130 - image: newWalletImage,
131 - text: isWalletPasswordDirectInput ? S.current.set_up_a_wallet : S.current.set_a_pin,
132 - color: Theme.of(context)
133 - .extension<WalletListTheme>()!
134 - .createNewWalletButtonBackgroundColor,
135 - textColor:
136 - Theme.of(context).extension<WalletListTheme>()!.restoreWalletButtonTextColor,
137 - ),
126 + bottomSection: Column(
127 + children: [
128 + RichText(
129 + textAlign: TextAlign.center,
130 + text: TextSpan(
131 + style: TextStyle(
132 + fontSize: 14,
133 + color: Theme.of(context).extension<NewWalletTheme>()!.hintTextColor,
134 + ),
135 + children: [
136 + TextSpan(text: 'By continuing, you agree to our '),
137 + TextSpan(
138 + text: 'Terms of Service',
139 + style: TextStyle(
140 + color: Theme.of(context).primaryColor,
141 + decoration: TextDecoration.underline,
142 + ),
143 + recognizer: TapGestureRecognizer()
144 + ..onTap = () => Navigator.pushNamed(context, Routes.readDisclaimer),
145 + ),
146 + ],
147 + ),
148 + ),
149 + Padding(
150 + padding: EdgeInsets.only(top: 24),
151 + child: PrimaryImageButton(
152 + key: ValueKey('create_pin_welcome_page_create_a_pin_button_key'),
153 + onPressed: () => Navigator.pushNamed(context, Routes.welcomeWallet),
154 + image: newWalletImage,
155 + text: isWalletPasswordDirectInput ? S.current.set_up_a_wallet : S.current.set_a_pin,
156 + color: Theme.of(context)
157 + .extension<WalletListTheme>()!
158 + .createNewWalletButtonBackgroundColor,
159 + textColor:
160 + Theme.of(context).extension<WalletListTheme>()!.restoreWalletButtonTextColor,
161 + ),
162 + ),
163 + ],
164 ),
165 ),
166 );