mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-10-16 20:47:27 +02:00
feat: Handle activeClients in matrix
This commit is contained in:
parent
3590b3a58a
commit
d1236c510d
@ -57,12 +57,24 @@ class Matrix extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||||
Client get client => widget.clients.first;
|
int _activeClient = 0;
|
||||||
Store store = Store();
|
Store store = Store();
|
||||||
BuildContext navigatorContext;
|
BuildContext navigatorContext;
|
||||||
|
|
||||||
BackgroundPush _backgroundPush;
|
BackgroundPush _backgroundPush;
|
||||||
|
|
||||||
|
Client get client => widget.clients[_safeActiveClient];
|
||||||
|
|
||||||
|
set activeClient(int newActiveClient) =>
|
||||||
|
setState(() => _activeClient = newActiveClient);
|
||||||
|
|
||||||
|
int get _safeActiveClient {
|
||||||
|
if (_activeClient < 0 || _activeClient >= widget.clients.length) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return _activeClient;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, dynamic> get shareContent => _shareContent;
|
Map<String, dynamic> get shareContent => _shareContent;
|
||||||
set shareContent(Map<String, dynamic> content) {
|
set shareContent(Map<String, dynamic> content) {
|
||||||
_shareContent = content;
|
_shareContent = content;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user