mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
Merge remote-tracking branch 'origin/arti' into fusion
This commit is contained in:
commit
2ee4b7ff2d
2 changed files with 131 additions and 121 deletions
|
@ -12,10 +12,12 @@ 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/services/event_bus/events/global/tor_connection_status_changed_event.dart';
|
||||
import 'package:stackwallet/services/tor_service.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
import 'package:stackwallet/widgets/tor_subscription.dart';
|
||||
|
||||
class BuyView extends ConsumerStatefulWidget {
|
||||
const BuyView({
|
||||
|
@ -43,11 +45,7 @@ class _BuyViewState extends ConsumerState<BuyView> {
|
|||
coin = widget.coin;
|
||||
tokenContract = widget.tokenContract;
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
setState(() {
|
||||
torEnabled = ref.read(prefsChangeNotifierProvider).useTor;
|
||||
});
|
||||
});
|
||||
torEnabled = ref.read(pTorService).enabled;
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
@ -56,35 +54,42 @@ class _BuyViewState extends ConsumerState<BuyView> {
|
|||
Widget build(BuildContext context) {
|
||||
debugPrint("BUILD: $runtimeType");
|
||||
|
||||
return Stack(
|
||||
children: [
|
||||
SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 16,
|
||||
right: 16,
|
||||
top: 16,
|
||||
),
|
||||
child: BuyForm(
|
||||
coin: coin,
|
||||
tokenContract: tokenContract,
|
||||
return TorSubscription(
|
||||
onTorStatusChanged: (status) {
|
||||
setState(() {
|
||||
torEnabled = status != TorConnectionStatus.disconnected;
|
||||
});
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 16,
|
||||
right: 16,
|
||||
top: 16,
|
||||
),
|
||||
child: BuyForm(
|
||||
coin: coin,
|
||||
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",
|
||||
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",
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,13 +11,15 @@
|
|||
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/services/event_bus/events/global/tor_connection_status_changed_event.dart';
|
||||
import 'package:stackwallet/services/tor_service.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';
|
||||
import 'package:stackwallet/widgets/tor_subscription.dart';
|
||||
|
||||
class DesktopBuyView extends ConsumerStatefulWidget {
|
||||
const DesktopBuyView({Key? key}) : super(key: key);
|
||||
|
@ -33,113 +35,116 @@ class _DesktopBuyViewState extends ConsumerState<DesktopBuyView> {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
setState(() {
|
||||
torEnabled = ref.read(prefsChangeNotifierProvider).useTor;
|
||||
});
|
||||
});
|
||||
torEnabled = ref.read(pTorService).enabled;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
DesktopScaffold(
|
||||
appBar: DesktopAppBar(
|
||||
isCompactHeight: true,
|
||||
leading: Padding(
|
||||
return TorSubscription(
|
||||
onTorStatusChanged: (status) {
|
||||
setState(() {
|
||||
torEnabled = status != TorConnectionStatus.disconnected;
|
||||
});
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
DesktopScaffold(
|
||||
appBar: DesktopAppBar(
|
||||
isCompactHeight: true,
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 24,
|
||||
),
|
||||
child: Text(
|
||||
"Buy crypto",
|
||||
style: STextStyles.desktopH3(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 24,
|
||||
right: 24,
|
||||
bottom: 24,
|
||||
),
|
||||
child: Text(
|
||||
"Buy crypto",
|
||||
style: STextStyles.desktopH3(context),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: const [
|
||||
SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
RoundedWhiteContainer(
|
||||
padding: EdgeInsets.all(24),
|
||||
child: BuyForm(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 16,
|
||||
),
|
||||
// Expanded(
|
||||
// child: Row(
|
||||
// children: const [
|
||||
// Expanded(
|
||||
// child: DesktopTradeHistory(),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 24,
|
||||
right: 24,
|
||||
bottom: 24,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
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(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: const [
|
||||
SizedBox(
|
||||
height: 16,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Tor is enabled",
|
||||
textAlign: TextAlign.center,
|
||||
style: STextStyles.pageTitleH1(context),
|
||||
),
|
||||
RoundedWhiteContainer(
|
||||
padding: EdgeInsets.all(24),
|
||||
child: BuyForm(),
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 16,
|
||||
),
|
||||
// Expanded(
|
||||
// child: Row(
|
||||
// children: const [
|
||||
// Expanded(
|
||||
// child: DesktopTradeHistory(),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
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