aves_mio1/lib/widgets/collection/remote_progress_banner.dart
FabioMich66 deb7b4c6dd
Some checks are pending
Quality check / Flutter analysis (push) Waiting to run
Quality check / CodeQL analysis (java-kotlin) (push) Waiting to run
super
2026-04-10 10:07:04 +02:00

57 lines
1.9 KiB
Dart

import 'package:flutter/material.dart';
import 'package:aves/remote/remote_sync_bus.dart';
class RemoteProgressBanner extends StatelessWidget {
const RemoteProgressBanner({super.key});
@override
Widget build(BuildContext context) {
final bus = RemoteSyncBus.instance;
return ValueListenableBuilder<RemoteSyncProgress?>(
valueListenable: bus.progressNotifier,
builder: (context, prog, _) {
// Mostra SOLO quando è bootstrap (showOverlay=true)
if (prog == null || !prog.showOverlay) return const SizedBox.shrink();
final total = prog.total;
final done = prog.done;
final value = total > 0 ? done / total : null;
final label = 'Agg remoti $done/$total';
return SafeArea(
child: Align(
alignment: Alignment.topCenter,
child: Container(
margin: const EdgeInsets.all(12),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
width: 380,
decoration: BoxDecoration(
color: Colors.black87,
borderRadius: BorderRadius.circular(12),
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label, style: const TextStyle(color: Colors.white)),
const SizedBox(height: 6),
ClipRRect(
borderRadius: BorderRadius.circular(6),
child: LinearProgressIndicator(
value: value, // determinata se total>0, altrimenti indeterminata
minHeight: 4,
backgroundColor: Colors.white24,
color: Colors.lightBlueAccent,
),
),
],
),
),
),
);
},
);
}
}