38 lines
1.1 KiB
Dart
38 lines
1.1 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:pj_supermarket_cloud/common/index.dart';
|
|
|
|
class LoadController extends GetxController {
|
|
LoadController({AppControl? appControl})
|
|
: appControl = appControl ?? Get.find<AppControl>(),
|
|
destination = Get.arguments is Map
|
|
? (Get.arguments['destination'] as String? ?? RouteNames.login)
|
|
: RouteNames.login;
|
|
|
|
final AppControl appControl;
|
|
|
|
final String destination;
|
|
|
|
List<AppStartupStepState> get startupSteps => appControl.startupSteps;
|
|
|
|
int get completedCount => appControl.startupCompletedCount;
|
|
|
|
double get progress => appControl.startupProgress;
|
|
|
|
@override
|
|
void onReady() {
|
|
super.onReady();
|
|
// AppControl 由应用入口创建,加载页只展示同一条真实初始化链路,避免重复打开数据库或设备。
|
|
unawaited(
|
|
appControl.initAsync(
|
|
destination: destination,
|
|
force: destination == RouteNames.terminal,
|
|
),
|
|
);
|
|
}
|
|
|
|
Future<void> retry() => appControl.retryStartup(destination: destination);
|
|
}
|