simplified loadable state logic by removing connectivity debouncing and inlining indicator helpers; updated error bar visibility and chat list polling behavior

This commit is contained in:
2026-08-02 08:21:25 +02:00
parent 4c2e9b47e7
commit 246cb0f527
7 changed files with 36 additions and 195 deletions
@@ -62,8 +62,8 @@ class LoadableStateConsumer<
final showPrimaryLoading = isLoading && !hasContent;
final showBackgroundLoading = isLoading && hasContent;
final showError = hasError && !hasContent && !isLoading;
final showErrorBar = hasError && hasContent && !isLoading;
final showError = hasError && !hasContent;
final showErrorBar = hasError && hasContent;
// Keep the wrapper hierarchy stable across refresh cycles: reFetch flips to
// null mid-refetch, and toggling the RefreshIndicator on that signal would
@@ -102,7 +102,6 @@ class LoadableStateConsumer<
LoadableStateErrorBar(
visible: showErrorBar,
hasContent: hasContent,
loading: isLoading,
message: loadableState.error?.message,
technicalDetails: loadableState.error?.technicalDetails,
lastUpdated: loadableState.lastFetch,
@@ -5,19 +5,16 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import '../../../../../widget/info_dialog.dart';
import '../bloc/loadable_state_bloc.dart';
import '../loadable_state_indicators.dart';
class LoadableStateErrorBar extends StatelessWidget {
final bool visible;
final bool hasContent;
final bool loading;
final String? message;
final String? technicalDetails;
final int? lastUpdated;
const LoadableStateErrorBar({
required this.visible,
this.hasContent = false,
this.loading = false,
this.message,
this.technicalDetails,
this.lastUpdated,
@@ -29,12 +26,8 @@ class LoadableStateErrorBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
final bloc = context.watch<LoadableStateBloc>();
final isOfflineWithCache = shouldShowOfflineBar(
hasContent: hasContent,
loading: loading,
connectivityKnown: bloc.connectivityStatusKnown(),
connected: bloc.isConnected(),
);
final isOfflineWithCache =
hasContent && bloc.connectivityStatusKnown() && !bloc.isConnected();
final shouldShow = visible || isOfflineWithCache;
return AnimatedSize(