desktop tor one time dialog added and hidden dev settings enabled for desktop

This commit is contained in:
julian 2023-09-20 14:52:27 -06:00
parent 157901e33d
commit 7155646f57
3 changed files with 92 additions and 13 deletions

View file

@ -12,15 +12,19 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';
import 'package:stackwallet/db/hive/db.dart'; import 'package:stackwallet/db/hive/db.dart';
import 'package:stackwallet/notifications/show_flush_bar.dart'; import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/providers/global/debug_service_provider.dart'; import 'package:stackwallet/providers/global/debug_service_provider.dart';
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/background.dart'; import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/onetime_popups/tor_has_been_add_dialog.dart'; import 'package:stackwallet/widgets/onetime_popups/tor_has_been_add_dialog.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart';
@ -35,7 +39,27 @@ class HiddenSettings extends StatelessWidget {
child: Scaffold( child: Scaffold(
backgroundColor: Theme.of(context).extension<StackColors>()!.background, backgroundColor: Theme.of(context).extension<StackColors>()!.background,
appBar: AppBar( appBar: AppBar(
leading: Container(), leading: Util.isDesktop
? Padding(
padding: const EdgeInsets.all(8.0),
child: AppBarIconButton(
size: 32,
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
shadows: const [],
icon: SvgPicture.asset(
Assets.svg.arrowLeft,
width: 18,
height: 18,
color: Theme.of(context)
.extension<StackColors>()!
.topNavIconPrimary,
),
onPressed: Navigator.of(context).pop,
),
)
: Container(),
title: Text( title: Text(
"Dev options", "Dev options",
style: STextStyles.navBarTitle(context), style: STextStyles.navBarTitle(context),

View file

@ -13,11 +13,13 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/hidden_settings.dart';
import 'package:stackwallet/pages/wallets_view/sub_widgets/empty_wallets.dart'; import 'package:stackwallet/pages/wallets_view/sub_widgets/empty_wallets.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/my_wallets.dart'; import 'package:stackwallet/pages_desktop_specific/my_stack_view/my_wallets.dart';
import 'package:stackwallet/providers/global/wallets_provider.dart'; import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/themes/theme_providers.dart'; import 'package:stackwallet/themes/theme_providers.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/widgets/animated_widgets/rotate_icon.dart';
import 'package:stackwallet/widgets/background.dart'; import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart'; import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
@ -52,17 +54,62 @@ class _MyStackViewState extends ConsumerState<MyStackView> {
} }
} }
class DesktopMyStackTitle extends ConsumerWidget { class DesktopMyStackTitle extends ConsumerStatefulWidget {
const DesktopMyStackTitle({Key? key}) : super(key: key); const DesktopMyStackTitle({super.key});
@override @override
Widget build(BuildContext context, WidgetRef ref) { ConsumerState<DesktopMyStackTitle> createState() =>
_DesktopMyStackTitleState();
}
class _DesktopMyStackTitleState extends ConsumerState<DesktopMyStackTitle> {
late final RotateIconController _rotateIconController;
DateTime _hiddenTime = DateTime.now();
int _hiddenCount = 0;
void _hiddenOptions() {
_rotateIconController.reset?.call();
_rotateIconController.forward?.call();
if (_hiddenCount == 5) {
Navigator.of(context).pushNamed(HiddenSettings.routeName);
}
final now = DateTime.now();
const timeout = Duration(seconds: 1);
if (now.difference(_hiddenTime) < timeout) {
_hiddenCount++;
} else {
_hiddenCount = 0;
}
_hiddenTime = now;
}
@override
void initState() {
_rotateIconController = RotateIconController();
super.initState();
}
@override
dispose() {
_rotateIconController.forward = null;
_rotateIconController.reverse = null;
_rotateIconController.reset = null;
super.dispose();
}
@override
Widget build(BuildContext context) {
return Row( return Row(
children: [ children: [
const SizedBox( const SizedBox(
width: 24, width: 24,
), ),
SizedBox( GestureDetector(
onTap: _hiddenOptions,
child: RotateIcon(
icon: SizedBox(
width: 32, width: 32,
height: 32, height: 32,
child: SvgPicture.file( child: SvgPicture.file(
@ -75,6 +122,11 @@ class DesktopMyStackTitle extends ConsumerWidget {
), ),
), ),
), ),
curve: Curves.easeInOutCubic,
rotationPercent: 1.0,
controller: _rotateIconController,
),
),
const SizedBox( const SizedBox(
width: 12, width: 12,
), ),

View file

@ -75,7 +75,10 @@ class _TorHasBeenAddedDialogState extends State<_TorHasBeenAddedDialog> {
), ),
), ),
DesktopDialogCloseButton( DesktopDialogCloseButton(
onPressedOverride: setDoNotShowAgain, onPressedOverride: () {
setDoNotShowAgain();
Navigator.of(context).pop();
},
), ),
], ],
), ),