busy handling

This commit is contained in:
Christien Rioux 2024-02-27 12:45:58 -05:00
parent 43b01c7555
commit c6f017b0d1
23 changed files with 307 additions and 179 deletions

View file

@ -1,4 +1,5 @@
import 'package:async_tools/async_tools.dart';
import 'package:bloc_tools/bloc_tools.dart';
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
@ -75,8 +76,7 @@ class HomeAccountReadyShellState extends State<HomeAccountReadyShell> {
// Process all accepted or rejected invitations
void _invitationStatusListener(
BuildContext context, WaitingInvitationsBlocMapState state) {
_singleInvitationStatusProcessor.updateState(state,
closure: (newState) async {
_singleInvitationStatusProcessor.updateState(state, (newState) async {
final contactListCubit = context.read<ContactListCubit>();
final contactInvitationListCubit =
context.read<ContactInvitationListCubit>();
@ -146,7 +146,8 @@ class HomeAccountReadyShellState extends State<HomeAccountReadyShell> {
activeAccountInfo: widget.activeAccountInfo,
contactListCubit: context.read<ContactListCubit>())
..follow(
initialInputState: const AsyncValue.loading(),
initialInputState:
const BlocBusyState(AsyncValue.loading()),
stream: context.read<ChatListCubit>().stream)),
BlocProvider(
create: (context) =>
@ -167,7 +168,8 @@ class HomeAccountReadyShellState extends State<HomeAccountReadyShell> {
activeAccountInfo: widget.activeAccountInfo,
account: account)
..follow(
initialInputState: const AsyncValue.loading(),
initialInputState:
const BlocBusyState(AsyncValue.loading()),
stream: context
.read<ContactInvitationListCubit>()
.stream))

View file

@ -38,11 +38,14 @@ class AccountPageState extends State<AccountPage> {
final textTheme = theme.textTheme;
final scale = theme.extension<ScaleScheme>()!;
final cilState = context.watch<ContactInvitationListCubit>().state;
final cilBusy = cilState.busy;
final contactInvitationRecordList =
context.watch<ContactInvitationListCubit>().state.data?.value ??
const IListConst([]);
final contactList = context.watch<ContactListCubit>().state.data?.value ??
const IListConst([]);
cilState.state.data?.value ?? const IListConst([]);
final ciState = context.watch<ContactListCubit>().state;
final ciBusy = ciState.busy;
final contactList = ciState.state.data?.value ?? const IListConst([]);
return SizedBox(
child: Column(children: <Widget>[
@ -66,10 +69,11 @@ class AccountPageState extends State<AccountPage> {
initiallyExpanded: true,
children: [
ContactInvitationListWidget(
contactInvitationRecordList: contactInvitationRecordList)
contactInvitationRecordList: contactInvitationRecordList,
disabled: cilBusy)
],
).paddingLTRB(8, 0, 8, 8),
ContactListWidget(contactList: contactList).expanded(),
ContactListWidget(contactList: contactList, disabled: ciBusy).expanded(),
]));
}
}