mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-02-03 00:34:11 +01:00
refactor: Client in ChatPage
This commit is contained in:
parent
507cd1f17e
commit
2f6799470c
@ -47,7 +47,7 @@ class Chat extends StatefulWidget {
|
|||||||
class ChatController extends State<Chat> {
|
class ChatController extends State<Chat> {
|
||||||
Room? room;
|
Room? room;
|
||||||
|
|
||||||
Client? sendingClient;
|
late Client sendingClient;
|
||||||
|
|
||||||
Timeline? timeline;
|
Timeline? timeline;
|
||||||
|
|
||||||
@ -250,6 +250,7 @@ class ChatController extends State<Chat> {
|
|||||||
inputFocus.addListener(_inputFocusListener);
|
inputFocus.addListener(_inputFocusListener);
|
||||||
_loadDraft();
|
_loadDraft();
|
||||||
super.initState();
|
super.initState();
|
||||||
|
sendingClient = Matrix.of(context).client;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateView() {
|
void updateView() {
|
||||||
@ -324,7 +325,7 @@ class ChatController extends State<Chat> {
|
|||||||
|
|
||||||
TextEditingController sendController = TextEditingController();
|
TextEditingController sendController = TextEditingController();
|
||||||
|
|
||||||
void setSendingClient(Client? c) {
|
void setSendingClient(Client c) {
|
||||||
// first cancle typing with the old sending client
|
// first cancle typing with the old sending client
|
||||||
if (currentlyTyping) {
|
if (currentlyTyping) {
|
||||||
// no need to have the setting typing to false be blocking
|
// no need to have the setting typing to false be blocking
|
||||||
|
@ -296,7 +296,7 @@ class _ChatAccountPicker extends StatelessWidget {
|
|||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: FutureBuilder<Profile>(
|
child: FutureBuilder<Profile>(
|
||||||
future: controller.sendingClient!.fetchOwnProfile(),
|
future: controller.sendingClient.fetchOwnProfile(),
|
||||||
builder: (context, snapshot) => PopupMenuButton<String>(
|
builder: (context, snapshot) => PopupMenuButton<String>(
|
||||||
onSelected: (mxid) => _popupMenuButtonSelected(mxid, context),
|
onSelected: (mxid) => _popupMenuButtonSelected(mxid, context),
|
||||||
itemBuilder: (BuildContext context) => clients
|
itemBuilder: (BuildContext context) => clients
|
||||||
|
@ -139,9 +139,7 @@ class ChatView extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final client = Matrix.of(context).client;
|
controller.room = controller.sendingClient.getRoomById(controller.roomId!);
|
||||||
controller.sendingClient ??= client;
|
|
||||||
controller.room = controller.sendingClient!.getRoomById(controller.roomId!);
|
|
||||||
controller.readMarkerEventId ??= controller.room!.fullyRead;
|
controller.readMarkerEventId ??= controller.room!.fullyRead;
|
||||||
if (controller.room == null) {
|
if (controller.room == null) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
Loading…
Reference in New Issue
Block a user