Offline Support
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../providers/realtime_controller.dart';
|
||||
import '../providers/sync_queue_provider.dart';
|
||||
|
||||
/// Subtle, non-blocking connection status indicator.
|
||||
/// Shows in the bottom-right corner when streams are recovering/stale.
|
||||
@@ -18,12 +19,19 @@ class ReconnectIndicator extends ConsumerWidget {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
final pendingCount = ref.watch(pendingSyncCountProvider);
|
||||
|
||||
// Build a human-readable label for recovering channels.
|
||||
final channels = ctrl.recoveringChannels;
|
||||
final label = channels.length <= 2
|
||||
final channelLabel = channels.length <= 2
|
||||
? channels.map(_humanize).join(', ')
|
||||
: '${channels.length} channels';
|
||||
|
||||
final syncSuffix = pendingCount > 0
|
||||
? ' — syncing $pendingCount item${pendingCount == 1 ? '' : 's'}'
|
||||
: '';
|
||||
final label = 'Reconnecting $channelLabel$syncSuffix…';
|
||||
|
||||
return Positioned(
|
||||
bottom: 16,
|
||||
right: 16,
|
||||
@@ -60,7 +68,7 @@ class ReconnectIndicator extends ConsumerWidget {
|
||||
const SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: Text(
|
||||
'Reconnecting $label…',
|
||||
label,
|
||||
style: Theme.of(context).textTheme.labelSmall,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user