Anon Key UI

+ Kein Essen heute Meldung, wenn kein Essen an dem Tag verfügbar ist
This commit is contained in:
Jonas Braus
2025-03-08 16:26:34 +01:00
parent 5cc64cedc8
commit 0ca6d62dd1
132 changed files with 19344 additions and 58 deletions
+29 -8
View File
@@ -84,6 +84,8 @@ class SpaceRate extends StatelessWidget {
void change_backend_ip(BuildContext context) {
final TextEditingController _ipController = TextEditingController();
String anonkeyInput = "";
showDialog(
context: context,
builder: (BuildContext context) {
@@ -91,12 +93,28 @@ class SpaceRate extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
title: Text("Backend-IP ändern"),
content: TextField(
controller: _ipController, // IP-Format unterstützen
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Neue Backend-IP (z. B. 192.168.1.1)',
title: Text("Backend-Domain ändern"),
content: Container(
height: 200,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 20,
children: [
TextField(
controller: _ipController, // IP-Format unterstützen
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Neue Backend-Domain (z. B. 192.168.1.1)',
),
),
TextField(
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Neuer Anon Key',
),
onChanged: (inputText) => anonkeyInput = inputText,
)
],
),
),
actions: [
@@ -104,17 +122,20 @@ class SpaceRate extends StatelessWidget {
onPressed: () async {
final newIp = _ipController.text;
if (newIp.isEmpty) {
if (newIp.isEmpty || anonkeyInput.isEmpty) {
// Falls das Feld leer ist, gib eine Warnung aus
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text("Die IP-Adresse darf nicht leer sein!")),
content: Text("Bitte Domain & Anon angeben!")),
);
return;
}
// Speichere die neue IP in den Shared Preferences
final prefs = await SharedPreferences.getInstance();
await prefs.setString('supabase-ip', newIp);
await prefs.setString("anon-key", anonkeyInput);
print(anonkeyInput);
// Hole die neue IP und initialisiere die Supabase-Verbindung neu