mirror of
https://codeberg.org/shroff/phylum.git
synced 2026-01-07 04:00:17 -06:00
[client] Manual retry in sync dialog
This commit is contained in:
28
client/lib/ui/sync/sliver_offline.dart
Normal file
28
client/lib/ui/sync/sliver_offline.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:phylum/libphylum/phylum_api_types.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class OfflineSliver extends StatelessWidget {
|
||||
const OfflineSliver({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final unreachable = context.select<PhylumActionQueueState, bool>((state) => state.unreachable);
|
||||
|
||||
return SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, i) {
|
||||
return ListTile(
|
||||
leading: Icon(Icons.refresh),
|
||||
title: Text('Server Unreachable'),
|
||||
subtitle: Text('Tap to retry'),
|
||||
onTap: () {
|
||||
context.read<PhylumActionQueue>().resume();
|
||||
},
|
||||
);
|
||||
},
|
||||
childCount: unreachable ? 1 : 0,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ class UpdatesSliver extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final actions = context.select<PhylumActionQueueState, List<QueuedAction<PhylumAccount>>>((state) => state.actions);
|
||||
final updates = actions.where((action) => action.action is! ResourceUploadAction).toList(growable: false);
|
||||
final updates = actions.where((action) => action.action is! ResourceUploadAction && action.status is! ActionStatusError).toList(growable: false);
|
||||
|
||||
return SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:phylum/ui/sync/sliver_changes.dart';
|
||||
import 'package:phylum/ui/sync/sliver_updates.dart';
|
||||
import 'package:phylum/ui/sync/sliver_offline.dart';
|
||||
import 'package:phylum/ui/sync/sliver_uploads.dart';
|
||||
import 'package:phylum/ui/sync/sliver_downloads.dart';
|
||||
|
||||
@@ -41,6 +42,6 @@ class SyncDialog extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget buildContents(BuildContext context) => const CustomScrollView(
|
||||
slivers: [DownloadsSliver(), ErrorsSliver(), UploadsSliver(), UpdatesSliver()],
|
||||
slivers: [OfflineSliver(), DownloadsSliver(), ErrorsSliver(), UploadsSliver(), UpdatesSliver()],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user