feat: refactor SDUI widget model to use sealed classes for type-safe handling, enhance form widget with stepper support, and improve error handling in SDUIFormWidget

This commit is contained in:
2025-12-31 13:36:13 +03:30
parent 8c25e2c65c
commit fb0b817cf9
14 changed files with 4879 additions and 654 deletions

View File

@@ -0,0 +1,38 @@
import 'package:rasadyar_core/core.dart';
class SDUIFormWidgetController extends GetxController {
RxInt currentStep = 0.obs;
int totalSteps = 0;
String? stepperKey;
void initializeStepper(int totalSteps, String? key) {
this.totalSteps = totalSteps;
this.stepperKey = key;
currentStep.value = 0;
}
void nextStep(RxMap<String, dynamic>? state) {
if (currentStep.value < totalSteps - 1) {
currentStep.value++;
if (state != null && stepperKey != null) {
state[stepperKey!] = currentStep.value;
}
}
}
void previousStep(RxMap<String, dynamic>? state) {
if (currentStep.value > 0) {
currentStep.value--;
if (state != null && stepperKey != null) {
state[stepperKey!] = currentStep.value;
}
}
}
bool get canGoNext => currentStep.value < totalSteps - 1;
bool get canGoPrevious => currentStep.value > 0;
bool get isLastStep => currentStep.value == totalSteps - 1;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff