mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 02:44:55 +00:00
Add FunctionType enum and ValueModel class
- Added FunctionType enum with values Boolean, Enum, Integer, Raw, String. - Introduced ValueModel class to handle unit, min, max, scale, and step values for functions in FunctionModel.
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
|
||||
class FunctionModel {
|
||||
String? code;
|
||||
String? type;
|
||||
String? values;
|
||||
FunctionType? type;
|
||||
ValueModel? values;
|
||||
|
||||
FunctionModel({
|
||||
required this.code,
|
||||
@ -25,3 +27,41 @@ class FunctionModel {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//"values": "{\"unit\":\"\",\"min\":1,\"max\":10,\"scale\":0,\"step\":1}",
|
||||
|
||||
class ValueModel {
|
||||
String? unit;
|
||||
int? min;
|
||||
int? max;
|
||||
int? scale;
|
||||
int? step;
|
||||
|
||||
ValueModel({
|
||||
required this.unit,
|
||||
required this.min,
|
||||
required this.max,
|
||||
required this.scale,
|
||||
required this.step,
|
||||
});
|
||||
|
||||
factory ValueModel.fromJson(Map<String, dynamic> json) {
|
||||
return ValueModel(
|
||||
unit: json['unit'],
|
||||
min: json['min'],
|
||||
max: json['max'],
|
||||
scale: json['scale'],
|
||||
step: json['step'],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'unit': unit,
|
||||
'min': min,
|
||||
'max': max,
|
||||
'scale': scale,
|
||||
'step': step,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user