mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-05-24 23:32:13 +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>
|
||||
with WidgetsBindingObserver {
|
||||
HashSet<int> alreadyReportedOpened = HashSet<int>();
|
||||
late StreamSubscription<Group?> userSub;
|
||||
late StreamSubscription<List<Message>> messageSub;
|
||||
StreamSubscription<Group?>? userSub;
|
||||
StreamSubscription<List<Message>>? messageSub;
|
||||
StreamSubscription<List<GroupHistory>>? groupActionsSub;
|
||||
StreamSubscription<List<Contact>>? contactSub;
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ class _ChatMessagesViewState extends State<ChatMessagesView>
|
|||
List<MemoryItem> galleryItems = [];
|
||||
Message? quotesMessage;
|
||||
GlobalKey verifyShieldKey = GlobalKey();
|
||||
late FocusNode textFieldFocus;
|
||||
FocusNode? textFieldFocus;
|
||||
final ItemScrollController itemScrollController = ItemScrollController();
|
||||
int? focusedScrollItem;
|
||||
bool _receiverDeletedAccount = false;
|
||||
|
|
@ -72,11 +72,12 @@ class _ChatMessagesViewState extends State<ChatMessagesView>
|
|||
|
||||
@override
|
||||
void dispose() {
|
||||
userSub.cancel();
|
||||
messageSub.cancel();
|
||||
userSub?.cancel();
|
||||
messageSub?.cancel();
|
||||
contactSub?.cancel();
|
||||
groupActionsSub?.cancel();
|
||||
_nextTypingIndicator?.cancel();
|
||||
textFieldFocus?.dispose();
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
|
@ -351,7 +352,7 @@ class _ChatMessagesViewState extends State<ChatMessagesView>
|
|||
setState(() {
|
||||
quotesMessage = chatMessage;
|
||||
});
|
||||
textFieldFocus.requestFocus();
|
||||
textFieldFocus?.requestFocus();
|
||||
},
|
||||
),
|
||||
);
|
||||
|
|
@ -394,7 +395,7 @@ class _ChatMessagesViewState extends State<ChatMessagesView>
|
|||
MessageInput(
|
||||
group: group,
|
||||
quotesMessage: quotesMessage,
|
||||
textFieldFocus: textFieldFocus,
|
||||
textFieldFocus: textFieldFocus!,
|
||||
onMessageSend: () {
|
||||
setState(() {
|
||||
quotesMessage = null;
|
||||
|
|
|
|||
|
|
@ -43,9 +43,8 @@ class TypingIndicator extends StatefulWidget {
|
|||
class _TypingIndicatorState extends State<TypingIndicator> {
|
||||
List<GroupMember> _groupMembers = [];
|
||||
|
||||
late StreamSubscription<List<(Contact, GroupMember)>> membersSub;
|
||||
|
||||
late Timer _periodicUpdate;
|
||||
StreamSubscription<List<(Contact, GroupMember)>>? membersSub;
|
||||
Timer? _periodicUpdate;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
@ -73,8 +72,8 @@ class _TypingIndicatorState extends State<TypingIndicator> {
|
|||
|
||||
@override
|
||||
void dispose() {
|
||||
membersSub.cancel();
|
||||
_periodicUpdate.cancel();
|
||||
membersSub?.cancel();
|
||||
_periodicUpdate?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
|
@ -138,12 +137,12 @@ class AnimatedTypingDots extends StatefulWidget {
|
|||
|
||||
class _AnimatedTypingDotsState extends State<AnimatedTypingDots>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late AnimationController _controller;
|
||||
|
||||
late List<Animation<double>> _animations;
|
||||
AnimationController? _controller;
|
||||
List<Animation<double>>? _animations;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = AnimationController(
|
||||
duration: const Duration(milliseconds: 1000),
|
||||
vsync: this,
|
||||
|
|
@ -172,29 +171,30 @@ class _AnimatedTypingDotsState extends State<AnimatedTypingDots>
|
|||
),
|
||||
]).animate(
|
||||
CurvedAnimation(
|
||||
parent: _controller,
|
||||
parent: _controller!,
|
||||
curve: Interval(start, end),
|
||||
),
|
||||
);
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
_controller?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_animations == null) return const SizedBox.shrink();
|
||||
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: List.generate(
|
||||
3,
|
||||
(index) => _AnimatedDot(
|
||||
isTyping: widget.isTyping,
|
||||
animation: _animations[index],
|
||||
animation: _animations![index],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue