Added long press options to chatbubbles
This commit is contained in:
parent
2f91b89e0f
commit
ff4566cf05
@ -5,6 +5,7 @@ import 'package:marianum_mobile/api/marianumcloud/talk/chat/getChatResponse.dart
|
|||||||
import 'package:marianum_mobile/screen/pages/talk/chatMessage.dart';
|
import 'package:marianum_mobile/screen/pages/talk/chatMessage.dart';
|
||||||
|
|
||||||
import '../../../api/marianumcloud/talk/room/getRoomResponse.dart';
|
import '../../../api/marianumcloud/talk/room/getRoomResponse.dart';
|
||||||
|
import '../../settings/debug/jsonViewer.dart';
|
||||||
|
|
||||||
class ChatBubble {
|
class ChatBubble {
|
||||||
static const styleSystem = BubbleStyle(
|
static const styleSystem = BubbleStyle(
|
||||||
@ -64,12 +65,13 @@ class ChatBubble {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Bubble generateBubble() {
|
Widget generateBubble() {
|
||||||
bool showActorDisplayName = bubbleData.messageType == GetRoomResponseObjectMessageType.comment && chatData.type != GetRoomResponseObjectConversationType.oneToOne;
|
bool showActorDisplayName = bubbleData.messageType == GetRoomResponseObjectMessageType.comment && chatData.type != GetRoomResponseObjectConversationType.oneToOne;
|
||||||
bool showBubbleTime = bubbleData.messageType != GetRoomResponseObjectMessageType.system;
|
bool showBubbleTime = bubbleData.messageType != GetRoomResponseObjectMessageType.system;
|
||||||
var actorTextStyle = TextStyle(color: Theme.of(context).primaryColor, fontWeight: FontWeight.bold);
|
var actorTextStyle = TextStyle(color: Theme.of(context).primaryColor, fontWeight: FontWeight.bold);
|
||||||
|
|
||||||
return Bubble(
|
return GestureDetector(
|
||||||
|
child: Bubble(
|
||||||
|
|
||||||
style: getStyle(),
|
style: getStyle(),
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -116,6 +118,28 @@ class ChatBubble {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
onLongPress: () {
|
||||||
|
showDialog(context: context, builder: (context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
children: [
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.copy),
|
||||||
|
title: Text("Nachricht kopieren"),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.person),
|
||||||
|
title: Text("Zu '${bubbleData.actorDisplayName}' wechseln"),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.bug_report_outlined),
|
||||||
|
title: Text("Debugdaten anzeigen"),
|
||||||
|
onTap: () => JsonViewer.asDialog(context, bubbleData.toJson()),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
import 'package:bubble/bubble.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:marianum_mobile/api/marianumcloud/talk/room/getRoomResponse.dart';
|
import 'package:marianum_mobile/api/marianumcloud/talk/room/getRoomResponse.dart';
|
||||||
import 'package:marianum_mobile/data/chatList/chatProps.dart';
|
import 'package:marianum_mobile/data/chatList/chatProps.dart';
|
||||||
@ -35,7 +34,7 @@ class _ChatViewState extends State<ChatView> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Consumer<ChatProps>(
|
return Consumer<ChatProps>(
|
||||||
builder: (context, data, child) {
|
builder: (context, data, child) {
|
||||||
List<Bubble> messages = List<Bubble>.empty(growable: true);
|
List<Widget> messages = List<Widget>.empty(growable: true);
|
||||||
|
|
||||||
if(!data.primaryLoading()) {
|
if(!data.primaryLoading()) {
|
||||||
|
|
||||||
|
@ -86,16 +86,7 @@ class _WeekViewState extends State<WeekView> {
|
|||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.bug_report_outlined),
|
leading: const Icon(Icons.bug_report_outlined),
|
||||||
title: const Text("Webuntis Rohdaten zeigen"),
|
title: const Text("Webuntis Rohdaten zeigen"),
|
||||||
onTap: () => showDialog(context: context, builder: (context) {
|
onTap: () => JsonViewer.asDialog(context, timetableData.toJson()),
|
||||||
return AlertDialog(
|
|
||||||
scrollable: true,
|
|
||||||
title: const Text("Rohdaten"),
|
|
||||||
content: Text(JsonViewer.format(timetableData.toJson())),
|
|
||||||
actions: [
|
|
||||||
TextButton(onPressed: () => Navigator.of(context).pop(), child: const SingleChildScrollView(child: Text("Schließen")))
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -24,4 +24,17 @@ class JsonViewer extends StatelessWidget {
|
|||||||
return prettyJson(jsonInput, indent: 2);
|
return prettyJson(jsonInput, indent: 2);
|
||||||
//return jsonInput.replaceAllMapped(RegExp(r'[{,}]'), (match) => "${match.group(0)}\n ");
|
//return jsonInput.replaceAllMapped(RegExp(r'[{,}]'), (match) => "${match.group(0)}\n ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void asDialog(BuildContext context, Map<String, dynamic> dataMap) {
|
||||||
|
showDialog(context: context, builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
scrollable: true,
|
||||||
|
title: const Text("Rohdaten"),
|
||||||
|
content: Text(JsonViewer.format(dataMap)),
|
||||||
|
actions: [
|
||||||
|
TextButton(onPressed: () => Navigator.of(context).pop(), child: const SingleChildScrollView(child: Text("Schließen")))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user