Added functionality to create chat
This commit is contained in:
@ -1,8 +1,11 @@
|
||||
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:marianum_mobile/api/marianumcloud/talk/createRoom/createRoomParams.dart';
|
||||
import 'package:marianum_mobile/widget/confirmDialog.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../api/marianumcloud/talk/createRoom/createRoom.dart';
|
||||
import '../../../model/chatList/chatListProps.dart';
|
||||
import '../../../storage/base/settingsProvider.dart';
|
||||
import 'chatTile.dart';
|
||||
@ -51,8 +54,24 @@ class _ChatListState extends State<ChatList> {
|
||||
floatingActionButton: FloatingActionButton(
|
||||
heroTag: "createChat",
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
onPressed: () {
|
||||
showSearch(context: context, delegate: JoinChat());
|
||||
onPressed: () async {
|
||||
showSearch(context: context, delegate: JoinChat()).then((username) {
|
||||
if(username == null) return;
|
||||
|
||||
ConfirmDialog(
|
||||
title: "Chat starten",
|
||||
content: "Möchtest du einen Chat mit nutzer '$username' starten?",
|
||||
confirmButton: "Chat starten",
|
||||
onConfirm: () {
|
||||
CreateRoom(CreateRoomParams(
|
||||
roomType: 1,
|
||||
invite: username,
|
||||
)).run().then((value) {
|
||||
_query(renew: true);
|
||||
});
|
||||
},
|
||||
).asDialog(context);
|
||||
});
|
||||
},
|
||||
child: const Icon(Icons.add_comment_outlined),
|
||||
),
|
||||
|
Reference in New Issue
Block a user