refactor: Switch to loading dialog
This commit is contained in:
parent
9521a93622
commit
75797a62b9
36 changed files with 461 additions and 350 deletions
|
|
@ -11,7 +11,7 @@ import 'package:fluffychat/components/avatar.dart';
|
|||
import 'package:fluffychat/components/chat_settings_popup_menu.dart';
|
||||
import 'package:fluffychat/components/connection_status_header.dart';
|
||||
import 'package:fluffychat/components/dialogs/recording_dialog.dart';
|
||||
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:fluffychat/components/encryption_button.dart';
|
||||
import 'package:fluffychat/components/list_items/message.dart';
|
||||
import 'package:fluffychat/components/matrix.dart';
|
||||
|
|
@ -114,8 +114,9 @@ class _ChatState extends State<_Chat> {
|
|||
if (_canLoadMore) {
|
||||
setState(() => _loadingHistory = true);
|
||||
|
||||
await SimpleDialogs(context).tryRequestWithErrorToast(
|
||||
timeline.requestHistory(historyCount: _loadHistoryCount),
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => timeline.requestHistory(historyCount: _loadHistoryCount),
|
||||
);
|
||||
|
||||
// we do NOT setState() here as then the event order will be wrong.
|
||||
|
|
@ -275,8 +276,9 @@ class _ChatState extends State<_Chat> {
|
|||
final audioFile = File(result);
|
||||
// as we already explicitly say send in the recording dialog,
|
||||
// we do not need the send file dialog anymore. We can just send this straight away.
|
||||
await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||
room.sendFileEvent(
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => room.sendFileEvent(
|
||||
MatrixAudioFile(
|
||||
bytes: audioFile.readAsBytesSync(), name: audioFile.path),
|
||||
),
|
||||
|
|
@ -313,8 +315,9 @@ class _ChatState extends State<_Chat> {
|
|||
OkCancelResult.ok;
|
||||
if (!confirmed) return;
|
||||
for (var event in selectedEvents) {
|
||||
await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||
event.status > 0 ? event.redact() : event.remove());
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => event.status > 0 ? event.redact() : event.remove());
|
||||
}
|
||||
setState(() => selectedEvents.clear());
|
||||
}
|
||||
|
|
@ -400,7 +403,7 @@ class _ChatState extends State<_Chat> {
|
|||
}
|
||||
});
|
||||
if (context != null) {
|
||||
await SimpleDialogs(context).tryRequestWithLoadingDialog(task);
|
||||
await showFutureLoadingDialog(context: context, future: () => task);
|
||||
} else {
|
||||
await task;
|
||||
}
|
||||
|
|
@ -445,8 +448,9 @@ class _ChatState extends State<_Chat> {
|
|||
}
|
||||
|
||||
void _sendEmojiAction(BuildContext context, String emoji) {
|
||||
SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||
room.sendReaction(
|
||||
showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => room.sendReaction(
|
||||
selectedEvents.first.eventId,
|
||||
emoji,
|
||||
),
|
||||
|
|
@ -472,7 +476,7 @@ class _ChatState extends State<_Chat> {
|
|||
matrix.activeRoomId = widget.id;
|
||||
|
||||
if (room.membership == Membership.invite) {
|
||||
SimpleDialogs(context).tryRequestWithLoadingDialog(room.join());
|
||||
showFutureLoadingDialog(context: context, future: () => room.join());
|
||||
}
|
||||
|
||||
final typingText = room.getLocalizedTypingText(context);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue