show loading / error for room chat controller
This commit is contained in:
parent
bc527ace07
commit
e96d40ce4e
1 changed files with 16 additions and 8 deletions
|
|
@ -13,6 +13,8 @@ import "package:nexus/helpers/hooks/chat_scroll.dart";
|
||||||
import "package:nexus/models/event.dart";
|
import "package:nexus/models/event.dart";
|
||||||
import "package:nexus/models/relation_type.dart";
|
import "package:nexus/models/relation_type.dart";
|
||||||
import "package:nexus/widgets/composer/composer.dart";
|
import "package:nexus/widgets/composer/composer.dart";
|
||||||
|
import "package:nexus/widgets/error_dialog.dart";
|
||||||
|
import "package:nexus/widgets/loading.dart";
|
||||||
import "package:nexus/widgets/pinned_events_drawer.dart";
|
import "package:nexus/widgets/pinned_events_drawer.dart";
|
||||||
import "package:nexus/widgets/member_list.dart";
|
import "package:nexus/widgets/member_list.dart";
|
||||||
import "package:nexus/widgets/room_appbar.dart";
|
import "package:nexus/widgets/room_appbar.dart";
|
||||||
|
|
@ -168,14 +170,20 @@ final class const RoomChat({
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: .symmetric(horizontal: 4),
|
padding: .symmetric(horizontal: 4),
|
||||||
child: ChatTimeline(
|
child: switch (controllerData) {
|
||||||
scroll: scroll,
|
AsyncLoading(value: _?) ||
|
||||||
roomId: roomId,
|
AsyncData(value: _) => ChatTimeline(
|
||||||
jumpToEvent: jumpToEvent,
|
scroll: scroll,
|
||||||
getEventOptions: getEventOptions,
|
roomId: roomId,
|
||||||
highlightedEvent: highlightedEvent.value,
|
jumpToEvent: jumpToEvent,
|
||||||
composerHeight: composerSize.value,
|
getEventOptions: getEventOptions,
|
||||||
),
|
highlightedEvent: highlightedEvent.value,
|
||||||
|
composerHeight: composerSize.value,
|
||||||
|
),
|
||||||
|
AsyncLoading _ => Loading(),
|
||||||
|
AsyncError(:final error, :final stackTrace) =>
|
||||||
|
ErrorDialog(error, stackTrace),
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue