update service generation

This commit is contained in:
Thomas Fransolet 2023-12-22 15:41:51 +01:00
parent 0ffe261e86
commit 6b65bcbf66
14 changed files with 171 additions and 108 deletions

View File

@ -61,8 +61,8 @@ class _ImageInputContainerState extends State<ImageInputContainer> {
child: Padding( child: Padding(
padding: EdgeInsets.only(left: widget.isSmall ? 5 : 10, top: 10, bottom: 10), padding: EdgeInsets.only(left: widget.isSmall ? 5 : 10, top: 10, bottom: 10),
child: Container( child: Container(
width: size.width *0.08, width: 90,
height: size.width *0.08, height: 90,
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
ResourceDTO? result = await showSelectResourceModal( ResourceDTO? result = await showSelectResourceModal(

View File

@ -184,18 +184,21 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
//print(configurationDTO.languages); //print(configurationDTO.languages);
}, },
), ),
/*MultiSelectContainer( ImageInputContainer(
label: "Langues :", label: "Image loader :",
initialValue: configurationDTO.languages != null ? configurationDTO.languages: [], fontSize: 20,
values: languages, initialValue: configurationDTO.loaderImageId,
isMultiple: true, color: kPrimaryColor,
isAtLeastOne: true, onChanged: (ResourceDTO resource) {
onChanged: (value) { if(resource.id == null) {
var tempOutput = new List<String>.from(value); configurationDTO.loaderImageId = null;
configurationDTO.languages = tempOutput; configurationDTO.loaderImageUrl = null;
//print(configurationDTO.languages); } else {
configurationDTO.loaderImageId = resource.id;
configurationDTO.loaderImageUrl = resource.url;
}
}, },
),*/ ),
], ],
), ),
Column( Column(
@ -282,7 +285,7 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
), ),
), ),
ImageInputContainer( ImageInputContainer(
label: "Image :", label: "Image fond d'écran :",
fontSize: 20, fontSize: 20,
initialValue: configurationDTO.imageId, initialValue: configurationDTO.imageId,
color: kPrimaryColor, color: kPrimaryColor,
@ -296,6 +299,14 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
} }
}, },
), ),
StringInputContainer(
label: "Ville météo :",
fontSize: 20,
initialValue: configurationDTO.weatherCity,
onChanged: (value) {
configurationDTO.weatherCity = value;
},
),
]) ])
], ],
), ),

View File

@ -22,21 +22,21 @@ void showNewConfiguration(AppContext appContext, ValueChanged<bool> isImport, Bu
), ),
content: SingleChildScrollView( content: SingleChildScrollView(
child: SizedBox( child: SizedBox(
width: size.width*0.3, width: size.width*0.35,
height: size.height*0.3, height: size.height*0.3,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text("Nouvelle visite", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)), Center(child: Text("Nouvelle configuration", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400))),
Column( Center(
children: [ child: StringInputContainer(
StringInputContainer( label: "Nom :",
label: "Nom :", initialValue: configurationDTO.label,
initialValue: configurationDTO.label, onChanged: (value) {
onChanged: (value) { configurationDTO.label = value;
configurationDTO.label = value; },
}, ),
),
],
), ),
Text("ou"), Text("ou"),
Column( Column(
@ -138,6 +138,10 @@ String filePicker() {
void create(ConfigurationDTO configurationDTO, AppContext appContext, context) async { void create(ConfigurationDTO configurationDTO, AppContext appContext, context) async {
if (configurationDTO.label != null) { if (configurationDTO.label != null) {
configurationDTO.dateCreation = DateTime.now();
configurationDTO.isMobile = false;
configurationDTO.isTablet = false;
configurationDTO.isOffline = false;
configurationDTO.instanceId = (appContext.getContext() as ManagerAppContext).instanceId; configurationDTO.instanceId = (appContext.getContext() as ManagerAppContext).instanceId;
await (appContext.getContext() as ManagerAppContext).clientAPI!.configurationApi!.configurationCreate(configurationDTO); await (appContext.getContext() as ManagerAppContext).clientAPI!.configurationApi!.configurationCreate(configurationDTO);
ManagerAppContext managerAppContext = appContext.getContext(); ManagerAppContext managerAppContext = appContext.getContext();

View File

@ -83,13 +83,10 @@ getElementForResource(dynamic resourceDTO, AppContext appContext) {
} }
);*/ );*/
//return Text("Fichier audio - aucune visualisation possible"); //return Text("Fichier audio - aucune visualisation possible");
break;
case ResourceType.Video: case ResourceType.Video:
return Text("Vidéo locale - aucune visualisation possible"); return Text("Vidéo locale - aucune visualisation possible");
break;
case ResourceType.VideoUrl: case ResourceType.VideoUrl:
return Text(resourceDTO.url); return Text(resourceDTO.url);
break;
} }
} }

View File

@ -122,7 +122,7 @@ class _ResourceBodyGridState extends State<ResourceBodyGrid> {
Expanded( Expanded(
child: GridView.builder( child: GridView.builder(
shrinkWrap: true, shrinkWrap: true,
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6), gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 9),
itemCount: data.length, itemCount: data.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return return

View File

@ -1805,9 +1805,15 @@ components:
nullable: true nullable: true
items: items:
type: string type: string
pinCode: loaderImageId:
type: integer type: string
format: int32 nullable: true
loaderImageUrl:
type: string
nullable: true
weatherCity:
type: string
nullable: true
TranslationDTO: TranslationDTO:
type: object type: object
additionalProperties: false additionalProperties: false

View File

@ -22,7 +22,9 @@ Name | Type | Description | Notes
**isOffline** | **bool** | | [optional] **isOffline** | **bool** | | [optional]
**instanceId** | **String** | | [optional] **instanceId** | **String** | | [optional]
**sectionIds** | **List<String>** | | [optional] [default to const []] **sectionIds** | **List<String>** | | [optional] [default to const []]
**pinCode** | **int** | | [optional] **loaderImageId** | **String** | | [optional]
**loaderImageUrl** | **String** | | [optional]
**weatherCity** | **String** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -22,7 +22,9 @@ Name | Type | Description | Notes
**isOffline** | **bool** | | [optional] **isOffline** | **bool** | | [optional]
**instanceId** | **String** | | [optional] **instanceId** | **String** | | [optional]
**sectionIds** | **List<String>** | | [optional] [default to const []] **sectionIds** | **List<String>** | | [optional] [default to const []]
**pinCode** | **int** | | [optional] **loaderImageId** | **String** | | [optional]
**loaderImageUrl** | **String** | | [optional]
**weatherCity** | **String** | | [optional]
**sections** | [**List<SectionDTO>**](SectionDTO.md) | | [optional] [default to const []] **sections** | [**List<SectionDTO>**](SectionDTO.md) | | [optional] [default to const []]
**resources** | [**List<ResourceDTO>**](ResourceDTO.md) | | [optional] [default to const []] **resources** | [**List<ResourceDTO>**](ResourceDTO.md) | | [optional] [default to const []]

View File

@ -27,7 +27,9 @@ class ConfigurationDTO {
this.isOffline, this.isOffline,
this.instanceId, this.instanceId,
this.sectionIds = const [], this.sectionIds = const [],
this.pinCode, this.loaderImageId,
this.loaderImageUrl,
this.weatherCity,
}); });
String? id; String? id;
@ -82,13 +84,11 @@ class ConfigurationDTO {
List<String>? sectionIds; List<String>? sectionIds;
/// String? loaderImageId;
/// 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 String? loaderImageUrl;
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note. String? weatherCity;
///
int? pinCode;
@override @override
bool operator ==(Object other) => identical(this, other) || other is ConfigurationDTO && bool operator ==(Object other) => identical(this, other) || other is ConfigurationDTO &&
@ -106,7 +106,9 @@ class ConfigurationDTO {
other.isOffline == isOffline && other.isOffline == isOffline &&
other.instanceId == instanceId && other.instanceId == instanceId &&
other.sectionIds == sectionIds && other.sectionIds == sectionIds &&
other.pinCode == pinCode; other.loaderImageId == loaderImageId &&
other.loaderImageUrl == loaderImageUrl &&
other.weatherCity == weatherCity;
@override @override
int get hashCode => int get hashCode =>
@ -125,10 +127,12 @@ class ConfigurationDTO {
(isOffline == null ? 0 : isOffline!.hashCode) + (isOffline == null ? 0 : isOffline!.hashCode) +
(instanceId == null ? 0 : instanceId!.hashCode) + (instanceId == null ? 0 : instanceId!.hashCode) +
(sectionIds == null ? 0 : sectionIds!.hashCode) + (sectionIds == null ? 0 : sectionIds!.hashCode) +
(pinCode == null ? 0 : pinCode!.hashCode); (loaderImageId == null ? 0 : loaderImageId!.hashCode) +
(loaderImageUrl == null ? 0 : loaderImageUrl!.hashCode) +
(weatherCity == null ? 0 : weatherCity!.hashCode);
@override @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, pinCode=$pinCode]'; 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]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -202,10 +206,20 @@ class ConfigurationDTO {
} else { } else {
json[r'sectionIds'] = null; json[r'sectionIds'] = null;
} }
if (this.pinCode != null) { if (this.loaderImageId != null) {
json[r'pinCode'] = this.pinCode; json[r'loaderImageId'] = this.loaderImageId;
} else { } else {
json[r'pinCode'] = null; json[r'loaderImageId'] = null;
}
if (this.loaderImageUrl != null) {
json[r'loaderImageUrl'] = this.loaderImageUrl;
} else {
json[r'loaderImageUrl'] = null;
}
if (this.weatherCity != null) {
json[r'weatherCity'] = this.weatherCity;
} else {
json[r'weatherCity'] = null;
} }
return json; return json;
} }
@ -247,7 +261,9 @@ class ConfigurationDTO {
sectionIds: json[r'sectionIds'] is List sectionIds: json[r'sectionIds'] is List
? (json[r'sectionIds'] as List).cast<String>() ? (json[r'sectionIds'] as List).cast<String>()
: const [], : const [],
pinCode: mapValueOfType<int>(json, r'pinCode'), loaderImageId: mapValueOfType<String>(json, r'loaderImageId'),
loaderImageUrl: mapValueOfType<String>(json, r'loaderImageUrl'),
weatherCity: mapValueOfType<String>(json, r'weatherCity'),
); );
} }
return null; return null;

