1
0
Fork 0
This commit is contained in:
Florian RICHER (MrDev023) 2022-04-14 22:48:15 +02:00
parent f2d808f5d3
commit 41b191bdd3
6 changed files with 80 additions and 30 deletions

View file

@ -1,8 +1,11 @@
import 'package:desktopapp/classes/stream_element.dart';
import 'package:desktopapp/utils/requests.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class StreamElementCard extends StatelessWidget {
StreamElementCard({Key? key, required this.streamElement}) : super(key: key);
const StreamElementCard({Key? key, required this.streamElement})
: super(key: key);
final StreamElement streamElement;
@ -25,15 +28,29 @@ class StreamElementCard extends StatelessWidget {
children: [
Row(
children: [
Text(
DateFormat.jms().format(streamElement.date),
style: const TextStyle(fontSize: 16),
),
const SizedBox(width: 8),
Icon(
icon,
size: 30,
),
SizedBox(width: 8),
Text(
streamElement.message,
style: TextStyle(fontSize: 16),
const SizedBox(width: 8),
Expanded(
child: Text(
streamElement.message,
style: const TextStyle(fontSize: 16),
),
),
if (streamElement.type == StreamElementType.alert)
IconButton(
icon: const Icon(Icons.send),
onPressed: () async {
await Requests.sendAlert(streamElement.message);
},
),
],
)
],

View file

@ -43,7 +43,7 @@ class _HomePageState extends State<HomePage> {
children: [
TextButton(
onPressed: () async {
await Mailer.disconnect();
await Mailer.disconnect(streamController: controller);
setState(() {
connected = false;
});