mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-08 00:45:13 +08:00
SyncButton: Show a different icon on error
This commit is contained in:
lib
@ -45,6 +45,7 @@ class Repository with ChangeNotifier {
|
||||
String repoPath;
|
||||
|
||||
SyncStatus syncStatus = SyncStatus.Unknown;
|
||||
String syncStatusError = "";
|
||||
int numChanges = 0;
|
||||
|
||||
bool get hasJournalEntries {
|
||||
@ -184,6 +185,7 @@ class Repository with ChangeNotifier {
|
||||
} catch (e, stacktrace) {
|
||||
Log.e("Failed to Sync", ex: e, stacktrace: stacktrace);
|
||||
syncStatus = SyncStatus.Error;
|
||||
syncStatusError = e.toString();
|
||||
notifyListeners();
|
||||
if (shouldLogGitException(e)) {
|
||||
await logException(e, stacktrace);
|
||||
|
@ -74,6 +74,17 @@ class _SyncButtonState extends State<SyncButton> {
|
||||
);
|
||||
}
|
||||
|
||||
if (repo.syncStatus == SyncStatus.Error) {
|
||||
return GitPendingChangesBadge(
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.cloud_off),
|
||||
onPressed: () async {
|
||||
_syncRepo();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return GitPendingChangesBadge(
|
||||
child: IconButton(
|
||||
icon: Icon(_syncStatusIcon()),
|
||||
|
Reference in New Issue
Block a user