You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
896 B
36 lines
896 B
16 hours ago
|
// sync_progress_state.dart
|
||
|
import 'package:get/get.dart';
|
||
|
|
||
|
class SyncProgressState {
|
||
|
final RxBool isSyncing = false.obs;
|
||
|
final RxString currentStep = ''.obs;
|
||
|
final RxDouble progress = 0.0.obs;
|
||
|
final RxInt totalSteps = 0.obs;
|
||
|
final RxInt completedSteps = 0.obs;
|
||
|
|
||
|
void startSync(int totalSteps) {
|
||
|
isSyncing.value = true;
|
||
|
this.totalSteps.value = totalSteps;
|
||
|
completedSteps.value = 0;
|
||
|
progress.value = 0.0;
|
||
|
currentStep.value = '开始同步...';
|
||
|
}
|
||
|
|
||
|
void updateProgress(String step, int completed) {
|
||
|
completedSteps.value = completed;
|
||
|
progress.value = completed / totalSteps.value;
|
||
|
currentStep.value = step;
|
||
|
}
|
||
|
|
||
|
void completeSync() {
|
||
|
isSyncing.value = false;
|
||
|
currentStep.value = '同步完成';
|
||
|
progress.value = 1.0;
|
||
|
}
|
||
|
|
||
|
void errorSync(String error) {
|
||
|
isSyncing.value = false;
|
||
|
currentStep.value = '同步失败: $error';
|
||
|
}
|
||
|
}
|