add solana enabled pref

toggled in dev menu
This commit is contained in:
sneurlax 2024-03-21 12:46:59 -05:00
parent 68210b2765
commit 4e732a5253
2 changed files with 53 additions and 0 deletions

View file

@ -10,6 +10,7 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
@ -276,6 +277,36 @@ class HiddenSettings extends StatelessWidget {
const SizedBox(
height: 12,
),
Consumer(
builder: (_, ref, __) {
return GestureDetector(
onTap: () async {
ref
.read(prefsChangeNotifierProvider)
.solanaEnabled =
!(ref
.read(prefsChangeNotifierProvider)
.solanaEnabled);
if (kDebugMode) {
print(
"Solana enabled: ${ref.read(prefsChangeNotifierProvider).solanaEnabled}");
}
},
child: RoundedWhiteContainer(
child: Text(
"Toggle Solana",
style: STextStyles.button(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark),
),
),
);
},
),
const SizedBox(
height: 12,
),
Consumer(
builder: (_, ref, __) {
return GestureDetector(

View file

@ -68,6 +68,7 @@ class Prefs extends ChangeNotifier {
await _setMaxDecimals();
_useTor = await _getUseTor();
_fusionServerInfo = await _getFusionServerInfo();
_solanaEnabled = await _getSolanaEnabled();
_frostEnabled = await _getFrostEnabled();
_initialized = true;
@ -1010,6 +1011,27 @@ class Prefs extends ChangeNotifier {
return actualMap;
}
// Solana
bool _solanaEnabled = false;
bool get solanaEnabled => _solanaEnabled;
set solanaEnabled(bool solanaEnabled) {
if (_solanaEnabled != solanaEnabled) {
DB.instance.put<dynamic>(
boxName: DB.boxNamePrefs, key: "solanaEnabled", value: solanaEnabled);
_solanaEnabled = solanaEnabled;
notifyListeners();
}
}
Future<bool> _getSolanaEnabled() async {
return await DB.instance.get<dynamic>(
boxName: DB.boxNamePrefs, key: "solanaEnabled") as bool? ??
false;
}
// FROST multisig
bool _frostEnabled = false;