Skip to content
Snippets Groups Projects
Commit adb5708d authored by Maximilian Betz's avatar Maximilian Betz
Browse files

implemented nice pop up for messages in configuration, working but design not done yet

parent 37b3e7a1
No related branches found
No related tags found
No related merge requests found
......@@ -26,7 +26,7 @@ class _MyHomePageState extends State<Configuration> {
String _status = '';
TextStyle _statusStyle = const TextStyle(color: Colors.black);
Future<void> dumpToFile() async{
Future<void> dumpToFile(BuildContext context) async{
var date = DateTime.now().toUtc();
var isoDate = date.toIso8601String();
......@@ -53,10 +53,60 @@ class _MyHomePageState extends State<Configuration> {
_statusStyle = const TextStyle(color: Colors.green);
setState(() {});
HapticFeedback.vibrate();
_showResultPopup(context, _status);
}
}
void _showResultPopup(BuildContext context, String text) async {
// Declaring and Initializing OverlayState
// and OverlayEntry objects
OverlayState? overlayState = Overlay.of(context);
OverlayEntry overlayEntry;
overlayEntry = OverlayEntry(builder: (context) {
// You can return any widget you like
// here to be displayed on the Overlay
return Stack(
alignment: Alignment.center,
children: [
Positioned(
// Position at 10% of height from bottom
bottom: MediaQuery.of(context).size.height * 0.1,
child: Material(
borderRadius: BorderRadius.circular(8.0),
color: Colors.blue,
child: Container(
padding: const EdgeInsets.all(5.0), // Space between Text and Bubble
width: MediaQuery.of(context).size.width * 0.95,
child: TextFormField(
minLines: 1,
maxLines: 5,
readOnly: true,
autofocus: false,
enabled: false,
//style: _statusStyle,
controller: TextEditingController(
text: _status,
),
),
),
),
),
],
);
});
// Inserting the OverlayEntry into the Overlay
overlayState?.insert(overlayEntry);
// Awaiting for 5 seconds
await Future.delayed(const Duration(seconds: 5));
// Removing the OverlayEntry from the Overlay
overlayEntry.remove();
}
Future<void> updateConfiguration() async {
final EventStoreInstance event = EventStoreInstance();
String token = '';
......@@ -246,7 +296,7 @@ class _MyHomePageState extends State<Configuration> {
icon: const Icon(Icons.download),
label: const Text('Dump Events'),
onPressed: () {
dumpToFile();
dumpToFile(context);
//Reset for debug testing only. //Remove in RELEASE Version:
//database.delete();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment