Files
stadtbote-app/lib/popups/infos_popup.dart
T
2024-03-07 14:51:03 +01:00

62 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:stadtbote/main.dart';
import 'package:stadtbote/model/session_status.dart';
import 'package:stadtbote/tools/mqtt_core.dart';
import 'package:stadtbote/tools/util.dart';
void showInfosPopup(BuildContext context, SessionStatus? status) async {
var text = "Versionsnummer: a210\n";
text += "Verbindungsstatus: ${MqttCore.instance.connectionState == ConnectionStateEnum.connected ? "Verbunden" : "NICHT verbunden"}\n";
text += "GPS-Status: ${MyApp.currentPosition != null ? MyApp.currentPosition!.timestamp.toString() : "Unbekannt"}\n";
text += "\n";
text += "User Status:\n";
if (status != null) {
text += "cr_id: ${status.crId}\n";
text += "cust_id: ${status.custId}\n";
text += "sid: ${status.sid}\n";
text += "vht_id: ${status.vhtId}\n";
text += "server_version: ${status.serverVersion}\n";
text += "server_instance: ${status.serverInstance}\n";
} else {
text += "Keine Informationen gefunden";
}
await showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
contentPadding: EdgeInsets.zero,
shadowColor: Colors.transparent,
backgroundColor: Colors.white,
content: StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
return SizedBox(
key: GlobalKey(),
height: 350,
width: MediaQuery.of(context).size.width * 0.8,
child: Container(
height: 100,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
border: Border.all(
color: Colors.grey,
width: 1,
),
),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
children: [
Expanded(child: Text(text, textAlign: TextAlign.left)),
getDefaultButton(
'OK',
() => {Navigator.pop(context)},
),
],
),
),
));
}));
});
}