mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 13:08:42 +00:00
fix console spaming error messages
This commit is contained in:
parent
636d4de1b6
commit
2b4ba6b81b
1 changed files with 41 additions and 44 deletions
|
|
@ -69,8 +69,7 @@ class ChatMessagesView extends StatefulWidget {
|
||||||
State<ChatMessagesView> createState() => _ChatMessagesViewState();
|
State<ChatMessagesView> createState() => _ChatMessagesViewState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ChatMessagesViewState extends State<ChatMessagesView>
|
class _ChatMessagesViewState extends State<ChatMessagesView> {
|
||||||
with SingleTickerProviderStateMixin {
|
|
||||||
TextEditingController newMessageController = TextEditingController();
|
TextEditingController newMessageController = TextEditingController();
|
||||||
HashSet<int> alreadyReportedOpened = HashSet<int>();
|
HashSet<int> alreadyReportedOpened = HashSet<int>();
|
||||||
late Contact user;
|
late Contact user;
|
||||||
|
|
@ -86,7 +85,6 @@ class _ChatMessagesViewState extends State<ChatMessagesView>
|
||||||
Timer? tutorial;
|
Timer? tutorial;
|
||||||
final ItemScrollController itemScrollController = ItemScrollController();
|
final ItemScrollController itemScrollController = ItemScrollController();
|
||||||
int? focusedScrollItem;
|
int? focusedScrollItem;
|
||||||
late AnimationController _animationController;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
@ -95,11 +93,6 @@ class _ChatMessagesViewState extends State<ChatMessagesView>
|
||||||
textFieldFocus = FocusNode();
|
textFieldFocus = FocusNode();
|
||||||
initStreams();
|
initStreams();
|
||||||
|
|
||||||
_animationController = AnimationController(
|
|
||||||
duration: const Duration(milliseconds: 200),
|
|
||||||
vsync: this,
|
|
||||||
);
|
|
||||||
|
|
||||||
tutorial = Timer(const Duration(seconds: 1), () async {
|
tutorial = Timer(const Duration(seconds: 1), () async {
|
||||||
tutorial = null;
|
tutorial = null;
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
|
|
@ -262,19 +255,18 @@ class _ChatMessagesViewState extends State<ChatMessagesView>
|
||||||
final index = messages.indexWhere(
|
final index = messages.indexWhere(
|
||||||
(x) => x.isMessage && x.message!.message.messageId == messageId);
|
(x) => x.isMessage && x.message!.message.messageId == messageId);
|
||||||
if (index == -1) return;
|
if (index == -1) return;
|
||||||
await itemScrollController.scrollTo(
|
|
||||||
index: index,
|
|
||||||
duration: const Duration(milliseconds: 400),
|
|
||||||
alignment: 0.5,
|
|
||||||
);
|
|
||||||
setState(() {
|
setState(() {
|
||||||
focusedScrollItem = index;
|
focusedScrollItem = index;
|
||||||
_animationController.forward().then((_) {
|
});
|
||||||
_animationController.reverse().then((_) {
|
await itemScrollController.scrollTo(
|
||||||
|
index: index,
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
alignment: 0.5,
|
||||||
|
);
|
||||||
|
Future.delayed(const Duration(milliseconds: 250), () {
|
||||||
|
if (!context.mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
_animationController.value = 0.0;
|
focusedScrollItem = null;
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -336,18 +328,22 @@ class _ChatMessagesViewState extends State<ChatMessagesView>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
final chatMessage = messages[i].message!;
|
final chatMessage = messages[i].message!;
|
||||||
return ScaleTransition(
|
return Transform.translate(
|
||||||
scale: Tween<double>(
|
offset: Offset((focusedScrollItem == i) ? -3 : 0, 0),
|
||||||
begin: 1,
|
child: Transform.scale(
|
||||||
end: (focusedScrollItem == i) ? 1.03 : 1)
|
scale: (focusedScrollItem == i) ? 1.03 : 1,
|
||||||
.animate(
|
// scale: Tween<double>(
|
||||||
CurvedAnimation(
|
// begin: 1,
|
||||||
parent: _animationController,
|
// end: (focusedScrollItem == i) ? 1.03 : 1)
|
||||||
curve: Curves.easeInOut,
|
// .animate(
|
||||||
),
|
// CurvedAnimation(
|
||||||
),
|
// parent: _animationController,
|
||||||
|
// curve: Curves.easeInOut,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
child: ChatListEntry(
|
child: ChatListEntry(
|
||||||
key: Key(chatMessage.message.messageId.toString()),
|
key:
|
||||||
|
Key(chatMessage.message.messageId.toString()),
|
||||||
chatMessage,
|
chatMessage,
|
||||||
user,
|
user,
|
||||||
galleryItems,
|
galleryItems,
|
||||||
|
|
@ -363,6 +359,7 @@ class _ChatMessagesViewState extends State<ChatMessagesView>
|
||||||
textFieldFocus.requestFocus();
|
textFieldFocus.requestFocus();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue