Added JsonUrl (to test)
This commit is contained in:
parent
0f325605e5
commit
09c8cc7cfd
@ -17,6 +17,8 @@ IconData getResourceIcon(elementType) {
|
||||
return Icons.picture_as_pdf_outlined;
|
||||
case ResourceType.Json:
|
||||
return Icons.file_present_outlined;
|
||||
case ResourceType.JsonUrl:
|
||||
return Icons.file_present_rounded;
|
||||
}
|
||||
return Icons.announcement;
|
||||
}
|
||||
@ -105,12 +105,12 @@ class _UploadOnlineResourceContainerState extends State<UploadOnlineResourceCont
|
||||
child: Container(
|
||||
width: size.width *0.35, // TODO GET SIZE
|
||||
child: RoundedInputField(
|
||||
hintText: "Url de l'image ou de la vidéo youtube",
|
||||
hintText: "Url de l'image, de la vidéo youtube ou du fichier json",
|
||||
//icon: widget.resourceDTO.type == ResourceType.ImageUrl ? Icons.image : Icons.ondemand_video, // TODO: TBD
|
||||
onChanged: (String text) {
|
||||
widget.resourceDTO.url = text; // TODO check if ok
|
||||
widget.onChanged(widget.resourceDTO);
|
||||
widget.resourceDTO.type = _isYouTubeVideo(widget.resourceDTO.url!) ? ResourceType.VideoUrl : ResourceType.ImageUrl; // ou VideoUrl
|
||||
widget.resourceDTO.type = _isYouTubeVideo(widget.resourceDTO.url!) ? ResourceType.VideoUrl : widget.resourceDTO.url!.endsWith("json") || widget.resourceDTO.url!.endsWith("php") ? ResourceType.JsonUrl : ResourceType.ImageUrl; // ou VideoUrl
|
||||
print("URL OR NOOOOT ?");
|
||||
print(widget.resourceDTO.type);
|
||||
},
|
||||
|
||||
@ -36,7 +36,7 @@ class _AgendaConfigState extends State<AgendaConfig> {
|
||||
return ResourceInputContainer(
|
||||
label: "Fichier JSON :",
|
||||
initialValue: agendaDTO.resourceId == null ? '': agendaDTO.resourceId,
|
||||
inResourceTypes: [ResourceType.Json],
|
||||
inResourceTypes: [ResourceType.Json, ResourceType.JsonUrl],
|
||||
onChanged: (ResourceDTO resourceDTO) {
|
||||
agendaDTO.resourceUrl = resourceDTO.url;
|
||||
agendaDTO.resourceId = resourceDTO.id;
|
||||
|
||||
@ -221,7 +221,8 @@ class _BodyState extends State<Body> {
|
||||
ResourceType.Video,
|
||||
ResourceType.VideoUrl,
|
||||
ResourceType.Pdf,
|
||||
ResourceType.Json
|
||||
ResourceType.Json,
|
||||
ResourceType.JsonUrl
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
@ -101,6 +101,9 @@ getElementForResource(dynamic resourceDTO, AppContext appContext) {
|
||||
|
||||
case ResourceType.Json:
|
||||
return Text("Fichier json - aucune visualisation possible");
|
||||
|
||||
case ResourceType.JsonUrl:
|
||||
return SelectableText(resourceDTO.url!);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,18 @@ import 'package:openapi_generator_annotations/openapi_generator_annotations.dart
|
||||
outputDirectory: 'manager_api_new')
|
||||
class Example extends OpenapiGeneratorConfig {}
|
||||
|
||||
|
||||
/*@Openapi(
|
||||
additionalProperties:
|
||||
DioProperties(pubName: 'manager_api_new', pubAuthor: 'Fransolet Thomas'),
|
||||
inputSpec:
|
||||
InputSpec(path: 'lib/api/swagger.yaml'),
|
||||
generatorName: Generator.dart,
|
||||
runSourceGenOnOutput: true,
|
||||
outputDirectory: 'manager_api_new',
|
||||
)
|
||||
class Example {}*/
|
||||
|
||||
/*
|
||||
RUN
|
||||
>flutter pub run build_runner build --delete-conflicting-outputs
|
||||
|
||||
@ -1814,6 +1814,15 @@ components:
|
||||
weatherCity:
|
||||
type: string
|
||||
nullable: true
|
||||
weatherUpdatedDate:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
weatherResult:
|
||||
type: string
|
||||
nullable: true
|
||||
isWeather:
|
||||
type: boolean
|
||||
isDate:
|
||||
type: boolean
|
||||
isHour:
|
||||
@ -1975,6 +1984,7 @@ components:
|
||||
4 = Audio
|
||||
5 = PDF
|
||||
6 = JSON
|
||||
7 = JSONUrl
|
||||
x-enumNames:
|
||||
- Image
|
||||
- Video
|
||||
@ -1983,6 +1993,7 @@ components:
|
||||
- Audio
|
||||
- PDF
|
||||
- JSON
|
||||
- JSONUrl
|
||||
enum:
|
||||
- 0
|
||||
- 1
|
||||
@ -1991,6 +2002,7 @@ components:
|
||||
- 4
|
||||
- 5
|
||||
- 6
|
||||
- 7
|
||||
DeviceDTO:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
@ -2322,7 +2334,9 @@ components:
|
||||
type: string
|
||||
nullable: true
|
||||
resourceType:
|
||||
$ref: '#/components/schemas/ResourceType'
|
||||
nullable: true
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/ResourceType'
|
||||
resourceUrl:
|
||||
type: string
|
||||
nullable: true
|
||||
|
||||
@ -26,7 +26,8 @@ List<ResourceTypeModel> resource_types = [
|
||||
ResourceTypeModel(label: "Vidéo url", type: ResourceType.VideoUrl),
|
||||
ResourceTypeModel(label: "Audio", type: ResourceType.Audio),
|
||||
ResourceTypeModel(label: "PDF", type: ResourceType.Pdf),
|
||||
ResourceTypeModel(label: "JSON", type: ResourceType.Json)
|
||||
ResourceTypeModel(label: "JSON", type: ResourceType.Json),
|
||||
ResourceTypeModel(label: "JSON url", type: ResourceType.JsonUrl)
|
||||
]; // "video url" , "video", {"label": "image"}, "image url", "audio"
|
||||
|
||||
/*
|
||||
|
||||
@ -25,6 +25,9 @@ Name | Type | Description | Notes
|
||||
**loaderImageId** | **String** | | [optional]
|
||||
**loaderImageUrl** | **String** | | [optional]
|
||||
**weatherCity** | **String** | | [optional]
|
||||
**weatherUpdatedDate** | [**DateTime**](DateTime.md) | | [optional]
|
||||
**weatherResult** | **String** | | [optional]
|
||||
**isWeather** | **bool** | | [optional]
|
||||
**isDate** | **bool** | | [optional]
|
||||
**isHour** | **bool** | | [optional]
|
||||
|
||||
|
||||
@ -25,6 +25,9 @@ Name | Type | Description | Notes
|
||||
**loaderImageId** | **String** | | [optional]
|
||||
**loaderImageUrl** | **String** | | [optional]
|
||||
**weatherCity** | **String** | | [optional]
|
||||
**weatherUpdatedDate** | [**DateTime**](DateTime.md) | | [optional]
|
||||
**weatherResult** | **String** | | [optional]
|
||||
**isWeather** | **bool** | | [optional]
|
||||
**isDate** | **bool** | | [optional]
|
||||
**isHour** | **bool** | | [optional]
|
||||
**sections** | [**List<SectionDTO>**](SectionDTO.md) | | [optional] [default to const []]
|
||||
|
||||
@ -30,6 +30,9 @@ class ConfigurationDTO {
|
||||
this.loaderImageId,
|
||||
this.loaderImageUrl,
|
||||
this.weatherCity,
|
||||
this.weatherUpdatedDate,
|
||||
this.weatherResult,
|
||||
this.isWeather,
|
||||
this.isDate,
|
||||
this.isHour,
|
||||
});
|
||||
@ -92,6 +95,18 @@ class ConfigurationDTO {
|
||||
|
||||
String? weatherCity;
|
||||
|
||||
DateTime? weatherUpdatedDate;
|
||||
|
||||
String? weatherResult;
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
/// does not include a default value (using the "default:" property), however, the generated
|
||||
/// source code must fall back to having a nullable type.
|
||||
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||
///
|
||||
bool? isWeather;
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
/// does not include a default value (using the "default:" property), however, the generated
|
||||
@ -127,6 +142,9 @@ class ConfigurationDTO {
|
||||
other.loaderImageId == loaderImageId &&
|
||||
other.loaderImageUrl == loaderImageUrl &&
|
||||
other.weatherCity == weatherCity &&
|
||||
other.weatherUpdatedDate == weatherUpdatedDate &&
|
||||
other.weatherResult == weatherResult &&
|
||||
other.isWeather == isWeather &&
|
||||
other.isDate == isDate &&
|
||||
other.isHour == isHour;
|
||||
|
||||
@ -150,11 +168,14 @@ class ConfigurationDTO {
|
||||
(loaderImageId == null ? 0 : loaderImageId!.hashCode) +
|
||||
(loaderImageUrl == null ? 0 : loaderImageUrl!.hashCode) +
|
||||
(weatherCity == null ? 0 : weatherCity!.hashCode) +
|
||||
(weatherUpdatedDate == null ? 0 : weatherUpdatedDate!.hashCode) +
|
||||
(weatherResult == null ? 0 : weatherResult!.hashCode) +
|
||||
(isWeather == null ? 0 : isWeather!.hashCode) +
|
||||
(isDate == null ? 0 : isDate!.hashCode) +
|
||||
(isHour == null ? 0 : isHour!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, isDate=$isDate, isHour=$isHour]';
|
||||
String toString() => 'ConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, weatherUpdatedDate=$weatherUpdatedDate, weatherResult=$weatherResult, isWeather=$isWeather, isDate=$isDate, isHour=$isHour]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -243,6 +264,21 @@ class ConfigurationDTO {
|
||||
} else {
|
||||
json[r'weatherCity'] = null;
|
||||
}
|
||||
if (this.weatherUpdatedDate != null) {
|
||||
json[r'weatherUpdatedDate'] = this.weatherUpdatedDate!.toUtc().toIso8601String();
|
||||
} else {
|
||||
json[r'weatherUpdatedDate'] = null;
|
||||
}
|
||||
if (this.weatherResult != null) {
|
||||
json[r'weatherResult'] = this.weatherResult;
|
||||
} else {
|
||||
json[r'weatherResult'] = null;
|
||||
}
|
||||
if (this.isWeather != null) {
|
||||
json[r'isWeather'] = this.isWeather;
|
||||
} else {
|
||||
json[r'isWeather'] = null;
|
||||
}
|
||||
if (this.isDate != null) {
|
||||
json[r'isDate'] = this.isDate;
|
||||
} else {
|
||||
@ -296,6 +332,9 @@ class ConfigurationDTO {
|
||||
loaderImageId: mapValueOfType<String>(json, r'loaderImageId'),
|
||||
loaderImageUrl: mapValueOfType<String>(json, r'loaderImageUrl'),
|
||||
weatherCity: mapValueOfType<String>(json, r'weatherCity'),
|
||||
weatherUpdatedDate: mapDateTime(json, r'weatherUpdatedDate', ''),
|
||||
weatherResult: mapValueOfType<String>(json, r'weatherResult'),
|
||||
isWeather: mapValueOfType<bool>(json, r'isWeather'),
|
||||
isDate: mapValueOfType<bool>(json, r'isDate'),
|
||||
isHour: mapValueOfType<bool>(json, r'isHour'),
|
||||
);
|
||||
|
||||
@ -30,6 +30,9 @@ class ExportConfigurationDTO {
|
||||
this.loaderImageId,
|
||||
this.loaderImageUrl,
|
||||
this.weatherCity,
|
||||
this.weatherUpdatedDate,
|
||||
this.weatherResult,
|
||||
this.isWeather,
|
||||
this.isDate,
|
||||
this.isHour,
|
||||
this.sections = const [],
|
||||
@ -94,6 +97,18 @@ class ExportConfigurationDTO {
|
||||
|
||||
String? weatherCity;
|
||||
|
||||
DateTime? weatherUpdatedDate;
|
||||
|
||||
String? weatherResult;
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
/// does not include a default value (using the "default:" property), however, the generated
|
||||
/// source code must fall back to having a nullable type.
|
||||
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||
///
|
||||
bool? isWeather;
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
/// does not include a default value (using the "default:" property), however, the generated
|
||||
@ -133,6 +148,9 @@ class ExportConfigurationDTO {
|
||||
other.loaderImageId == loaderImageId &&
|
||||
other.loaderImageUrl == loaderImageUrl &&
|
||||
other.weatherCity == weatherCity &&
|
||||
other.weatherUpdatedDate == weatherUpdatedDate &&
|
||||
other.weatherResult == weatherResult &&
|
||||
other.isWeather == isWeather &&
|
||||
other.isDate == isDate &&
|
||||
other.isHour == isHour &&
|
||||
other.sections == sections &&
|
||||
@ -158,13 +176,16 @@ class ExportConfigurationDTO {
|
||||
(loaderImageId == null ? 0 : loaderImageId!.hashCode) +
|
||||
(loaderImageUrl == null ? 0 : loaderImageUrl!.hashCode) +
|
||||
(weatherCity == null ? 0 : weatherCity!.hashCode) +
|
||||
(weatherUpdatedDate == null ? 0 : weatherUpdatedDate!.hashCode) +
|
||||
(weatherResult == null ? 0 : weatherResult!.hashCode) +
|
||||
(isWeather == null ? 0 : isWeather!.hashCode) +
|
||||
(isDate == null ? 0 : isDate!.hashCode) +
|
||||
(isHour == null ? 0 : isHour!.hashCode) +
|
||||
(sections == null ? 0 : sections!.hashCode) +
|
||||
(resources == null ? 0 : resources!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ExportConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, isDate=$isDate, isHour=$isHour, sections=$sections, resources=$resources]';
|
||||
String toString() => 'ExportConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, weatherUpdatedDate=$weatherUpdatedDate, weatherResult=$weatherResult, isWeather=$isWeather, isDate=$isDate, isHour=$isHour, sections=$sections, resources=$resources]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -253,6 +274,21 @@ class ExportConfigurationDTO {
|
||||
} else {
|
||||
json[r'weatherCity'] = null;
|
||||
}
|
||||
if (this.weatherUpdatedDate != null) {
|
||||
json[r'weatherUpdatedDate'] = this.weatherUpdatedDate!.toUtc().toIso8601String();
|
||||
} else {
|
||||
json[r'weatherUpdatedDate'] = null;
|
||||
}
|
||||
if (this.weatherResult != null) {
|
||||
json[r'weatherResult'] = this.weatherResult;
|
||||
} else {
|
||||
json[r'weatherResult'] = null;
|
||||
}
|
||||
if (this.isWeather != null) {
|
||||
json[r'isWeather'] = this.isWeather;
|
||||
} else {
|
||||
json[r'isWeather'] = null;
|
||||
}
|
||||
if (this.isDate != null) {
|
||||
json[r'isDate'] = this.isDate;
|
||||
} else {
|
||||
@ -316,6 +352,9 @@ class ExportConfigurationDTO {
|
||||
loaderImageId: mapValueOfType<String>(json, r'loaderImageId'),
|
||||
loaderImageUrl: mapValueOfType<String>(json, r'loaderImageUrl'),
|
||||
weatherCity: mapValueOfType<String>(json, r'weatherCity'),
|
||||
weatherUpdatedDate: mapDateTime(json, r'weatherUpdatedDate', ''),
|
||||
weatherResult: mapValueOfType<String>(json, r'weatherResult'),
|
||||
isWeather: mapValueOfType<bool>(json, r'isWeather'),
|
||||
isDate: mapValueOfType<bool>(json, r'isDate'),
|
||||
isHour: mapValueOfType<bool>(json, r'isHour'),
|
||||
sections: SectionDTO.listFromJson(json[r'sections']),
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
/// 0 = Image 1 = Video 2 = ImageUrl 3 = VideoUrl 4 = Audio 5 = PDF 6 = JSON
|
||||
/// 0 = Image 1 = Video 2 = ImageUrl 3 = VideoUrl 4 = Audio 5 = PDF 6 = JSON 7 = JSONUrl
|
||||
class ResourceType {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const ResourceType._(this.value);
|
||||
@ -30,6 +30,7 @@ class ResourceType {
|
||||
static const Audio = ResourceType._(4);
|
||||
static const Pdf = ResourceType._(5);
|
||||
static const Json = ResourceType._(6);
|
||||
static const JsonUrl = ResourceType._(7);
|
||||
|
||||
/// List of all possible values in this [enum][ResourceType].
|
||||
static const values = <ResourceType>[
|
||||
@ -39,7 +40,8 @@ class ResourceType {
|
||||
VideoUrl,
|
||||
Audio,
|
||||
Pdf,
|
||||
Json
|
||||
Json,
|
||||
JsonUrl
|
||||
];
|
||||
|
||||
static ResourceType? fromJson(dynamic value) => ResourceTypeTypeTransformer().decode(value);
|
||||
@ -86,6 +88,7 @@ class ResourceTypeTypeTransformer {
|
||||
case "Audio": return ResourceType.Audio;
|
||||
case "PDF": return ResourceType.Pdf;
|
||||
case "JSON": return ResourceType.Json;
|
||||
case "JSONUrl": return ResourceType.JsonUrl;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -101,6 +104,7 @@ class ResourceTypeTypeTransformer {
|
||||
case 4: return ResourceType.Audio;
|
||||
case 5: return ResourceType.Pdf;
|
||||
case 6: return ResourceType.Json;
|
||||
case 7: return ResourceType.JsonUrl;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user