mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-05-25 00:52:12 +00:00
fixes late initation error
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
This commit is contained in:
parent
f553713ff8
commit
7f7aba8e08
2 changed files with 20 additions and 19 deletions
|
|
@ -40,8 +40,8 @@ class ChatMessagesView extends StatefulWidget {
|
||||||
class _ChatMessagesViewState extends State<ChatMessagesView>
|
class _ChatMessagesViewState extends State<ChatMessagesView>
|
||||||
with WidgetsBindingObserver {
|
with WidgetsBindingObserver {
|
||||||
HashSet<int> alreadyReportedOpened = HashSet<int>();
|
HashSet<int> alreadyReportedOpened = HashSet<int>();
|
||||||
late StreamSubscription<Group?> userSub;
|
StreamSubscription<Group?>? userSub;
|
||||||
late StreamSubscription<List<Message>> messageSub;
|
StreamSubscription<List<Message>>? messageSub;
|
||||||
StreamSubscription<List<GroupHistory>>? groupActionsSub;
|
StreamSubscription<List<GroupHistory>>? groupActionsSub;
|
||||||
StreamSubscription<List<Contact>>? contactSub;
|
StreamSubscription<List<Contact>>? contactSub;
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ class _ChatMessagesViewState extends State<ChatMessagesView>
|
||||||
List<MemoryItem> galleryItems = [];
|
List<MemoryItem> galleryItems = [];
|
||||||
Message? quotesMessage;
|
Message? quotesMessage;
|
||||||
GlobalKey verifyShieldKey = GlobalKey();
|
GlobalKey verifyShieldKey = GlobalKey();
|
||||||
late FocusNode textFieldFocus;
|
FocusNode? textFieldFocus;
|
||||||
final ItemScrollController itemScrollController = ItemScrollController();
|
final ItemScrollController itemScrollController = ItemScrollController();
|
||||||
int? focusedScrollItem;
|
int? focusedScrollItem;
|
||||||
bool _receiverDeletedAccount = false;
|
bool _receiverDeletedAccount = false;
|
||||||
|
|
@ -72,11 +72,12 @@ class _ChatMessagesViewState extends State<ChatMessagesView>
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
userSub.cancel();
|
userSub?.cancel();
|
||||||
messageSub.cancel();
|
messageSub?.cancel();
|
||||||
contactSub?.cancel();
|
contactSub?.cancel();
|
||||||
groupActionsSub?.cancel();
|
groupActionsSub?.cancel();
|
||||||
_nextTypingIndicator?.cancel();
|
_nextTypingIndicator?.cancel();
|
||||||
|
textFieldFocus?.dispose();
|
||||||
WidgetsBinding.instance.removeObserver(this);
|
WidgetsBinding.instance.removeObserver(this);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
@ -351,7 +352,7 @@ class _ChatMessagesViewState extends State<ChatMessagesView>
|
||||||
setState(() {
|
setState(() {
|
||||||
quotesMessage = chatMessage;
|
quotesMessage = chatMessage;
|
||||||
});
|
});
|
||||||
textFieldFocus.requestFocus();
|
textFieldFocus?.requestFocus();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
@ -394,7 +395,7 @@ class _ChatMessagesViewState extends State<ChatMessagesView>
|
||||||
MessageInput(
|
MessageInput(
|
||||||
group: group,
|
group: group,
|
||||||
quotesMessage: quotesMessage,
|
quotesMessage: quotesMessage,
|
||||||
textFieldFocus: textFieldFocus,
|
textFieldFocus: textFieldFocus!,
|
||||||
onMessageSend: () {
|
onMessageSend: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
quotesMessage = null;
|
quotesMessage = null;
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,8 @@ class TypingIndicator extends StatefulWidget {
|
||||||
class _TypingIndicatorState extends State<TypingIndicator> {
|
class _TypingIndicatorState extends State<TypingIndicator> {
|
||||||
List<GroupMember> _groupMembers = [];
|
List<GroupMember> _groupMembers = [];
|
||||||
|
|
||||||
late StreamSubscription<List<(Contact, GroupMember)>> membersSub;
|
StreamSubscription<List<(Contact, GroupMember)>>? membersSub;
|
||||||
|
Timer? _periodicUpdate;
|
||||||
late Timer _periodicUpdate;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
@ -73,8 +72,8 @@ class _TypingIndicatorState extends State<TypingIndicator> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
membersSub.cancel();
|
membersSub?.cancel();
|
||||||
_periodicUpdate.cancel();
|
_periodicUpdate?.cancel();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -138,12 +137,12 @@ class AnimatedTypingDots extends StatefulWidget {
|
||||||
|
|
||||||
class _AnimatedTypingDotsState extends State<AnimatedTypingDots>
|
class _AnimatedTypingDotsState extends State<AnimatedTypingDots>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
late AnimationController _controller;
|
AnimationController? _controller;
|
||||||
|
List<Animation<double>>? _animations;
|
||||||
late List<Animation<double>> _animations;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
super.initState();
|
||||||
_controller = AnimationController(
|
_controller = AnimationController(
|
||||||
duration: const Duration(milliseconds: 1000),
|
duration: const Duration(milliseconds: 1000),
|
||||||
vsync: this,
|
vsync: this,
|
||||||
|
|
@ -172,29 +171,30 @@ class _AnimatedTypingDotsState extends State<AnimatedTypingDots>
|
||||||
),
|
),
|
||||||
]).animate(
|
]).animate(
|
||||||
CurvedAnimation(
|
CurvedAnimation(
|
||||||
parent: _controller,
|
parent: _controller!,
|
||||||
curve: Interval(start, end),
|
curve: Interval(start, end),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
super.initState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_controller.dispose();
|
_controller?.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
if (_animations == null) return const SizedBox.shrink();
|
||||||
|
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: List.generate(
|
children: List.generate(
|
||||||
3,
|
3,
|
||||||
(index) => _AnimatedDot(
|
(index) => _AnimatedDot(
|
||||||
isTyping: widget.isTyping,
|
isTyping: widget.isTyping,
|
||||||
animation: _animations[index],
|
animation: _animations![index],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue