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:
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
1099
packages/chicken/lib/presentation/widget/sdui/form/ts1 copy.json
Normal file
1099
packages/chicken/lib/presentation/widget/sdui/form/ts1 copy.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user