51 lines
1.7 KiB
Dart
51 lines
1.7 KiB
Dart
// lib/widgets/collection/remote_progress_banner.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.notifier,
|
|
builder: (context, prog, _) {
|
|
if (prog == null) return const SizedBox.shrink();
|
|
|
|
final label = '${prog.phase} ${prog.done}/${prog.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: prog.value, // determinata
|
|
minHeight: 4,
|
|
backgroundColor: Colors.white24,
|
|
color: Colors.lightBlueAccent,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|