View File

@ -27,7 +27,9 @@ class ExportConfigurationDTO {
this.isOffline, this.isOffline,
this.instanceId, this.instanceId,
this.sectionIds = const [], this.sectionIds = const [],
this.pinCode, this.loaderImageId,
this.loaderImageUrl,
this.weatherCity,
this.sections = const [], this.sections = const [],
this.resources = const [], this.resources = const [],
}); });
@ -84,13 +86,11 @@ class ExportConfigurationDTO {
List<String>? sectionIds; List<String>? sectionIds;
/// String? loaderImageId;
/// 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 String? loaderImageUrl;
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note. String? weatherCity;
///
int? pinCode;
List<SectionDTO>? sections; List<SectionDTO>? sections;
@ -112,7 +112,9 @@ class ExportConfigurationDTO {
other.isOffline == isOffline && other.isOffline == isOffline &&
other.instanceId == instanceId && other.instanceId == instanceId &&
other.sectionIds == sectionIds && other.sectionIds == sectionIds &&
other.pinCode == pinCode && other.loaderImageId == loaderImageId &&
other.loaderImageUrl == loaderImageUrl &&
other.weatherCity == weatherCity &&
other.sections == sections && other.sections == sections &&
other.resources == resources; other.resources == resources;
@ -133,12 +135,14 @@ class ExportConfigurationDTO {
(isOffline == null ? 0 : isOffline!.hashCode) + (isOffline == null ? 0 : isOffline!.hashCode) +
(instanceId == null ? 0 : instanceId!.hashCode) + (instanceId == null ? 0 : instanceId!.hashCode) +
(sectionIds == null ? 0 : sectionIds!.hashCode) + (sectionIds == null ? 0 : sectionIds!.hashCode) +
(pinCode == null ? 0 : pinCode!.hashCode) + (loaderImageId == null ? 0 : loaderImageId!.hashCode) +
(loaderImageUrl == null ? 0 : loaderImageUrl!.hashCode) +
(weatherCity == null ? 0 : weatherCity!.hashCode) +
(sections == null ? 0 : sections!.hashCode) + (sections == null ? 0 : sections!.hashCode) +
(resources == null ? 0 : resources!.hashCode); (resources == null ? 0 : resources!.hashCode);
@override @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, pinCode=$pinCode, 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, sections=$sections, resources=$resources]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -212,10 +216,20 @@ class ExportConfigurationDTO {
} else { } else {
json[r'sectionIds'] = null; json[r'sectionIds'] = null;
} }
if (this.pinCode != null) { if (this.loaderImageId != null) {
json[r'pinCode'] = this.pinCode; json[r'loaderImageId'] = this.loaderImageId;
} else { } else {
json[r'pinCode'] = null; json[r'loaderImageId'] = null;
}
if (this.loaderImageUrl != null) {
json[r'loaderImageUrl'] = this.loaderImageUrl;
} else {
json[r'loaderImageUrl'] = null;
}
if (this.weatherCity != null) {
json[r'weatherCity'] = this.weatherCity;
} else {
json[r'weatherCity'] = null;
} }
if (this.sections != null) { if (this.sections != null) {
json[r'sections'] = this.sections; json[r'sections'] = this.sections;
@ -267,7 +281,9 @@ class ExportConfigurationDTO {
sectionIds: json[r'sectionIds'] is List sectionIds: json[r'sectionIds'] is List
? (json[r'sectionIds'] as List).cast<String>() ? (json[r'sectionIds'] as List).cast<String>()
: const [], : const [],
pinCode: mapValueOfType<int>(json, r'pinCode'), loaderImageId: mapValueOfType<String>(json, r'loaderImageId'),
loaderImageUrl: mapValueOfType<String>(json, r'loaderImageUrl'),
weatherCity: mapValueOfType<String>(json, r'weatherCity'),
sections: SectionDTO.listFromJson(json[r'sections']), sections: SectionDTO.listFromJson(json[r'sections']),
resources: ResourceDTO.listFromJson(json[r'resources']), resources: ResourceDTO.listFromJson(json[r'resources']),
); );

View File

@ -18,7 +18,6 @@ class ImageDTO {
this.resourceId, this.resourceId,
this.source_, this.source_,
this.order, this.order,
this.type,
}); });
List<TranslationDTO>? title; List<TranslationDTO>? title;
@ -37,35 +36,25 @@ class ImageDTO {
/// ///
int? order; int? order;
///
/// 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.
///
ResourceType? type;
@override @override
bool operator ==(Object other) => identical(this, other) || other is ImageDTO && bool operator ==(Object other) => identical(this, other) || other is ImageDTO &&
other.title == title && other.title == title &&
other.description == description && other.description == description &&
other.resourceId == resourceId && other.resourceId == resourceId &&
other.source_ == source_ && other.source_ == source_ &&
other.order == order && other.order == order;
other.type == type;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(title == null ? 0 : title!.hashCode) + (title == null ? 0 : title!.hashCode) +
(description == null ? 0 : description!.hashCode) + (description == null ? 0 : description!.hashCode) +
(resourceId == null ? 0 : resourceId!.hashCode) + (resourceId == null ? 0 : resourceId!.hashCode) +
(source_ == null ? 0 : source_!.hashCode) + (source_ == null ? 0 : source_!.hashCode) +
(order == null ? 0 : order!.hashCode) + (order == null ? 0 : order!.hashCode);
(type == null ? 0 : type!.hashCode);
@override @override
String toString() => 'ImageDTO[title=$title, description=$description, resourceId=$resourceId, source_=$source_, order=$order, type=$type]'; String toString() => 'ImageDTO[title=$title, description=$description, resourceId=$resourceId, source_=$source_, order=$order]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -94,11 +83,6 @@ class ImageDTO {
} else { } else {
json[r'order'] = null; json[r'order'] = null;
} }
if (this.type != null) {
json[r'type'] = this.type;
} else {
json[r'type'] = null;
}
return json; return json;
} }
@ -126,7 +110,6 @@ class ImageDTO {
resourceId: mapValueOfType<String>(json, r'resourceId'), resourceId: mapValueOfType<String>(json, r'resourceId'),
source_: mapValueOfType<String>(json, r'source'), source_: mapValueOfType<String>(json, r'source'),
order: mapValueOfType<int>(json, r'order'), order: mapValueOfType<int>(json, r'order'),
type: ResourceType.fromJson(json[r'type']),
); );
} }
return null; return null;

