This commit is contained in:
Julian 2024-07-22 15:58:07 -06:00 committed by julian-CStack
parent 2d06a23c97
commit 3b38dd6464

View file

@ -105,192 +105,199 @@ class _StackPrivacyCalls extends ConsumerState<StackPrivacyCalls> {
constraints: BoxConstraints( constraints: BoxConstraints(
maxWidth: isDesktop ? 480 : double.infinity, maxWidth: isDesktop ? 480 : double.infinity,
), ),
child: Column( child: ConditionalParent(
mainAxisAlignment: MainAxisAlignment.center, condition: isDesktop,
children: [ builder: (child) => SingleChildScrollView(
Text( child: child,
"Choose your ${AppConfig.prefix} experience", ),
style: isDesktop child: Column(
? STextStyles.desktopH2(context) mainAxisAlignment: MainAxisAlignment.center,
: STextStyles.pageTitleH1(context), children: [
), Text(
SizedBox( "Choose your ${AppConfig.prefix} experience",
height: isDesktop ? 16 : 8, textAlign: TextAlign.center,
), style: isDesktop
Text( ? STextStyles.desktopH2(context)
!widget.isSettings : STextStyles.pageTitleH1(context),
? "You can change it later in Settings"
: "",
style: isDesktop
? STextStyles.desktopSubtitleH2(context)
: STextStyles.subtitle(context),
),
SizedBox(
height: isDesktop ? 32 : 36,
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: isDesktop ? 0 : 16,
), ),
child: PrivacyToggle( SizedBox(
externalCallsEnabled: isEasy, height: isDesktop ? 16 : 8,
onChanged: (externalCalls) {
isEasy = externalCalls;
setState(() {
infoToggle = isEasy;
});
},
), ),
), Text(
SizedBox( !widget.isSettings
height: isDesktop ? 16 : 36, ? "You can change it later in Settings"
), : "",
Padding( style: isDesktop
padding: isDesktop ? STextStyles.desktopSubtitleH2(context)
? const EdgeInsets.all(0) : STextStyles.subtitle(context),
: const EdgeInsets.all(16.0), ),
child: RoundedWhiteContainer( SizedBox(
child: Center( height: isDesktop ? 32 : 36,
child: RichText( ),
textAlign: TextAlign.left, Padding(
text: TextSpan( padding: EdgeInsets.symmetric(
style: isDesktop horizontal: isDesktop ? 0 : 16,
? STextStyles.desktopTextExtraExtraSmall( ),
context, child: PrivacyToggle(
) externalCallsEnabled: isEasy,
: STextStyles.label(context).copyWith( onChanged: (externalCalls) {
fontSize: 12.0, isEasy = externalCalls;
), setState(() {
children: infoToggle infoToggle = isEasy;
? [ });
if (Constants.enableExchange) },
),
),
SizedBox(
height: isDesktop ? 16 : 36,
),
Padding(
padding: isDesktop
? const EdgeInsets.all(0)
: const EdgeInsets.all(16.0),
child: RoundedWhiteContainer(
child: Center(
child: RichText(
textAlign: TextAlign.left,
text: TextSpan(
style: isDesktop
? STextStyles.desktopTextExtraExtraSmall(
context,
)
: STextStyles.label(context).copyWith(
fontSize: 12.0,
),
children: infoToggle
? [
if (Constants.enableExchange)
const TextSpan(
text:
"Exchange data preloaded for a seamless experience.\n\n",
),
const TextSpan( const TextSpan(
text: text:
"Exchange data preloaded for a seamless experience.\n\n", "CoinGecko enabled: (24 hour price change shown in-app, total wallet value shown in USD or other currency).\n\n",
), ),
const TextSpan( TextSpan(
text: text:
"CoinGecko enabled: (24 hour price change shown in-app, total wallet value shown in USD or other currency).\n\n", "Recommended for most crypto users.",
), style: isDesktop
TextSpan( ? STextStyles
text: .desktopTextExtraExtraSmall600(
"Recommended for most crypto users.", context,
style: isDesktop )
? STextStyles : TextStyle(
.desktopTextExtraExtraSmall600( color: Theme.of(context)
context, .extension<StackColors>()!
) .textDark,
: TextStyle( fontWeight: FontWeight.w600,
color: Theme.of(context) ),
.extension<StackColors>()! ),
.textDark, ]
fontWeight: FontWeight.w600, : [
), if (Constants.enableExchange)
), const TextSpan(
] text:
: [ "Exchange data not preloaded (slower experience).\n\n",
if (Constants.enableExchange) ),
const TextSpan( const TextSpan(
text: text:
"Exchange data not preloaded (slower experience).\n\n", "CoinGecko disabled (price changes not shown, no wallet value shown in other currencies).\n\n",
), ),
const TextSpan( TextSpan(
text: text:
"CoinGecko disabled (price changes not shown, no wallet value shown in other currencies).\n\n", "Recommended for the privacy conscious.",
), style: isDesktop
TextSpan( ? STextStyles
text: .desktopTextExtraExtraSmall600(
"Recommended for the privacy conscious.", context,
style: isDesktop )
? STextStyles : TextStyle(
.desktopTextExtraExtraSmall600( color: Theme.of(context)
context, .extension<StackColors>()!
) .textDark,
: TextStyle( fontWeight: FontWeight.w600,
color: Theme.of(context) ),
.extension<StackColors>()! ),
.textDark, ],
fontWeight: FontWeight.w600, ),
),
),
],
), ),
), ),
), ),
), ),
), if (!isDesktop)
if (!isDesktop) const Spacer(
const Spacer( flex: 4,
flex: 4, ),
), if (isDesktop)
if (isDesktop) const SizedBox(
const SizedBox( height: 32,
height: 32, ),
), Padding(
Padding( padding: isDesktop
padding: isDesktop ? const EdgeInsets.all(0)
? const EdgeInsets.all(0) : const EdgeInsets.symmetric(
: const EdgeInsets.symmetric( horizontal: 16,
horizontal: 16, vertical: 16,
vertical: 16, ),
), child: Row(
child: Row( children: [
children: [ Expanded(
Expanded( child: PrimaryButton(
child: PrimaryButton( label: !widget.isSettings
label: !widget.isSettings ? "Continue"
? "Continue" : "Save changes",
: "Save changes", onPressed: () {
onPressed: () { ref
ref .read(prefsChangeNotifierProvider)
.read(prefsChangeNotifierProvider) .externalCalls = isEasy;
.externalCalls = isEasy;
DB.instance DB.instance
.put<dynamic>( .put<dynamic>(
boxName: DB.boxNamePrefs, boxName: DB.boxNamePrefs,
key: "externalCalls", key: "externalCalls",
value: isEasy, value: isEasy,
) )
.then((_) { .then((_) {
if (isEasy) { if (isEasy) {
if (AppConfig.hasFeature(AppFeature.swap)) { if (AppConfig.hasFeature(AppFeature.swap)) {
unawaited( unawaited(
ExchangeDataLoadingService.instance ExchangeDataLoadingService.instance
.loadAll(), .loadAll(),
);
}
// unawaited(
// BuyDataLoadingService().loadAll(ref));
ref
.read(priceAnd24hChangeNotifierProvider)
.start(true);
}
});
if (!widget.isSettings) {
if (isDesktop) {
Navigator.of(context).pushNamed(
CreatePasswordView.routeName,
);
} else {
Navigator.of(context).pushNamed(
CreatePinView.routeName,
); );
} }
// unawaited(
// BuyDataLoadingService().loadAll(ref));
ref
.read(priceAnd24hChangeNotifierProvider)
.start(true);
}
});
if (!widget.isSettings) {
if (isDesktop) {
Navigator.of(context).pushNamed(
CreatePasswordView.routeName,
);
} else { } else {
Navigator.of(context).pushNamed( Navigator.pop(context);
CreatePinView.routeName,
);
} }
} else { },
Navigator.pop(context); ),
}
},
), ),
), ],
], ),
), ),
), if (isDesktop)
if (isDesktop) const SizedBox(
const SizedBox( height: kDesktopAppBarHeight,
height: kDesktopAppBarHeight, ),
), ],
], ),
), ),
), ),
), ),