83 lines
2.8 KiB
Dart
83 lines
2.8 KiB
Dart
import 'package:aves/model/source/collection_source.dart';
|
|
import 'package:aves/model/source/events.dart';
|
|
import 'package:aves/remote/remote_sync_bus.dart';
|
|
import 'package:aves/widgets/common/action_mixins/feedback.dart';
|
|
import 'package:aves/widgets/common/extensions/build_context.dart';
|
|
import 'package:aves/widgets/common/identity/empty.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
|
|
class LoadingEmptyContent extends StatelessWidget {
|
|
final CollectionSource source;
|
|
|
|
const LoadingEmptyContent({
|
|
super.key,
|
|
required this.source,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final countFormatter = NumberFormat.decimalPattern(context.locale);
|
|
final progressTextStyle = TextStyle(
|
|
color: Theme.of(context).colorScheme.primary.withValues(alpha: .5),
|
|
fontSize: 18,
|
|
);
|
|
|
|
return EmptyContent(
|
|
text: context.l10n.sourceStateLoading,
|
|
bottom: Padding(
|
|
padding: const EdgeInsets.only(top: 16),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
// === PROGRESS LOCALE (Aves originale) ===
|
|
Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
const ReportProgressIndicator(),
|
|
ValueListenableBuilder<ProgressEvent>(
|
|
valueListenable: source.progressNotifier,
|
|
builder: (context, progress, snapshot) {
|
|
final done = progress.done;
|
|
return done > 0
|
|
? Text(
|
|
countFormatter.format(done),
|
|
style: progressTextStyle,
|
|
)
|
|
: const SizedBox();
|
|
},
|
|
),
|
|
],
|
|
),
|
|
|
|
// === PROGRESS REMOTO (solo bootstrap, stile "Aves") ===
|
|
ValueListenableBuilder<RemoteSyncProgress?>(
|
|
valueListenable: RemoteSyncBus.instance.progressNotifier,
|
|
builder: (context, prog, _) {
|
|
if (prog == null || !prog.showOverlay) return const SizedBox.shrink();
|
|
|
|
final done = prog.done;
|
|
final total = prog.total;
|
|
|
|
// stesso stile "numerone", ma per remoti preferiamo X/Y
|
|
final text = total > 0
|
|
? 'Agg remoti ${countFormatter.format(done)}/${countFormatter.format(total)}'
|
|
: 'Agg remoti ${countFormatter.format(done)}';
|
|
|
|
return Padding(
|
|
padding: const EdgeInsets.only(top: 12),
|
|
child: Text(
|
|
text,
|
|
style: progressTextStyle,
|
|
textAlign: TextAlign.center,
|
|
),
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|