mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
added stack_privacy_calls to advanced settings
This commit is contained in:
parent
1ce5740c24
commit
8625e6f75a
4 changed files with 104 additions and 16 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);
|
||||
|
||||
|
@ -246,7 +244,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",
|
||||
|
@ -261,7 +260,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),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -13,8 +13,11 @@ import 'package:stackwallet/widgets/rounded_white_container.dart';
|
|||
class StackPrivacyCalls extends ConsumerStatefulWidget {
|
||||
const StackPrivacyCalls({
|
||||
Key? key,
|
||||
required this.isSettings,
|
||||
}) : super(key: key);
|
||||
|
||||
final bool isSettings;
|
||||
|
||||
static const String routeName = "/stackPrivacy";
|
||||
|
||||
@override
|
||||
|
@ -78,11 +81,6 @@ class _StackPrivacyCalls extends ConsumerState<StackPrivacyCalls> {
|
|||
child: CustomRadio((bool isEasy) {
|
||||
setState(() {
|
||||
this.isEasy = isEasy;
|
||||
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "externalCalls",
|
||||
value: isEasy);
|
||||
});
|
||||
}),
|
||||
),
|
||||
|
@ -153,6 +151,8 @@ class _StackPrivacyCalls extends ConsumerState<StackPrivacyCalls> {
|
|||
Expanded(
|
||||
child: ContinueButton(
|
||||
isDesktop: isDesktop,
|
||||
isSettings: widget.isSettings,
|
||||
isEasy: isEasy,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -169,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) {
|
||||
|
@ -181,10 +188,20 @@ class ContinueButton extends StatelessWidget {
|
|||
.extension<StackColors>()!
|
||||
.getPrimaryEnabledButtonColor(context),
|
||||
onPressed: () {
|
||||
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),
|
||||
),
|
||||
)
|
||||
|
@ -196,10 +213,21 @@ class ContinueButton extends StatelessWidget {
|
|||
.extension<StackColors>()!
|
||||
.getPrimaryEnabledButtonColor(context),
|
||||
onPressed: () {
|
||||
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),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -122,9 +122,16 @@ class RouteGenerator {
|
|||
settings: RouteSettings(name: settings.name));
|
||||
|
||||
case StackPrivacyCalls.routeName:
|
||||
if (args is bool) {
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => const StackPrivacyCalls(),
|
||||
builder: (_) => StackPrivacyCalls(isSettings: args),
|
||||
settings: RouteSettings(name: settings.name),
|
||||
);
|
||||
}
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => StackPrivacyCalls(isSettings: false),
|
||||
settings: RouteSettings(name: settings.name));
|
||||
|
||||
case WalletsView.routeName:
|
||||
|
|
Loading…
Reference in a new issue