mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-15 16:12:16 +00:00
Merge branch 'privacyoptions' into testing-exchange
This commit is contained in:
commit
75d15246ea
4 changed files with 208 additions and 101 deletions
|
@ -3,7 +3,7 @@ import 'dart:async';
|
|||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/pages/pinpad_views/create_pin_view.dart';
|
||||
import 'package:stackwallet/hive/db.dart';
|
||||
import 'package:stackwallet/pages/stack_privacy_calls.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
|
@ -11,8 +11,6 @@ import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
|||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import 'package:stackwallet/hive/db.dart';
|
||||
|
||||
class IntroView extends StatefulWidget {
|
||||
const IntroView({Key? key}) : super(key: key);
|
||||
|
||||
|
@ -248,7 +246,8 @@ class GetStartedButton extends StatelessWidget {
|
|||
onPressed: () {
|
||||
unawaited(DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "externalCalls", value: true));
|
||||
Navigator.of(context).pushNamed(StackPrivacyCalls.routeName);
|
||||
Navigator.of(context)
|
||||
.pushNamed(StackPrivacyCalls.routeName, arguments: false);
|
||||
},
|
||||
child: Text(
|
||||
"Get started",
|
||||
|
@ -263,7 +262,8 @@ class GetStartedButton extends StatelessWidget {
|
|||
.extension<StackColors>()!
|
||||
.getPrimaryEnabledButtonColor(context),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pushNamed(StackPrivacyCalls.routeName);
|
||||
Navigator.of(context)
|
||||
.pushNamed(StackPrivacyCalls.routeName, arguments: false);
|
||||
},
|
||||
child: Text(
|
||||
"Get started",
|
||||
|
|
|
@ -9,6 +9,9 @@ import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
|||
import 'package:stackwallet/widgets/custom_buttons/draggable_switch_button.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
|
||||
import '../../../../hive/db.dart';
|
||||
import '../../../stack_privacy_calls.dart';
|
||||
|
||||
class AdvancedSettingsView extends StatelessWidget {
|
||||
const AdvancedSettingsView({
|
||||
Key? key,
|
||||
|
@ -20,6 +23,10 @@ class AdvancedSettingsView extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
debugPrint("BUILD: $runtimeType");
|
||||
|
||||
final externalCalls = DB.instance
|
||||
.get<dynamic>(boxName: DB.boxNamePrefs, key: "externalCalls") ??
|
||||
true;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
|
||||
appBar: AppBar(
|
||||
|
@ -115,6 +122,52 @@ class AdvancedSettingsView extends StatelessWidget {
|
|||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
RoundedWhiteContainer(
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: RawMaterialButton(
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context)
|
||||
.pushNamed(StackPrivacyCalls.routeName, arguments: true);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 20,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
RichText(
|
||||
textAlign: TextAlign.left,
|
||||
text: TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: "Stack Experience",
|
||||
style: STextStyles.titleBold12(context),
|
||||
),
|
||||
TextSpan(
|
||||
text: externalCalls as bool
|
||||
? "\nEasy crypto"
|
||||
: "\nIncognito",
|
||||
style: STextStyles.label(context)
|
||||
.copyWith(fontSize: 15.0),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/hive/db.dart';
|
||||
import 'package:stackwallet/pages/pinpad_views/create_pin_view.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
|
||||
import 'package:stackwallet/hive/db.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
|
||||
class StackPrivacyCalls extends ConsumerStatefulWidget {
|
||||
const StackPrivacyCalls({
|
||||
Key? key,
|
||||
required this.isSettings,
|
||||
}) : super(key: key);
|
||||
|
||||
final bool isSettings;
|
||||
|
||||
static const String routeName = "/stackPrivacy";
|
||||
|
||||
@override
|
||||
|
@ -56,95 +58,108 @@ class _StackPrivacyCalls extends ConsumerState<StackPrivacyCalls> {
|
|||
controller: _pageController,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Choose your Stack experience",
|
||||
style: STextStyles.pageTitleH1(context),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"You can change it later in Settings",
|
||||
style: STextStyles.subtitle(context),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 36,
|
||||
),
|
||||
Center(
|
||||
child: CustomRadio((bool isEasy) {
|
||||
setState(() {
|
||||
this.isEasy = isEasy;
|
||||
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "externalCalls",
|
||||
value: isEasy);
|
||||
});
|
||||
}),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 36,
|
||||
),
|
||||
RoundedWhiteContainer(
|
||||
child: Center(
|
||||
child: RichText(
|
||||
textAlign: TextAlign.left,
|
||||
text: TextSpan(
|
||||
style:
|
||||
STextStyles.label(context).copyWith(fontSize: 12.0),
|
||||
children: isEasy
|
||||
? const [
|
||||
TextSpan(
|
||||
text:
|
||||
"Exchange data preloaded for a seamless experience."),
|
||||
TextSpan(
|
||||
text:
|
||||
"\n\nCoinGecko enabled: (24 hour price change shown in-app, total wallet value shown in USD or other currency)."),
|
||||
TextSpan(
|
||||
text:
|
||||
"\n\nRecommended for most crypto users.",
|
||||
style:
|
||||
TextStyle(fontWeight: FontWeight.bold)),
|
||||
]
|
||||
: const [
|
||||
TextSpan(
|
||||
text:
|
||||
"Exchange data not preloaded (slower experience)."),
|
||||
TextSpan(
|
||||
text:
|
||||
"\n\nCoinGecko disabled (price changes not shown, no wallet value shown in other currencies)."),
|
||||
TextSpan(
|
||||
text:
|
||||
"\n\nRecommended for the privacy conscious.",
|
||||
style:
|
||||
TextStyle(fontWeight: FontWeight.bold)),
|
||||
],
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 40, 0, 0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Choose your Stack experience",
|
||||
style: STextStyles.pageTitleH1(context),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"You can change it later in Settings",
|
||||
style: STextStyles.subtitle(context),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 36,
|
||||
),
|
||||
Center(
|
||||
child: CustomRadio((bool isEasy) {
|
||||
setState(() {
|
||||
this.isEasy = isEasy;
|
||||
});
|
||||
}),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 36,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: RoundedWhiteContainer(
|
||||
child: Center(
|
||||
child: RichText(
|
||||
textAlign: TextAlign.left,
|
||||
text: TextSpan(
|
||||
style: STextStyles.label(context)
|
||||
.copyWith(fontSize: 12.0),
|
||||
children: isEasy
|
||||
? [
|
||||
const TextSpan(
|
||||
text:
|
||||
"Exchange data preloaded for a seamless experience."),
|
||||
const TextSpan(
|
||||
text:
|
||||
"\n\nCoinGecko enabled: (24 hour price change shown in-app, total wallet value shown in USD or other currency)."),
|
||||
TextSpan(
|
||||
text:
|
||||
"\n\nRecommended for most crypto users.",
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textDark,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
]
|
||||
: [
|
||||
const TextSpan(
|
||||
text:
|
||||
"Exchange data not preloaded (slower experience)."),
|
||||
const TextSpan(
|
||||
text:
|
||||
"\n\nCoinGecko disabled (price changes not shown, no wallet value shown in other currencies)."),
|
||||
TextSpan(
|
||||
text:
|
||||
"\n\nRecommended for the privacy conscious.",
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textDark,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(
|
||||
flex: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 16,
|
||||
const Spacer(
|
||||
flex: 4,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ContinueButton(
|
||||
isDesktop: isDesktop,
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 16,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ContinueButton(
|
||||
isDesktop: isDesktop,
|
||||
isSettings: widget.isSettings,
|
||||
isEasy: isEasy,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -154,9 +169,16 @@ class _StackPrivacyCalls extends ConsumerState<StackPrivacyCalls> {
|
|||
}
|
||||
|
||||
class ContinueButton extends StatelessWidget {
|
||||
const ContinueButton({Key? key, required this.isDesktop}) : super(key: key);
|
||||
const ContinueButton(
|
||||
{Key? key,
|
||||
required this.isDesktop,
|
||||
required this.isSettings,
|
||||
required this.isEasy})
|
||||
: super(key: key);
|
||||
|
||||
final bool isDesktop;
|
||||
final bool isSettings;
|
||||
final bool isEasy;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -166,10 +188,20 @@ class ContinueButton extends StatelessWidget {
|
|||
.extension<StackColors>()!
|
||||
.getPrimaryEnabledButtonColor(context),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pushNamed(CreatePinView.routeName);
|
||||
print("Output of isEasy:");
|
||||
print(isEasy);
|
||||
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "externalCalls",
|
||||
value: isEasy,
|
||||
);
|
||||
if (!isSettings) {
|
||||
Navigator.of(context).pushNamed(CreatePinView.routeName);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
"Continue",
|
||||
!isSettings ? "Continue" : "Save changes",
|
||||
style: STextStyles.button(context),
|
||||
),
|
||||
)
|
||||
|
@ -181,10 +213,21 @@ class ContinueButton extends StatelessWidget {
|
|||
.extension<StackColors>()!
|
||||
.getPrimaryEnabledButtonColor(context),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pushNamed(StackPrivacyCalls.routeName);
|
||||
print("Output of isEasy:");
|
||||
print(isEasy);
|
||||
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "externalCalls",
|
||||
value: isEasy,
|
||||
);
|
||||
|
||||
if (!isSettings) {
|
||||
Navigator.of(context).pushNamed(StackPrivacyCalls.routeName);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
"Continue",
|
||||
!isSettings ? "Continue" : "Save changes",
|
||||
style: STextStyles.button(context).copyWith(fontSize: 20),
|
||||
),
|
||||
),
|
||||
|
@ -268,8 +311,8 @@ class RadioItem extends StatelessWidget {
|
|||
SvgPicture.asset(
|
||||
_item.svg,
|
||||
// color: Theme.of(context).extension<StackColors>()!.textWhite,
|
||||
width: 96,
|
||||
height: 96,
|
||||
width: 140,
|
||||
height: 140,
|
||||
),
|
||||
RichText(
|
||||
textAlign: TextAlign.center,
|
||||
|
@ -278,7 +321,11 @@ class RadioItem extends StatelessWidget {
|
|||
children: [
|
||||
TextSpan(
|
||||
text: _item.topText,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textDark,
|
||||
fontWeight: FontWeight.bold)),
|
||||
TextSpan(text: "\n${_item.bottomText}"),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -136,9 +136,16 @@ class RouteGenerator {
|
|||
settings: RouteSettings(name: settings.name));
|
||||
|
||||
case StackPrivacyCalls.routeName:
|
||||
if (args is bool) {
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => StackPrivacyCalls(isSettings: args),
|
||||
settings: RouteSettings(name: settings.name),
|
||||
);
|
||||
}
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => const StackPrivacyCalls(),
|
||||
builder: (_) => StackPrivacyCalls(isSettings: false),
|
||||
settings: RouteSettings(name: settings.name));
|
||||
|
||||
case WalletsView.routeName:
|
||||
|
|
Loading…
Reference in a new issue