#1 Fixed chat timestamps not always working correctly
This commit is contained in:
parent
4e127f6ea7
commit
d033042e0b
@ -39,6 +39,10 @@ class _ChatViewState extends State<ChatView> {
|
|||||||
Provider.of<ChatProps>(context, listen: false).setQueryToken(widget.room.token);
|
Provider.of<ChatProps>(context, listen: false).setQueryToken(widget.room.token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isSameDay(DateTime date1, DateTime date2) {
|
||||||
|
return date1.year == date2.year && date1.month == date2.month && date1.day == date2.day;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Consumer<ChatProps>(
|
return Consumer<ChatProps>(
|
||||||
@ -53,7 +57,7 @@ class _ChatViewState extends State<ChatView> {
|
|||||||
|
|
||||||
if(element.systemMessage.contains("reaction")) return;
|
if(element.systemMessage.contains("reaction")) return;
|
||||||
|
|
||||||
if(elementDate.weekday != lastDate.weekday) {
|
if(!isSameDay(elementDate, lastDate)) {
|
||||||
lastDate = elementDate;
|
lastDate = elementDate;
|
||||||
messages.add(ChatBubble(
|
messages.add(ChatBubble(
|
||||||
context: context,
|
context: context,
|
||||||
|
@ -154,7 +154,7 @@ class _ChatTextfieldState extends State<ChatTextfield> {
|
|||||||
),
|
),
|
||||||
cursorColor: Colors.white,
|
cursorColor: Colors.white,
|
||||||
onChanged: (String text) {
|
onChanged: (String text) {
|
||||||
if(text == "marbot marbot marbot") {
|
if(text.trim().toLowerCase() == "marbot marbot marbot") {
|
||||||
var newText = "Roboter sind cool und so, aber marbots sind besser!";
|
var newText = "Roboter sind cool und so, aber marbots sind besser!";
|
||||||
_textBoxController.text = newText;
|
_textBoxController.text = newText;
|
||||||
text = newText;
|
text = newText;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user