mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 18:44:31 +00:00
Merge branch 'ui-fixes' into privacyoptions
# Conflicts: # lib/pages/stack_privacy_calls.dart
This commit is contained in:
commit
ec4097e274
6 changed files with 374 additions and 96 deletions
|
@ -14,6 +14,8 @@ import 'package:url_launcher/url_launcher.dart';
|
|||
class IntroView extends StatefulWidget {
|
||||
const IntroView({Key? key}) : super(key: key);
|
||||
|
||||
static const String routeName = "/introView";
|
||||
|
||||
@override
|
||||
State<IntroView> createState() => _IntroViewState();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:stackwallet/pages/intro_view.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
|
||||
class DeleteAccountView extends StatefulWidget {
|
||||
const DeleteAccountView({Key? key}) : super(key: key);
|
||||
|
||||
static const String routeName = "/deleteAccountView";
|
||||
|
||||
@override
|
||||
State<DeleteAccountView> createState() => _DeleteAccountViewState();
|
||||
}
|
||||
|
||||
class _DeleteAccountViewState extends State<DeleteAccountView> {
|
||||
final isDesktop = Util.isDesktop;
|
||||
|
||||
Future<void> onConfirmDeleteAccount() async {
|
||||
// TODO delete everything then pop to intro view
|
||||
await Navigator.of(context).pushNamedAndRemoveUntil(
|
||||
IntroView.routeName,
|
||||
(route) => false,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MasterScaffold(
|
||||
isDesktop: isDesktop,
|
||||
appBar: isDesktop
|
||||
? DesktopAppBar(isCompactHeight: true)
|
||||
: AppBar(
|
||||
leading: AppBarBackButton(
|
||||
onPressed: () async {
|
||||
if (FocusScope.of(context).hasFocus) {
|
||||
FocusScope.of(context).unfocus();
|
||||
await Future<void>.delayed(
|
||||
const Duration(milliseconds: 75));
|
||||
}
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
"Delete account",
|
||||
style: STextStyles.navBarTitle(context),
|
||||
),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(14),
|
||||
child: Column(
|
||||
children: [
|
||||
RoundedWhiteContainer(
|
||||
child: Text(
|
||||
"There is no account to delete, but Apple requires that we have a way to 'delete accounts' in the app and will reject our app updates if we don't, so here it is. Clicking this will delete all app data (not from our servers, because we never had it in the first place).\n\nWhen you click confirm, all app data will be deleted, including wallets and preferences, and you will be taken back to the very first onboarding screen. BE SURE TO BACKUP ALL SEEDS!!\n\nAre you sure you want to delete your \"account\"?",
|
||||
style: STextStyles.smallMed12(context),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
PrimaryButton(
|
||||
label: "Confirm",
|
||||
onPressed: onConfirmDeleteAccount,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stackwallet/pages/address_book_views/address_book_view.dart';
|
||||
import 'package:stackwallet/pages/pinpad_views/lock_screen_view.dart';
|
||||
|
@ -5,6 +7,7 @@ import 'package:stackwallet/pages/settings_views/global_settings_view/about_view
|
|||
import 'package:stackwallet/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/appearance_settings_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/currency_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/delete_account_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/language_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/manage_nodes_views/manage_nodes_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/security_views/security_view.dart';
|
||||
|
@ -224,6 +227,20 @@ class GlobalSettingsView extends StatelessWidget {
|
|||
.pushNamed(SupportView.routeName);
|
||||
},
|
||||
),
|
||||
if (Platform.isIOS)
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
if (Platform.isIOS)
|
||||
SettingsListButton(
|
||||
iconAssetName: Assets.svg.circleAlert,
|
||||
iconSize: 16,
|
||||
title: "Delete account",
|
||||
onPressed: () async {
|
||||
await Navigator.of(context)
|
||||
.pushNamed(DeleteAccountView.routeName);
|
||||
},
|
||||
),
|
||||
// TextButton(
|
||||
// style: Theme.of(context)
|
||||
// .textButtonTheme
|
||||
|
|
|
@ -4,12 +4,19 @@ 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/providers/global/prefs_provider.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.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,
|
||||
|
@ -58,9 +65,7 @@ class _StackPrivacyCalls extends ConsumerState<StackPrivacyCalls> {
|
|||
controller: _pageController,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 40, 0, 0),
|
||||
child: Column(
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
|
@ -81,63 +86,55 @@ class _StackPrivacyCalls extends ConsumerState<StackPrivacyCalls> {
|
|||
child: CustomRadio((bool isEasy) {
|
||||
setState(() {
|
||||
this.isEasy = isEasy;
|
||||
|
||||
DB.instance.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "externalCalls",
|
||||
value: isEasy);
|
||||
});
|
||||
}),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 36,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: RoundedWhiteContainer(
|
||||
RoundedWhiteContainer(
|
||||
child: Center(
|
||||
child: RichText(
|
||||
textAlign: TextAlign.left,
|
||||
text: TextSpan(
|
||||
style: STextStyles.label(context)
|
||||
.copyWith(fontSize: 12.0),
|
||||
style:
|
||||
STextStyles.label(context).copyWith(fontSize: 12.0),
|
||||
children: isEasy
|
||||
? [
|
||||
const TextSpan(
|
||||
? const [
|
||||
TextSpan(
|
||||
text:
|
||||
"Exchange data preloaded for a seamless experience."),
|
||||
const TextSpan(
|
||||
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,
|
||||
),
|
||||
),
|
||||
style:
|
||||
TextStyle(fontWeight: FontWeight.bold)),
|
||||
]
|
||||
: [
|
||||
const TextSpan(
|
||||
: const [
|
||||
TextSpan(
|
||||
text:
|
||||
"Exchange data not preloaded (slower experience)."),
|
||||
const TextSpan(
|
||||
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,
|
||||
),
|
||||
),
|
||||
style:
|
||||
TextStyle(fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(
|
||||
flex: 4,
|
||||
),
|
||||
|
@ -151,8 +148,6 @@ class _StackPrivacyCalls extends ConsumerState<StackPrivacyCalls> {
|
|||
Expanded(
|
||||
child: ContinueButton(
|
||||
isDesktop: isDesktop,
|
||||
isSettings: widget.isSettings,
|
||||
isEasy: isEasy,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -160,10 +155,160 @@ class _StackPrivacyCalls extends ConsumerState<StackPrivacyCalls> {
|
|||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class PrivacyToggle extends ConsumerStatefulWidget {
|
||||
const PrivacyToggle({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
ConsumerState<PrivacyToggle> createState() => _PrivacyToggleState();
|
||||
}
|
||||
|
||||
class _PrivacyToggleState extends ConsumerState<PrivacyToggle> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: RawMaterialButton(
|
||||
fillColor: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius * 2,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
ref.read(prefsChangeNotifierProvider).externalCalls = true;
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(
|
||||
12,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
Assets.svg.personaEasy,
|
||||
// color: Theme.of(context).extension<StackColors>()!.textWhite,
|
||||
width: 96,
|
||||
height: 96,
|
||||
),
|
||||
const Text(
|
||||
"Easy Crypto",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const Text(
|
||||
"Recommended",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 16,
|
||||
),
|
||||
Expanded(
|
||||
child: RawMaterialButton(
|
||||
elevation: 0,
|
||||
fillColor: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: ref.watch(
|
||||
prefsChangeNotifierProvider.select(
|
||||
(value) => value.externalCalls,
|
||||
),
|
||||
)
|
||||
? BorderSide.none
|
||||
: BorderSide(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.infoItemIcons,
|
||||
width: 2,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius * 2,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
ref.read(prefsChangeNotifierProvider).externalCalls = false;
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(
|
||||
12,
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
Assets.svg.personaIncognito,
|
||||
width: 96,
|
||||
height: 96,
|
||||
),
|
||||
const Center(
|
||||
child: Text(
|
||||
"Incognito",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Center(
|
||||
child: Text(
|
||||
"Privacy conscious",
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (!ref.watch(
|
||||
prefsChangeNotifierProvider.select(
|
||||
(value) => value.externalCalls,
|
||||
),
|
||||
))
|
||||
Positioned(
|
||||
top: 4,
|
||||
right: 4,
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.checkCircle,
|
||||
width: 20,
|
||||
height: 20,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.infoItemIcons,
|
||||
),
|
||||
),
|
||||
if (ref.watch(
|
||||
prefsChangeNotifierProvider.select(
|
||||
(value) => value.externalCalls,
|
||||
),
|
||||
))
|
||||
Positioned(
|
||||
top: 4,
|
||||
right: 4,
|
||||
child: Container(
|
||||
width: 20,
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(1000),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFieldDefaultBG,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import 'package:stackwallet/pages/exchange_view/send_from_view.dart';
|
|||
import 'package:stackwallet/pages/exchange_view/trade_details_view.dart';
|
||||
import 'package:stackwallet/pages/exchange_view/wallet_initiated_exchange_view.dart';
|
||||
import 'package:stackwallet/pages/home_view/home_view.dart';
|
||||
import 'package:stackwallet/pages/intro_view.dart';
|
||||
import 'package:stackwallet/pages/manage_favorites_view/manage_favorites_view.dart';
|
||||
import 'package:stackwallet/pages/notification_views/notifications_view.dart';
|
||||
import 'package:stackwallet/pages/pinpad_views/create_pin_view.dart';
|
||||
|
@ -43,6 +44,7 @@ import 'package:stackwallet/pages/settings_views/global_settings_view/advanced_v
|
|||
import 'package:stackwallet/pages/settings_views/global_settings_view/advanced_views/debug_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/appearance_settings_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/currency_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/delete_account_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/global_settings_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/hidden_settings.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/language_view.dart';
|
||||
|
@ -98,6 +100,18 @@ class RouteGenerator {
|
|||
final args = settings.arguments;
|
||||
|
||||
switch (settings.name) {
|
||||
case IntroView.routeName:
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => const IntroView(),
|
||||
settings: RouteSettings(name: settings.name));
|
||||
|
||||
case DeleteAccountView.routeName:
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => const DeleteAccountView(),
|
||||
settings: RouteSettings(name: settings.name));
|
||||
|
||||
case HomeView.routeName:
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
|
|
|
@ -36,6 +36,7 @@ class Prefs extends ChangeNotifier {
|
|||
_hideBlockExplorerWarning = await _getHideBlockExplorerWarning();
|
||||
_gotoWalletOnStartup = await _getGotoWalletOnStartup();
|
||||
_startupWalletId = await _getStartupWalletId();
|
||||
_externalCalls = await _getHasExternalCalls();
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
|
@ -544,4 +545,28 @@ class Prefs extends ChangeNotifier {
|
|||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "startupWalletId") as String?;
|
||||
}
|
||||
|
||||
bool _externalCalls = false;
|
||||
|
||||
bool get externalCalls => _externalCalls;
|
||||
|
||||
set externalCalls(bool externalCalls) {
|
||||
if (_externalCalls != externalCalls) {
|
||||
DB.instance
|
||||
.put<dynamic>(
|
||||
boxName: DB.boxNamePrefs,
|
||||
key: "externalCalls",
|
||||
value: externalCalls)
|
||||
.then((_) {
|
||||
_externalCalls = externalCalls;
|
||||
notifyListeners();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> _getHasExternalCalls() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "externalCalls") as bool? ??
|
||||
false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue