mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-25 12:06:05 +00:00
CAKE-114 | applied disclaimer page when user install wallet first time; applied route to disclaimer page as initial route (main.dart); change leading widget in the disclaimer page; applied call of welcome page when user press accept button in the disclaimer page
This commit is contained in:
parent
a8695cc560
commit
f6e099eb0a
3 changed files with 23 additions and 30 deletions
|
@ -120,7 +120,7 @@ class App extends StatelessWidget {
|
||||||
settingsStore.isDarkTheme ? Brightness.light : Brightness.dark;
|
settingsStore.isDarkTheme ? Brightness.light : Brightness.dark;
|
||||||
final authenticationStore = getIt.get<AuthenticationStore>();
|
final authenticationStore = getIt.get<AuthenticationStore>();
|
||||||
final initialRoute = authenticationStore.state == AuthenticationState.denied
|
final initialRoute = authenticationStore.state == AuthenticationState.denied
|
||||||
? Routes.welcome
|
? Routes.disclaimer
|
||||||
: Routes.login;
|
: Routes.login;
|
||||||
|
|
||||||
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
|
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:cake_wallet/palette.dart';
|
import 'package:cake_wallet/palette.dart';
|
||||||
|
import 'package:cake_wallet/routes.dart';
|
||||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
@ -19,26 +20,29 @@ class DisclaimerPage extends BasePage {
|
||||||
String get title => 'Terms of Use';
|
String get title => 'Terms of Use';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget body(BuildContext context) => DisclaimerPageBody(isReadOnly: true);
|
Widget leading(BuildContext context) {
|
||||||
|
return isReadOnly ? super.leading(context) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget body(BuildContext context) => DisclaimerPageBody(isReadOnly: isReadOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
class DisclaimerPageBody extends StatefulWidget {
|
class DisclaimerPageBody extends StatefulWidget {
|
||||||
DisclaimerPageBody({this.isReadOnly = true});
|
DisclaimerPageBody({this.isReadOnly});
|
||||||
|
|
||||||
final bool isReadOnly;
|
final bool isReadOnly;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
DisclaimerBodyState createState() => DisclaimerBodyState(false);
|
DisclaimerBodyState createState() => DisclaimerBodyState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
||||||
DisclaimerBodyState(this._isAccepted);
|
|
||||||
|
|
||||||
static const xmrtoUrl = 'https://xmr.to/terms-of-service';
|
static const xmrtoUrl = 'https://xmr.to/terms-of-service';
|
||||||
static const changenowUrl = 'https://changenow.io/terms-of-use';
|
static const changenowUrl = 'https://changenow.io/terms-of-use';
|
||||||
static const morphUrl = 'http://morphtoken.com/terms';
|
static const morphUrl = 'http://morphtoken.com/terms';
|
||||||
|
|
||||||
final bool _isAccepted;
|
|
||||||
bool _checked = false;
|
bool _checked = false;
|
||||||
String _fileText = '';
|
String _fileText = '';
|
||||||
|
|
||||||
|
@ -70,7 +74,7 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
getFileLines();
|
getFileLines();
|
||||||
if (_isAccepted) WidgetsBinding.instance.addPostFrameCallback(_afterLayout);
|
if (!widget.isReadOnly) WidgetsBinding.instance.addPostFrameCallback(_afterLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -87,8 +91,7 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
||||||
padding: EdgeInsets.only(left: 24.0, right: 24.0),
|
padding: EdgeInsets.only(left: 24.0, right: 24.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
!_isAccepted
|
Row(
|
||||||
? Row(
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
|
@ -102,13 +105,10 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
: Offstage(),
|
SizedBox(
|
||||||
!_isAccepted
|
|
||||||
? SizedBox(
|
|
||||||
height: 20.0,
|
height: 20.0,
|
||||||
)
|
),
|
||||||
: Offstage(),
|
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -254,8 +254,7 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
if (!widget.isReadOnly) ...[
|
if (!widget.isReadOnly) ...[
|
||||||
!_isAccepted
|
Row(
|
||||||
? Row(
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -303,25 +302,19 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
: Offstage(),
|
Container(
|
||||||
!_isAccepted
|
|
||||||
? Container(
|
|
||||||
padding:
|
padding:
|
||||||
EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0),
|
EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0),
|
||||||
child: PrimaryButton(
|
child: PrimaryButton(
|
||||||
onPressed: _checked ? () {} : null,
|
onPressed: _checked ? () =>
|
||||||
|
Navigator.of(context).popAndPushNamed(Routes.welcome)
|
||||||
|
: null,
|
||||||
text: 'Accept',
|
text: 'Accept',
|
||||||
color: Colors.green,
|
color: Colors.green,
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
: Offstage(),
|
|
||||||
_isAccepted
|
|
||||||
? SizedBox(
|
|
||||||
height: 24.0,
|
|
||||||
)
|
|
||||||
: Offstage()
|
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -144,7 +144,7 @@ abstract class SettingsViewModelBase with Store {
|
||||||
RegularListItem(
|
RegularListItem(
|
||||||
title: S.current.settings_terms_and_conditions,
|
title: S.current.settings_terms_and_conditions,
|
||||||
handler: (BuildContext context) =>
|
handler: (BuildContext context) =>
|
||||||
Navigator.of(context).pushNamed(Routes.disclaimer),
|
Navigator.of(context).pushNamed(Routes.readDisclaimer),
|
||||||
),
|
),
|
||||||
RegularListItem(
|
RegularListItem(
|
||||||
title: S.current.faq,
|
title: S.current.faq,
|
||||||
|
|
Loading…
Reference in a new issue