View File

@ -23,14 +23,14 @@ class ImageGeoPoint {
@override @override
bool operator ==(Object other) => identical(this, other) || other is ImageGeoPoint && bool operator ==(Object other) => identical(this, other) || other is ImageGeoPoint &&
other.imageResourceId == imageResourceId && other.imageResourceId == imageResourceId &&
other.imageSource == imageSource; other.imageSource == imageSource;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(imageResourceId == null ? 0 : imageResourceId!.hashCode) + (imageResourceId == null ? 0 : imageResourceId!.hashCode) +
(imageSource == null ? 0 : imageSource!.hashCode); (imageSource == null ? 0 : imageSource!.hashCode);
@override @override
String toString() => 'ImageGeoPoint[imageResourceId=$imageResourceId, imageSource=$imageSource]'; String toString() => 'ImageGeoPoint[imageResourceId=$imageResourceId, imageSource=$imageSource]';

View File

@ -40,7 +40,7 @@ class MapTypeApp {
static MapTypeApp? fromJson(dynamic value) => MapTypeAppTypeTransformer().decode(value); static MapTypeApp? fromJson(dynamic value) => MapTypeAppTypeTransformer().decode(value);
static List<MapTypeApp>? listFromJson(dynamic json, {bool growable = false,}) { static List<MapTypeApp> listFromJson(dynamic json, {bool growable = false,}) {
final result = <MapTypeApp>[]; final result = <MapTypeApp>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -72,14 +72,27 @@ class MapTypeAppTypeTransformer {
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed, /// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code. /// and users are still using an old app with the old code.
MapTypeApp? decode(dynamic data, {bool allowNull = true}) { MapTypeApp? decode(dynamic data, {bool allowNull = true}) {
if (data != null) {
switch (data.toString()) {
case r'None': return MapTypeApp.none;
case r'Normal': return MapTypeApp.normal;
case r'Satellite': return MapTypeApp.satellite;
case r'Terrain': return MapTypeApp.terrain;
case r'Hybrid': return MapTypeApp.hybrid;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');
}
}
}
if (data != null) { if (data != null) {
if(data.runtimeType == String) { if(data.runtimeType == String) {
switch (data.toString()) { switch (data.toString()) {
case "none": return MapTypeApp.none; case r'None': return MapTypeApp.none;
case "normal": return MapTypeApp.normal; case r'Normal': return MapTypeApp.normal;
case "satellite": return MapTypeApp.satellite; case r'Satellite': return MapTypeApp.satellite;
case "terrain": return MapTypeApp.terrain; case r'Terrain': return MapTypeApp.terrain;
case "hybrid": return MapTypeApp.hybrid; case r'Hybrid': return MapTypeApp.hybrid;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -100,6 +113,7 @@ class MapTypeAppTypeTransformer {
} }
} }
} }
} }
return null; return null;
} }

View File

@ -10,7 +10,7 @@
part of openapi.api; part of openapi.api;
/// 0 = Map 1 = Slider 2 = Video 3 = Web 4 = Menu 5 = Quizz 6 = Article /// 0 = Map 1 = Slider 2 = Video 3 = Web 4 = Menu 5 = Quizz 6 = Article 7 = PDF 8 = Puzzle 9 = Agenda
class SectionType { class SectionType {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const SectionType._(this.value); const SectionType._(this.value);
@ -30,6 +30,9 @@ class SectionType {
static const Menu = SectionType._(4); static const Menu = SectionType._(4);
static const Quizz = SectionType._(5); static const Quizz = SectionType._(5);
static const Article = SectionType._(6); static const Article = SectionType._(6);
static const Pdf = SectionType._(7);
static const Puzzle = SectionType._(8);
static const Agenda = SectionType._(9);
/// List of all possible values in this [enum][SectionType]. /// List of all possible values in this [enum][SectionType].
static const values = <SectionType>[ static const values = <SectionType>[
@ -39,12 +42,15 @@ class SectionType {
Web, Web,
Menu, Menu,
Quizz, Quizz,
Article Article,
Pdf,
Puzzle,
Agenda
]; ];
static SectionType? fromJson(dynamic value) => SectionTypeTypeTransformer().decode(value); static SectionType? fromJson(dynamic value) => SectionTypeTypeTransformer().decode(value);
static List<SectionType>? listFromJson(dynamic json, {bool growable = false,}) { static List<SectionType> listFromJson(dynamic json, {bool growable = false,}) {
final result = <SectionType>[]; final result = <SectionType>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -86,6 +92,9 @@ class SectionTypeTypeTransformer {
case r'Menu': return SectionType.Menu; case r'Menu': return SectionType.Menu;
case r'Quizz': return SectionType.Quizz; case r'Quizz': return SectionType.Quizz;
case r'Article': return SectionType.Article; case r'Article': return SectionType.Article;
case r'PDF': return SectionType.Pdf;
case r'Puzzle': return SectionType.Puzzle;
case r'Agenda': return SectionType.Agenda;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -101,6 +110,9 @@ class SectionTypeTypeTransformer {
case 4: return SectionType.Menu; case 4: return SectionType.Menu;
case 5: return SectionType.Quizz; case 5: return SectionType.Quizz;
case 6: return SectionType.Article; case 6: return SectionType.Article;
case 7: return SectionType.Pdf;
case 8: return SectionType.Puzzle;
case 9: return SectionType.Agenda;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');