refactor: update text form field model to use dynamic value type, enhance condition evaluator for step index extraction, and improve SDK path formatting
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -11,14 +11,14 @@ abstract class TextFormFieldSDUIModel with _$TextFormFieldSDUIModel {
|
||||
String? hintText,
|
||||
String? variant,
|
||||
String? keyboardType,
|
||||
String? value,
|
||||
dynamic value,
|
||||
int? maxLength,
|
||||
int? minLine,
|
||||
int? maxLine,
|
||||
bool? required,
|
||||
bool? enabled,
|
||||
bool? readonly,
|
||||
bool? commaSperator,
|
||||
bool? commaSeparator,
|
||||
bool? decimal,
|
||||
int? decimalPlaces,
|
||||
String? type,
|
||||
|
||||
@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$TextFormFieldSDUIModel {
|
||||
|
||||
String? get key; String? get label; String? get hintText; String? get variant; String? get keyboardType; String? get value; int? get maxLength; int? get minLine; int? get maxLine; bool? get required; bool? get enabled; bool? get readonly; bool? get commaSperator; bool? get decimal; int? get decimalPlaces; String? get type;
|
||||
String? get key; String? get label; String? get hintText; String? get variant; String? get keyboardType; dynamic get value; int? get maxLength; int? get minLine; int? get maxLine; bool? get required; bool? get enabled; bool? get readonly; bool? get commaSeparator; bool? get decimal; int? get decimalPlaces; String? get type;
|
||||
/// Create a copy of TextFormFieldSDUIModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -28,16 +28,16 @@ $TextFormFieldSDUIModelCopyWith<TextFormFieldSDUIModel> get copyWith => _$TextFo
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is TextFormFieldSDUIModel&&(identical(other.key, key) || other.key == key)&&(identical(other.label, label) || other.label == label)&&(identical(other.hintText, hintText) || other.hintText == hintText)&&(identical(other.variant, variant) || other.variant == variant)&&(identical(other.keyboardType, keyboardType) || other.keyboardType == keyboardType)&&(identical(other.value, value) || other.value == value)&&(identical(other.maxLength, maxLength) || other.maxLength == maxLength)&&(identical(other.minLine, minLine) || other.minLine == minLine)&&(identical(other.maxLine, maxLine) || other.maxLine == maxLine)&&(identical(other.required, required) || other.required == required)&&(identical(other.enabled, enabled) || other.enabled == enabled)&&(identical(other.readonly, readonly) || other.readonly == readonly)&&(identical(other.commaSperator, commaSperator) || other.commaSperator == commaSperator)&&(identical(other.decimal, decimal) || other.decimal == decimal)&&(identical(other.decimalPlaces, decimalPlaces) || other.decimalPlaces == decimalPlaces)&&(identical(other.type, type) || other.type == type));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is TextFormFieldSDUIModel&&(identical(other.key, key) || other.key == key)&&(identical(other.label, label) || other.label == label)&&(identical(other.hintText, hintText) || other.hintText == hintText)&&(identical(other.variant, variant) || other.variant == variant)&&(identical(other.keyboardType, keyboardType) || other.keyboardType == keyboardType)&&const DeepCollectionEquality().equals(other.value, value)&&(identical(other.maxLength, maxLength) || other.maxLength == maxLength)&&(identical(other.minLine, minLine) || other.minLine == minLine)&&(identical(other.maxLine, maxLine) || other.maxLine == maxLine)&&(identical(other.required, required) || other.required == required)&&(identical(other.enabled, enabled) || other.enabled == enabled)&&(identical(other.readonly, readonly) || other.readonly == readonly)&&(identical(other.commaSeparator, commaSeparator) || other.commaSeparator == commaSeparator)&&(identical(other.decimal, decimal) || other.decimal == decimal)&&(identical(other.decimalPlaces, decimalPlaces) || other.decimalPlaces == decimalPlaces)&&(identical(other.type, type) || other.type == type));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,key,label,hintText,variant,keyboardType,value,maxLength,minLine,maxLine,required,enabled,readonly,commaSperator,decimal,decimalPlaces,type);
|
||||
int get hashCode => Object.hash(runtimeType,key,label,hintText,variant,keyboardType,const DeepCollectionEquality().hash(value),maxLength,minLine,maxLine,required,enabled,readonly,commaSeparator,decimal,decimalPlaces,type);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'TextFormFieldSDUIModel(key: $key, label: $label, hintText: $hintText, variant: $variant, keyboardType: $keyboardType, value: $value, maxLength: $maxLength, minLine: $minLine, maxLine: $maxLine, required: $required, enabled: $enabled, readonly: $readonly, commaSperator: $commaSperator, decimal: $decimal, decimalPlaces: $decimalPlaces, type: $type)';
|
||||
return 'TextFormFieldSDUIModel(key: $key, label: $label, hintText: $hintText, variant: $variant, keyboardType: $keyboardType, value: $value, maxLength: $maxLength, minLine: $minLine, maxLine: $maxLine, required: $required, enabled: $enabled, readonly: $readonly, commaSeparator: $commaSeparator, decimal: $decimal, decimalPlaces: $decimalPlaces, type: $type)';
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ abstract mixin class $TextFormFieldSDUIModelCopyWith<$Res> {
|
||||
factory $TextFormFieldSDUIModelCopyWith(TextFormFieldSDUIModel value, $Res Function(TextFormFieldSDUIModel) _then) = _$TextFormFieldSDUIModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String? key, String? label, String? hintText, String? variant, String? keyboardType, String? value, int? maxLength, int? minLine, int? maxLine, bool? required, bool? enabled, bool? readonly, bool? commaSperator, bool? decimal, int? decimalPlaces, String? type
|
||||
String? key, String? label, String? hintText, String? variant, String? keyboardType, dynamic value, int? maxLength, int? minLine, int? maxLine, bool? required, bool? enabled, bool? readonly, bool? commaSeparator, bool? decimal, int? decimalPlaces, String? type
|
||||
});
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class _$TextFormFieldSDUIModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of TextFormFieldSDUIModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? key = freezed,Object? label = freezed,Object? hintText = freezed,Object? variant = freezed,Object? keyboardType = freezed,Object? value = freezed,Object? maxLength = freezed,Object? minLine = freezed,Object? maxLine = freezed,Object? required = freezed,Object? enabled = freezed,Object? readonly = freezed,Object? commaSperator = freezed,Object? decimal = freezed,Object? decimalPlaces = freezed,Object? type = freezed,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? key = freezed,Object? label = freezed,Object? hintText = freezed,Object? variant = freezed,Object? keyboardType = freezed,Object? value = freezed,Object? maxLength = freezed,Object? minLine = freezed,Object? maxLine = freezed,Object? required = freezed,Object? enabled = freezed,Object? readonly = freezed,Object? commaSeparator = freezed,Object? decimal = freezed,Object? decimalPlaces = freezed,Object? type = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
|
||||
as String?,label: freezed == label ? _self.label : label // ignore: cast_nullable_to_non_nullable
|
||||
@@ -73,13 +73,13 @@ as String?,hintText: freezed == hintText ? _self.hintText : hintText // ignore:
|
||||
as String?,variant: freezed == variant ? _self.variant : variant // ignore: cast_nullable_to_non_nullable
|
||||
as String?,keyboardType: freezed == keyboardType ? _self.keyboardType : keyboardType // ignore: cast_nullable_to_non_nullable
|
||||
as String?,value: freezed == value ? _self.value : value // ignore: cast_nullable_to_non_nullable
|
||||
as String?,maxLength: freezed == maxLength ? _self.maxLength : maxLength // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,maxLength: freezed == maxLength ? _self.maxLength : maxLength // ignore: cast_nullable_to_non_nullable
|
||||
as int?,minLine: freezed == minLine ? _self.minLine : minLine // ignore: cast_nullable_to_non_nullable
|
||||
as int?,maxLine: freezed == maxLine ? _self.maxLine : maxLine // ignore: cast_nullable_to_non_nullable
|
||||
as int?,required: freezed == required ? _self.required : required // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,enabled: freezed == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,readonly: freezed == readonly ? _self.readonly : readonly // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,commaSperator: freezed == commaSperator ? _self.commaSperator : commaSperator // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,commaSeparator: freezed == commaSeparator ? _self.commaSeparator : commaSeparator // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,decimal: freezed == decimal ? _self.decimal : decimal // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,decimalPlaces: freezed == decimalPlaces ? _self.decimalPlaces : decimalPlaces // ignore: cast_nullable_to_non_nullable
|
||||
as int?,type: freezed == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
||||
@@ -168,10 +168,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? key, String? label, String? hintText, String? variant, String? keyboardType, String? value, int? maxLength, int? minLine, int? maxLine, bool? required, bool? enabled, bool? readonly, bool? commaSperator, bool? decimal, int? decimalPlaces, String? type)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? key, String? label, String? hintText, String? variant, String? keyboardType, dynamic value, int? maxLength, int? minLine, int? maxLine, bool? required, bool? enabled, bool? readonly, bool? commaSeparator, bool? decimal, int? decimalPlaces, String? type)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _TextFormFieldSDUIModel() when $default != null:
|
||||
return $default(_that.key,_that.label,_that.hintText,_that.variant,_that.keyboardType,_that.value,_that.maxLength,_that.minLine,_that.maxLine,_that.required,_that.enabled,_that.readonly,_that.commaSperator,_that.decimal,_that.decimalPlaces,_that.type);case _:
|
||||
return $default(_that.key,_that.label,_that.hintText,_that.variant,_that.keyboardType,_that.value,_that.maxLength,_that.minLine,_that.maxLine,_that.required,_that.enabled,_that.readonly,_that.commaSeparator,_that.decimal,_that.decimalPlaces,_that.type);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -189,10 +189,10 @@ return $default(_that.key,_that.label,_that.hintText,_that.variant,_that.keyboar
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? key, String? label, String? hintText, String? variant, String? keyboardType, String? value, int? maxLength, int? minLine, int? maxLine, bool? required, bool? enabled, bool? readonly, bool? commaSperator, bool? decimal, int? decimalPlaces, String? type) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? key, String? label, String? hintText, String? variant, String? keyboardType, dynamic value, int? maxLength, int? minLine, int? maxLine, bool? required, bool? enabled, bool? readonly, bool? commaSeparator, bool? decimal, int? decimalPlaces, String? type) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _TextFormFieldSDUIModel():
|
||||
return $default(_that.key,_that.label,_that.hintText,_that.variant,_that.keyboardType,_that.value,_that.maxLength,_that.minLine,_that.maxLine,_that.required,_that.enabled,_that.readonly,_that.commaSperator,_that.decimal,_that.decimalPlaces,_that.type);case _:
|
||||
return $default(_that.key,_that.label,_that.hintText,_that.variant,_that.keyboardType,_that.value,_that.maxLength,_that.minLine,_that.maxLine,_that.required,_that.enabled,_that.readonly,_that.commaSeparator,_that.decimal,_that.decimalPlaces,_that.type);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -209,10 +209,10 @@ return $default(_that.key,_that.label,_that.hintText,_that.variant,_that.keyboar
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? key, String? label, String? hintText, String? variant, String? keyboardType, String? value, int? maxLength, int? minLine, int? maxLine, bool? required, bool? enabled, bool? readonly, bool? commaSperator, bool? decimal, int? decimalPlaces, String? type)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? key, String? label, String? hintText, String? variant, String? keyboardType, dynamic value, int? maxLength, int? minLine, int? maxLine, bool? required, bool? enabled, bool? readonly, bool? commaSeparator, bool? decimal, int? decimalPlaces, String? type)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _TextFormFieldSDUIModel() when $default != null:
|
||||
return $default(_that.key,_that.label,_that.hintText,_that.variant,_that.keyboardType,_that.value,_that.maxLength,_that.minLine,_that.maxLine,_that.required,_that.enabled,_that.readonly,_that.commaSperator,_that.decimal,_that.decimalPlaces,_that.type);case _:
|
||||
return $default(_that.key,_that.label,_that.hintText,_that.variant,_that.keyboardType,_that.value,_that.maxLength,_that.minLine,_that.maxLine,_that.required,_that.enabled,_that.readonly,_that.commaSeparator,_that.decimal,_that.decimalPlaces,_that.type);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -224,7 +224,7 @@ return $default(_that.key,_that.label,_that.hintText,_that.variant,_that.keyboar
|
||||
@JsonSerializable()
|
||||
|
||||
class _TextFormFieldSDUIModel implements TextFormFieldSDUIModel {
|
||||
const _TextFormFieldSDUIModel({this.key, this.label, this.hintText, this.variant, this.keyboardType, this.value, this.maxLength, this.minLine, this.maxLine, this.required, this.enabled, this.readonly, this.commaSperator, this.decimal, this.decimalPlaces, this.type});
|
||||
const _TextFormFieldSDUIModel({this.key, this.label, this.hintText, this.variant, this.keyboardType, this.value, this.maxLength, this.minLine, this.maxLine, this.required, this.enabled, this.readonly, this.commaSeparator, this.decimal, this.decimalPlaces, this.type});
|
||||
factory _TextFormFieldSDUIModel.fromJson(Map<String, dynamic> json) => _$TextFormFieldSDUIModelFromJson(json);
|
||||
|
||||
@override final String? key;
|
||||
@@ -232,14 +232,14 @@ class _TextFormFieldSDUIModel implements TextFormFieldSDUIModel {
|
||||
@override final String? hintText;
|
||||
@override final String? variant;
|
||||
@override final String? keyboardType;
|
||||
@override final String? value;
|
||||
@override final dynamic value;
|
||||
@override final int? maxLength;
|
||||
@override final int? minLine;
|
||||
@override final int? maxLine;
|
||||
@override final bool? required;
|
||||
@override final bool? enabled;
|
||||
@override final bool? readonly;
|
||||
@override final bool? commaSperator;
|
||||
@override final bool? commaSeparator;
|
||||
@override final bool? decimal;
|
||||
@override final int? decimalPlaces;
|
||||
@override final String? type;
|
||||
@@ -257,16 +257,16 @@ Map<String, dynamic> toJson() {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _TextFormFieldSDUIModel&&(identical(other.key, key) || other.key == key)&&(identical(other.label, label) || other.label == label)&&(identical(other.hintText, hintText) || other.hintText == hintText)&&(identical(other.variant, variant) || other.variant == variant)&&(identical(other.keyboardType, keyboardType) || other.keyboardType == keyboardType)&&(identical(other.value, value) || other.value == value)&&(identical(other.maxLength, maxLength) || other.maxLength == maxLength)&&(identical(other.minLine, minLine) || other.minLine == minLine)&&(identical(other.maxLine, maxLine) || other.maxLine == maxLine)&&(identical(other.required, required) || other.required == required)&&(identical(other.enabled, enabled) || other.enabled == enabled)&&(identical(other.readonly, readonly) || other.readonly == readonly)&&(identical(other.commaSperator, commaSperator) || other.commaSperator == commaSperator)&&(identical(other.decimal, decimal) || other.decimal == decimal)&&(identical(other.decimalPlaces, decimalPlaces) || other.decimalPlaces == decimalPlaces)&&(identical(other.type, type) || other.type == type));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _TextFormFieldSDUIModel&&(identical(other.key, key) || other.key == key)&&(identical(other.label, label) || other.label == label)&&(identical(other.hintText, hintText) || other.hintText == hintText)&&(identical(other.variant, variant) || other.variant == variant)&&(identical(other.keyboardType, keyboardType) || other.keyboardType == keyboardType)&&const DeepCollectionEquality().equals(other.value, value)&&(identical(other.maxLength, maxLength) || other.maxLength == maxLength)&&(identical(other.minLine, minLine) || other.minLine == minLine)&&(identical(other.maxLine, maxLine) || other.maxLine == maxLine)&&(identical(other.required, required) || other.required == required)&&(identical(other.enabled, enabled) || other.enabled == enabled)&&(identical(other.readonly, readonly) || other.readonly == readonly)&&(identical(other.commaSeparator, commaSeparator) || other.commaSeparator == commaSeparator)&&(identical(other.decimal, decimal) || other.decimal == decimal)&&(identical(other.decimalPlaces, decimalPlaces) || other.decimalPlaces == decimalPlaces)&&(identical(other.type, type) || other.type == type));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,key,label,hintText,variant,keyboardType,value,maxLength,minLine,maxLine,required,enabled,readonly,commaSperator,decimal,decimalPlaces,type);
|
||||
int get hashCode => Object.hash(runtimeType,key,label,hintText,variant,keyboardType,const DeepCollectionEquality().hash(value),maxLength,minLine,maxLine,required,enabled,readonly,commaSeparator,decimal,decimalPlaces,type);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'TextFormFieldSDUIModel(key: $key, label: $label, hintText: $hintText, variant: $variant, keyboardType: $keyboardType, value: $value, maxLength: $maxLength, minLine: $minLine, maxLine: $maxLine, required: $required, enabled: $enabled, readonly: $readonly, commaSperator: $commaSperator, decimal: $decimal, decimalPlaces: $decimalPlaces, type: $type)';
|
||||
return 'TextFormFieldSDUIModel(key: $key, label: $label, hintText: $hintText, variant: $variant, keyboardType: $keyboardType, value: $value, maxLength: $maxLength, minLine: $minLine, maxLine: $maxLine, required: $required, enabled: $enabled, readonly: $readonly, commaSeparator: $commaSeparator, decimal: $decimal, decimalPlaces: $decimalPlaces, type: $type)';
|
||||
}
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ abstract mixin class _$TextFormFieldSDUIModelCopyWith<$Res> implements $TextForm
|
||||
factory _$TextFormFieldSDUIModelCopyWith(_TextFormFieldSDUIModel value, $Res Function(_TextFormFieldSDUIModel) _then) = __$TextFormFieldSDUIModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String? key, String? label, String? hintText, String? variant, String? keyboardType, String? value, int? maxLength, int? minLine, int? maxLine, bool? required, bool? enabled, bool? readonly, bool? commaSperator, bool? decimal, int? decimalPlaces, String? type
|
||||
String? key, String? label, String? hintText, String? variant, String? keyboardType, dynamic value, int? maxLength, int? minLine, int? maxLine, bool? required, bool? enabled, bool? readonly, bool? commaSeparator, bool? decimal, int? decimalPlaces, String? type
|
||||
});
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ class __$TextFormFieldSDUIModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of TextFormFieldSDUIModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? key = freezed,Object? label = freezed,Object? hintText = freezed,Object? variant = freezed,Object? keyboardType = freezed,Object? value = freezed,Object? maxLength = freezed,Object? minLine = freezed,Object? maxLine = freezed,Object? required = freezed,Object? enabled = freezed,Object? readonly = freezed,Object? commaSperator = freezed,Object? decimal = freezed,Object? decimalPlaces = freezed,Object? type = freezed,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? key = freezed,Object? label = freezed,Object? hintText = freezed,Object? variant = freezed,Object? keyboardType = freezed,Object? value = freezed,Object? maxLength = freezed,Object? minLine = freezed,Object? maxLine = freezed,Object? required = freezed,Object? enabled = freezed,Object? readonly = freezed,Object? commaSeparator = freezed,Object? decimal = freezed,Object? decimalPlaces = freezed,Object? type = freezed,}) {
|
||||
return _then(_TextFormFieldSDUIModel(
|
||||
key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
|
||||
as String?,label: freezed == label ? _self.label : label // ignore: cast_nullable_to_non_nullable
|
||||
@@ -302,13 +302,13 @@ as String?,hintText: freezed == hintText ? _self.hintText : hintText // ignore:
|
||||
as String?,variant: freezed == variant ? _self.variant : variant // ignore: cast_nullable_to_non_nullable
|
||||
as String?,keyboardType: freezed == keyboardType ? _self.keyboardType : keyboardType // ignore: cast_nullable_to_non_nullable
|
||||
as String?,value: freezed == value ? _self.value : value // ignore: cast_nullable_to_non_nullable
|
||||
as String?,maxLength: freezed == maxLength ? _self.maxLength : maxLength // ignore: cast_nullable_to_non_nullable
|
||||
as dynamic,maxLength: freezed == maxLength ? _self.maxLength : maxLength // ignore: cast_nullable_to_non_nullable
|
||||
as int?,minLine: freezed == minLine ? _self.minLine : minLine // ignore: cast_nullable_to_non_nullable
|
||||
as int?,maxLine: freezed == maxLine ? _self.maxLine : maxLine // ignore: cast_nullable_to_non_nullable
|
||||
as int?,required: freezed == required ? _self.required : required // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,enabled: freezed == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,readonly: freezed == readonly ? _self.readonly : readonly // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,commaSperator: freezed == commaSperator ? _self.commaSperator : commaSperator // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,commaSeparator: freezed == commaSeparator ? _self.commaSeparator : commaSeparator // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,decimal: freezed == decimal ? _self.decimal : decimal // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,decimalPlaces: freezed == decimalPlaces ? _self.decimalPlaces : decimalPlaces // ignore: cast_nullable_to_non_nullable
|
||||
as int?,type: freezed == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
||||
|
||||
@@ -14,14 +14,14 @@ _TextFormFieldSDUIModel _$TextFormFieldSDUIModelFromJson(
|
||||
hintText: json['hint_text'] as String?,
|
||||
variant: json['variant'] as String?,
|
||||
keyboardType: json['keyboard_type'] as String?,
|
||||
value: json['value'] as String?,
|
||||
value: json['value'],
|
||||
maxLength: (json['max_length'] as num?)?.toInt(),
|
||||
minLine: (json['min_line'] as num?)?.toInt(),
|
||||
maxLine: (json['max_line'] as num?)?.toInt(),
|
||||
required: json['required'] as bool?,
|
||||
enabled: json['enabled'] as bool?,
|
||||
readonly: json['readonly'] as bool?,
|
||||
commaSperator: json['comma_sperator'] as bool?,
|
||||
commaSeparator: json['comma_separator'] as bool?,
|
||||
decimal: json['decimal'] as bool?,
|
||||
decimalPlaces: (json['decimal_places'] as num?)?.toInt(),
|
||||
type: json['type'] as String?,
|
||||
@@ -42,7 +42,7 @@ Map<String, dynamic> _$TextFormFieldSDUIModelToJson(
|
||||
'required': instance.required,
|
||||
'enabled': instance.enabled,
|
||||
'readonly': instance.readonly,
|
||||
'comma_sperator': instance.commaSperator,
|
||||
'comma_separator': instance.commaSeparator,
|
||||
'decimal': instance.decimal,
|
||||
'decimal_places': instance.decimalPlaces,
|
||||
'type': instance.type,
|
||||
|
||||
@@ -7,24 +7,23 @@ import 'model/text_form_field_sdui_model.dart';
|
||||
Widget textFormFiledSDUI({
|
||||
required TextFormFieldSDUIModel model,
|
||||
TextEditingController? controller,
|
||||
ValueChanged<String>? onChanged,
|
||||
}) {
|
||||
List<TextInputFormatter>? inputFormatters = [];
|
||||
TextInputType? keyboardType;
|
||||
VoidCallback? onTap;
|
||||
bool isReadonly = model.readonly ?? false;
|
||||
String? initValue;
|
||||
|
||||
final textController = controller ?? TextEditingController(text: model.value);
|
||||
|
||||
if (model.type == 'date_picker') {
|
||||
// برای date picker، readonly میکنیم و onTap اضافه میکنیم
|
||||
isReadonly = true;
|
||||
|
||||
onTap = () {
|
||||
// پارس کردن تاریخ فعلی اگر وجود دارد
|
||||
Jalali? initialDate;
|
||||
if (textController.text.isNotEmpty) {
|
||||
try {
|
||||
// فرض میکنیم تاریخ به فرمت '1404/01/01' یا '1404-01-01' است
|
||||
final dateStr = textController.text.replaceAll('-', '/');
|
||||
final parts = dateStr.split('/');
|
||||
if (parts.length == 3) {
|
||||
@@ -40,16 +39,15 @@ Widget textFormFiledSDUI({
|
||||
}
|
||||
}
|
||||
|
||||
// اگر نتوانستیم parse کنیم، از تاریخ امروز استفاده میکنیم
|
||||
initialDate ??= Jalali.now();
|
||||
|
||||
// نمایش date picker
|
||||
Get.bottomSheet(
|
||||
modalDatePicker(
|
||||
initialDate: initialDate,
|
||||
onDateSelected: (selectedDate) {
|
||||
// فرمت کردن تاریخ و قرار دادن در controller
|
||||
textController.text = selectedDate.formatCompactDate();
|
||||
final formattedDate = selectedDate.formatCompactDate();
|
||||
textController.text = formattedDate;
|
||||
onChanged?.call(formattedDate);
|
||||
},
|
||||
),
|
||||
isScrollControlled: true,
|
||||
@@ -67,16 +65,29 @@ Widget textFormFiledSDUI({
|
||||
}
|
||||
}
|
||||
|
||||
if ((model.commaSperator ?? false) &&
|
||||
(model.decimal == null || model.decimal == false)) {
|
||||
if ((model.commaSeparator ?? false) && (model.decimal == null || model.decimal == false)) {
|
||||
inputFormatters.add(SeparatorInputFormatter());
|
||||
|
||||
// FIX: اگر مقدار اولیه وجود دارد، باید آن را هم فرمت کنیم تا با فرمتر هماهنگ باشد
|
||||
if (model.value != null) {
|
||||
try {
|
||||
String tmp = model.value.replaceAll(',', '');
|
||||
if (model.commaSeparator ?? false) {
|
||||
textController.text = tmp.replaceAll(',', '').separatedByComma;
|
||||
} else {
|
||||
textController.text = int.tryParse(tmp).toString();
|
||||
}
|
||||
} catch (e) {
|
||||
// اگر پارس نشد، همان مقدار اصلی میماند
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return RTextField(
|
||||
controller: textController,
|
||||
onChanged: (data) {
|
||||
iLog(data);
|
||||
onChanged?.call(data);
|
||||
},
|
||||
onTap: onTap,
|
||||
label: model.label,
|
||||
|
||||
Reference in New Issue
Block a user