mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 01:37:54 +00:00
delete account ui for ios
This commit is contained in:
parent
3715ec45a7
commit
8e727ff999
4 changed files with 108 additions and 0 deletions
|
@ -12,6 +12,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
|
||||
|
|
|
@ -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';
|
||||
|
@ -97,6 +99,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,
|
||||
|
|
Loading…
Reference in a new issue