fix: in chat details page, reload course info on language update (#4500)
This commit is contained in:
parent
ab6685ebf7
commit
985fa079b8
1 changed files with 19 additions and 0 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
|
|
@ -55,11 +57,22 @@ class ChatDetailsController extends State<ChatDetails>
|
|||
bool loadingActivities = true;
|
||||
bool loadingCourseSummary = true;
|
||||
|
||||
// listen to language updates to refresh course info
|
||||
StreamSubscription? _languageSubscription;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadCourseInfo();
|
||||
_loadSummaries();
|
||||
|
||||
_languageSubscription = MatrixState
|
||||
.pangeaController.userController.languageStream.stream
|
||||
.listen((update) {
|
||||
if (update.prevBaseLang != update.baseLang) {
|
||||
_loadCourseInfo();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -71,6 +84,12 @@ class ChatDetailsController extends State<ChatDetails>
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_languageSubscription?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// Pangea#
|
||||
bool displaySettings = false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue