feat: Handle activeClients in matrix

This commit is contained in:
Christian Pauly 2021-09-18 11:33:13 +02:00
parent 3590b3a58a
commit d1236c510d

View File

@ -57,12 +57,24 @@ class Matrix extends StatefulWidget {
}
class MatrixState extends State<Matrix> with WidgetsBindingObserver {
Client get client => widget.clients.first;
int _activeClient = 0;
Store store = Store();
BuildContext navigatorContext;
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;
set shareContent(Map<String, dynamic> content) {
_shareContent = content;