mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
WIP: tor enabled dialog on buy view
This commit is contained in:
parent
6fe0bfef81
commit
3fa0997754
2 changed files with 170 additions and 65 deletions
|
@ -9,27 +9,56 @@
|
|||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/models/isar/models/ethereum/eth_contract.dart';
|
||||
import 'package:stackwallet/pages/buy_view/buy_form.dart';
|
||||
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
|
||||
class BuyView extends StatelessWidget {
|
||||
class BuyView extends ConsumerStatefulWidget {
|
||||
const BuyView({
|
||||
Key? key,
|
||||
this.coin,
|
||||
this.tokenContract,
|
||||
}) : super(key: key);
|
||||
|
||||
static const String routeName = "/stackBuyView";
|
||||
|
||||
final Coin? coin;
|
||||
final EthContract? tokenContract;
|
||||
|
||||
static const String routeName = "/stackBuyView";
|
||||
|
||||
@override
|
||||
ConsumerState<BuyView> createState() => _BuyViewState();
|
||||
}
|
||||
|
||||
class _BuyViewState extends ConsumerState<BuyView> {
|
||||
Coin? coin;
|
||||
EthContract? tokenContract;
|
||||
late bool torEnabled = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
coin = widget.coin;
|
||||
tokenContract = widget.tokenContract;
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
setState(() {
|
||||
torEnabled = ref.read(prefsChangeNotifierProvider).useTor;
|
||||
});
|
||||
});
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
debugPrint("BUILD: $runtimeType");
|
||||
|
||||
return SafeArea(
|
||||
return Stack(
|
||||
children: [
|
||||
SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 16,
|
||||
|
@ -41,6 +70,21 @@ class BuyView extends StatelessWidget {
|
|||
tokenContract: tokenContract,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (torEnabled)
|
||||
Container(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.overlay
|
||||
.withOpacity(0.7),
|
||||
height: MediaQuery.of(context).size.height,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: const StackDialog(
|
||||
title: "Tor is enabled",
|
||||
message: "Purchasing not available while Tor is enabled",
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,25 +9,43 @@
|
|||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/pages/buy_view/buy_form.dart';
|
||||
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
|
||||
class DesktopBuyView extends StatefulWidget {
|
||||
class DesktopBuyView extends ConsumerStatefulWidget {
|
||||
const DesktopBuyView({Key? key}) : super(key: key);
|
||||
|
||||
static const String routeName = "/desktopBuyView";
|
||||
|
||||
@override
|
||||
State<DesktopBuyView> createState() => _DesktopBuyViewState();
|
||||
ConsumerState<DesktopBuyView> createState() => _DesktopBuyViewState();
|
||||
}
|
||||
|
||||
class _DesktopBuyViewState extends ConsumerState<DesktopBuyView> {
|
||||
late bool torEnabled = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
setState(() {
|
||||
torEnabled = ref.read(prefsChangeNotifierProvider).useTor;
|
||||
});
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
class _DesktopBuyViewState extends State<DesktopBuyView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DesktopScaffold(
|
||||
return Stack(
|
||||
children: [
|
||||
DesktopScaffold(
|
||||
appBar: DesktopAppBar(
|
||||
isCompactHeight: true,
|
||||
leading: Padding(
|
||||
|
@ -79,6 +97,49 @@ class _DesktopBuyViewState extends State<DesktopBuyView> {
|
|||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (torEnabled)
|
||||
Container(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.overlay
|
||||
.withOpacity(0.7),
|
||||
height: MediaQuery.of(context).size.height,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: DesktopDialog(
|
||||
maxHeight: 200,
|
||||
maxWidth: 350,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(
|
||||
15.0,
|
||||
),
|
||||
child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Tor is enabled",
|
||||
textAlign: TextAlign.center,
|
||||
style: STextStyles.pageTitleH1(context),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Text(
|
||||
"Purchasing not available while Tor is enabled",
|
||||
textAlign: TextAlign.center,
|
||||
style: STextStyles.desktopTextMedium(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.infoItemLabel,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue