diff --git a/lib/Components/multi_select_container.dart b/lib/Components/multi_select_container.dart new file mode 100644 index 0000000..bf2bce0 --- /dev/null +++ b/lib/Components/multi_select_container.dart @@ -0,0 +1,89 @@ +import 'package:flutter/material.dart'; +import 'package:manager_app/constants.dart'; + +class MultiSelectContainer extends StatelessWidget { + final Color color; + final String label; + final List values; + final List initialValue; + final ValueChanged> onChanged; + const MultiSelectContainer({ + Key key, + this.color = kSecond, + this.label, + this.values, + this.initialValue, + this.onChanged, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + Size size = MediaQuery.of(context).size; + return Container( + child: Row( + children: [ + Align( + alignment: AlignmentDirectional.centerStart, + child: Text(label, style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300)) + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Container( + width: size.width *0.2, + child: MultiSelectChip( + values, + initialValue, + onSelectionChanged: (selectedList) { + onChanged(selectedList); + }, + ), + ), + ), + ], + ), + ); + } +} + +class MultiSelectChip extends StatefulWidget { + final List values; + final List selectedValues; + final Function(List) onSelectionChanged; // +added + MultiSelectChip( + this.values, + this.selectedValues, + {this.onSelectionChanged} // +added + ); + @override + _MultiSelectChipState createState() => _MultiSelectChipState(); +} +class _MultiSelectChipState extends State { + _buildChoiceList() { + List choices = List(); + widget.values.forEach((item) { + choices.add(Container( + padding: const EdgeInsets.all(2.0), + child: ChoiceChip( + label: Text(item, style: TextStyle(color: kBlack)), + selected: widget.selectedValues.contains(item), + selectedColor: kPrimaryColor, + onSelected: (selected) { + setState(() { + widget.selectedValues.contains(item) + ? widget.selectedValues.remove(item) + : widget.selectedValues.add(item); + widget.onSelectionChanged(widget.selectedValues); // +added + }); + }, + ), + )); + }); + return choices; + } + @override + Widget build(BuildContext context) { + return Wrap( + children: _buildChoiceList(), + ); + } +} \ No newline at end of file diff --git a/lib/Screens/Configurations/configuration_detail_screen.dart b/lib/Screens/Configurations/configuration_detail_screen.dart index 8ff7965..76758d5 100644 --- a/lib/Screens/Configurations/configuration_detail_screen.dart +++ b/lib/Screens/Configurations/configuration_detail_screen.dart @@ -2,15 +2,13 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; -import 'package:flutter_colorpicker/flutter_colorpicker.dart'; -import 'package:manager_app/Components/color_picker.dart'; import 'package:manager_app/Components/color_picker_input_container.dart'; import 'package:manager_app/Components/confirmation_dialog.dart'; -import 'package:manager_app/Components/message_notification.dart'; +import 'package:manager_app/Components/multi_select_container.dart'; import 'package:manager_app/Components/rounded_button.dart'; -import 'package:manager_app/Components/rounded_input_field.dart'; import 'package:manager_app/Components/string_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; +import 'package:manager_app/Screens/Configurations/new_section_popup.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/client.dart'; import 'package:manager_app/constants.dart'; @@ -30,227 +28,165 @@ class ConfigurationDetailScreen extends StatefulWidget { class _ConfigurationDetailScreenState extends State { ConfigurationDTO configurationDTO; SectionDTO selectedSection; + List languages = ["FR", "NL", "EN", "DE"]; @override Widget build(BuildContext context) { final appContext = Provider.of(context); Size size = MediaQuery.of(context).size; return Container( - child: Column( - children: [ - FutureBuilder( - future: getConfiguration(this.widget, appContext.getContext().clientAPI), - builder: (context, AsyncSnapshot snapshot) { - if (snapshot.connectionState == ConnectionState.done) { - print(this.widget); - return bodyConfiguration(snapshot.data, size, appContext, context); - } else if (snapshot.connectionState == ConnectionState.none) { - return Text("No data"); - } else { - return Center(child: Container(height: size.height * 0.2, child: Text('LOADING TODO FRAISE'))); - } - } - ), - ] + child: FutureBuilder( + future: getConfiguration(this.widget, appContext.getContext().clientAPI), + builder: (context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.done) { + print(this.widget); + return bodyConfiguration(snapshot.data, size, appContext, context); + } else if (snapshot.connectionState == ConnectionState.none) { + return Text("No data"); + } else { + return Center(child: Container(height: size.height * 0.2, child: Text('LOADING TODO FRAISE'))); + } + } ), ); } Widget bodyConfiguration(ConfigurationDTO configurationDTO, Size size, AppContext appContext, BuildContext context) { - - return Container( - height: size.height*0.96, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: size.width*0.9, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Align( - alignment: AlignmentDirectional.bottomStart, - child: Padding( - padding: const EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(configurationDTO.label, style: TextStyle(fontSize: 30, fontWeight: FontWeight.w400)), - Padding( - padding: const EdgeInsets.all(5.0), - child: Text(DateFormat('dd/MM/yyyy').format(configurationDTO.dateCreation), style: TextStyle(fontSize: 15, fontWeight: FontWeight.w200)), - ), - ], - ), - ) - ), - Padding( + return Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Align( + alignment: AlignmentDirectional.bottomStart, + child: Padding( padding: const EdgeInsets.all(10.0), - child: Align( - alignment: AlignmentDirectional.centerEnd, - child: InkWell( - onTap: () { - ManagerAppContext managerAppContext = appContext.getContext(); - managerAppContext.selectedConfiguration = null; - appContext.setContext(managerAppContext); - }, - child: Container( - child: Icon( - Icons.arrow_back, - color: kPrimaryColor, - size: 50.0, - ) - ) - ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(configurationDTO.label, style: TextStyle(fontSize: 30, fontWeight: FontWeight.w400)), + Padding( + padding: const EdgeInsets.all(5.0), + child: Text(DateFormat('dd/MM/yyyy').format(configurationDTO.dateCreation), style: TextStyle(fontSize: 15, fontWeight: FontWeight.w200)), + ), + ], ), ) - ], ), - ), // TITLE - Padding( - padding: const EdgeInsets.all(15.0), + Padding( + padding: const EdgeInsets.all(10.0), + child: Align( + alignment: AlignmentDirectional.centerEnd, + child: InkWell( + onTap: () { + ManagerAppContext managerAppContext = appContext.getContext(); + managerAppContext.selectedConfiguration = null; + appContext.setContext(managerAppContext); + }, + child: Container( + child: Icon( + Icons.arrow_back, + color: kPrimaryColor, + size: 50.0, + ) + ) + ), + ), + ) + ], + ), + ), // TITLE + Container( + child: Padding( + padding: const EdgeInsets.all(10.0), child: Container( - //color: Colors.yellowAccent, - height: size.height*0.65, child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - StringContainer( - label: "Label :", - initialValue: configurationDTO.label, - onChanged: (value) { - configurationDTO.label = value; - }, - ), - Row( - children: [ - Align( - alignment: AlignmentDirectional.centerStart, - child: Text("Languages :", style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300)) - ), - Padding( - padding: const EdgeInsets.all(10.0), - child: Container( - width: size.width *0.2, - child: RoundedInputField( - color: kSecond, - textColor: kBlack, - initialValue: configurationDTO.label, - onChanged: (value) { - configurationDTO.label = value; - }, - ), - ), - ), - ], - ), - ], + Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + StringContainer( + label: "Nom :", + initialValue: configurationDTO.label, + onChanged: (value) { + configurationDTO.label = value; + }, + ), + MultiSelectContainer( + label: "Langues :", + initialValue: configurationDTO.languages != null ? configurationDTO.languages: [], + values: languages, + onChanged: (value) { + var tempOutput = new List.from(value); + configurationDTO.languages = tempOutput; + print(configurationDTO.languages); + }, + ), + ], + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ColorPickerInputContainer( + label: "Couleur principal :", + color: configurationDTO.primaryColor, + onChanged: (value) { + configurationDTO.primaryColor = value; + }, + ), + ColorPickerInputContainer( + label: "Couleur secondaire :", + color: appContext.getContext().selectedConfiguration.secondaryColor, + onChanged: (value) { + configurationDTO.secondaryColor = value; + }, + ), + ], + ) + ], + ), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(25.0), + border: Border.all(width: 0.5, color: kSecond) ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ColorPickerInputContainer( - label: "Primary color :", - color: configurationDTO.primaryColor, - onChanged: (value) { - configurationDTO.primaryColor = value; - }, - ), - ColorPickerInputContainer( - label: "Secondary color :", - color: appContext.getContext().selectedConfiguration.secondaryColor, - onChanged: (value) { - configurationDTO.secondaryColor = value; - }, - ), - ], - ) - ], - ), - Align( - alignment: AlignmentDirectional.centerStart, - child: Text("Sections :", style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300)) - ), - FutureBuilder( - future: getSections(configurationDTO, appContext.getContext().clientAPI), - builder: (context, AsyncSnapshot snapshot) { - if (snapshot.connectionState == ConnectionState.done) { - var tempOutput = new List.from(snapshot.data); - print(tempOutput); - tempOutput.add(SectionDTO(id: null)); - return bodyGrid(tempOutput, size, appContext); - } else if (snapshot.connectionState == ConnectionState.none) { - return Text("No data"); - } else { - return Center(child: Container(height: size.height * 0.2, child: Text('LOADING TODO FRAISE'))); - } - } + child: FutureBuilder( + future: getSections(configurationDTO, appContext.getContext().clientAPI), + builder: (context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.done) { + var tempOutput = new List.from(snapshot.data); + tempOutput.add(SectionDTO(id: null)); + return bodyGrid(configurationDTO, tempOutput, size, appContext); + } else if (snapshot.connectionState == ConnectionState.none) { + return Text("No data"); + } else { + return Center(child: Container(height: size.height * 0.2, child: Text('LOADING TODO FRAISE'))); + } + } + ), + ), ), ], ), ), - ),// FIELDS SECTION - Align( - alignment: AlignmentDirectional.bottomCenter, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Padding( - padding: const EdgeInsets.all(10.0), - child: RoundedButton( - text: "Annuler", - icon: Icons.undo, - color: Colors.grey, - textColor: Colors.white, - fontSize: 15, - press: () { - print("Annuler pressed"); - cancel(configurationDTO, appContext); - }, - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: RoundedButton( - text: "Supprimer", - icon: Icons.delete, - color: Colors.red, - textColor: Colors.white, - fontSize: 15, - press: () { - print("Supprimer pressed"); - delete(configurationDTO, appContext); - }, - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: RoundedButton( - text: "Sauvegarder", - icon: Icons.done, - color: Colors.lightGreen, - textColor: Colors.white, - fontSize: 15, - press: () { - save(configurationDTO, appContext); - print("Sauvegarder pressed"); - }, - ), - ), - ], - ), - ),// BUTTONS - ], - ), + ), + ),// FIELDS SECTION + getButtons(configurationDTO, appContext), + ], ); } @@ -268,26 +204,84 @@ class _ConfigurationDetailScreenState extends State { maxLines: 1, ), ), - Align( - alignment: Alignment.bottomRight, - child: AutoSizeText( - DateFormat('dd/MM/yyyy').format(element.dateCreation), - style: new TextStyle(fontSize: 18, fontFamily: ""), - maxLines: 1, - ), - ), ], ); } else { - return Icon( - Icons.add, - color: kTextLightColor, - size: 50.0, + return Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.add, + color: kTextLightColor, + size: 40.0, + ), + AutoSizeText( + "Nouvelle section", + maxLines: 2, + style: new TextStyle(color: kWhite, fontWeight: FontWeight.w400), + minFontSize: 0, + maxFontSize: 40, + textAlign: TextAlign.center, + ) + ], ); } } - Widget bodyGrid(data, Size size, AppContext appContext) { + getButtons(ConfigurationDTO configurationDTO, AppContext appContext) { + return Align( + alignment: AlignmentDirectional.bottomCenter, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Padding( + padding: const EdgeInsets.all(10.0), + child: RoundedButton( + text: "Annuler", + icon: Icons.undo, + color: Colors.grey, + textColor: Colors.white, + fontSize: 15, + press: () { + print("Annuler pressed"); + cancel(configurationDTO, appContext); + }, + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: RoundedButton( + text: "Supprimer", + icon: Icons.delete, + color: Colors.red, + textColor: Colors.white, + fontSize: 15, + press: () { + print("Supprimer pressed"); + delete(configurationDTO, appContext); + }, + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: RoundedButton( + text: "Sauvegarder", + icon: Icons.done, + color: Colors.lightGreen, + textColor: Colors.white, + fontSize: 15, + press: () { + save(configurationDTO, appContext); + print("Sauvegarder pressed"); + }, + ), + ), + ], + ), + ); + } + + Widget bodyGrid(ConfigurationDTO configurationDTO, data, Size size, AppContext appContext) { return GridView.builder( shrinkWrap: true, gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 8), @@ -297,7 +291,7 @@ class _ConfigurationDetailScreenState extends State { InkWell( onTap: () { if (data[index].id == null) { - print("open modal to create new section !"); + showNewSection(configurationDTO, appContext, context); } else { setState(() { ManagerAppContext managerAppContext = appContext.getContext(); @@ -342,7 +336,7 @@ class _ConfigurationDetailScreenState extends State { () {}, () async { ManagerAppContext managerAppContext = appContext.getContext(); - ConfigurationDTO configuration = await appContext.getContext().clientAPI.configurationApi.configurationDelete(configurationDTO.id); + await appContext.getContext().clientAPI.configurationApi.configurationDelete(configurationDTO.id); managerAppContext.selectedConfiguration = null; appContext.setContext(managerAppContext); }, @@ -358,7 +352,6 @@ class _ConfigurationDetailScreenState extends State { } Future getConfiguration(ConfigurationDetailScreen widget, Client client) async { - print(widget.id); ConfigurationDTO configuration = await client.configurationApi.configurationGetDetail(widget.id); print(configuration); diff --git a/lib/Screens/Configurations/configurations_screen.dart b/lib/Screens/Configurations/configurations_screen.dart index d2e3019..7178985 100644 --- a/lib/Screens/Configurations/configurations_screen.dart +++ b/lib/Screens/Configurations/configurations_screen.dart @@ -2,6 +2,7 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/Screens/Configurations/configuration_detail_screen.dart'; +import 'package:manager_app/Screens/Configurations/new_configuration_popup.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:managerapi/api.dart'; @@ -61,7 +62,7 @@ class _ConfigurationsScreenState extends State { InkWell( onTap: () { if (data[index].id == null) { - print("open modal to create new config !"); + showNewConfiguration(appContext, context); } else { setState(() { ManagerAppContext managerAppContext = appContext.getContext(); diff --git a/lib/Screens/Configurations/new_configuration_popup.dart b/lib/Screens/Configurations/new_configuration_popup.dart new file mode 100644 index 0000000..142e77b --- /dev/null +++ b/lib/Screens/Configurations/new_configuration_popup.dart @@ -0,0 +1,89 @@ +import 'package:flutter/material.dart'; +import 'package:manager_app/Components/rounded_button.dart'; +import 'package:manager_app/Components/string_input_container.dart'; +import 'package:manager_app/Models/managerContext.dart'; +import 'package:manager_app/app_context.dart'; +import 'package:manager_app/constants.dart'; +import 'package:managerapi/api.dart'; +import 'package:overlay_support/overlay_support.dart'; + +void showNewConfiguration(AppContext appContext, BuildContext context) { + ConfigurationDTO configurationDTO = new ConfigurationDTO(); + showDialog( + builder: (BuildContext context) => AlertDialog( + content: SingleChildScrollView( + child: Column( + children: [ + Text("Nouvelle configuration", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)), + Column( + children: [ + StringContainer( + label: "Nom :", + initialValue: configurationDTO.label, + onChanged: (value) { + configurationDTO.label = value; + }, + ), + ], + ), + ], + ), + ), + actions: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Align( + alignment: AlignmentDirectional.bottomEnd, + child: Container( + width: 175, + height: 70, + child: RoundedButton( + text: "Annuler", + icon: Icons.undo, + color: kSecond, + press: () { + Navigator.of(context).pop(); + }, + fontSize: 20, + ), + ), + ), + Align( + alignment: AlignmentDirectional.bottomEnd, + child: Container( + width: 150, + height: 70, + child: RoundedButton( + text: "Créer", + icon: Icons.check, + color: kPrimaryColor, + textColor: kWhite, + press: () { + //onYes(); + create(configurationDTO, appContext, context); + }, + fontSize: 20, + ), + ), + ), + ], + ), + ], + ), context: context + ); +} + +void create(ConfigurationDTO configurationDTO, AppContext appContext, context) async { + if (configurationDTO.label != null) { + ConfigurationDTO newConfiguration = await appContext.getContext().clientAPI.configurationApi.configurationCreate(configurationDTO); + ManagerAppContext managerAppContext = appContext.getContext(); + managerAppContext.selectedConfiguration = null; + appContext.setContext(managerAppContext); + + // popup a toast. + toast('La configuration a été créée avec succès'); + + Navigator.of(context).pop(); + } +} \ No newline at end of file diff --git a/lib/Screens/Configurations/new_section_popup.dart b/lib/Screens/Configurations/new_section_popup.dart new file mode 100644 index 0000000..6b196a8 --- /dev/null +++ b/lib/Screens/Configurations/new_section_popup.dart @@ -0,0 +1,93 @@ +import 'package:flutter/material.dart'; +import 'package:manager_app/Components/rounded_button.dart'; +import 'package:manager_app/Components/string_input_container.dart'; +import 'package:manager_app/Models/managerContext.dart'; +import 'package:manager_app/app_context.dart'; +import 'package:manager_app/constants.dart'; +import 'package:managerapi/api.dart'; +import 'package:overlay_support/overlay_support.dart'; + +void showNewSection(ConfigurationDTO configurationDTO, AppContext appContext, BuildContext context) { + SectionDTO sectionDTO = new SectionDTO(); + sectionDTO.configurationId = configurationDTO.id; + showDialog( + builder: (BuildContext context) => AlertDialog( + content: SingleChildScrollView( + child: Column( + children: [ + Text("Nouvelle section", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)), + Column( + children: [ + StringContainer( + label: "Nom :", + initialValue: sectionDTO.label, + onChanged: (value) { + sectionDTO.label = value; + }, + ), + ], + ), + ], + ), + ), + actions: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Align( + alignment: AlignmentDirectional.bottomEnd, + child: Container( + width: 175, + height: 70, + child: RoundedButton( + text: "Annuler", + icon: Icons.undo, + color: kSecond, + press: () { + Navigator.of(context).pop(); + }, + fontSize: 20, + ), + ), + ), + Align( + alignment: AlignmentDirectional.bottomEnd, + child: Container( + width: 150, + height: 70, + child: RoundedButton( + text: "Créer", + icon: Icons.check, + color: kPrimaryColor, + textColor: kWhite, + press: () { + //onYes(); + create(sectionDTO, appContext, context); + }, + fontSize: 20, + ), + ), + ), + ], + ), + ], + ), context: context + ); +} + +void create(SectionDTO sectionDTO, AppContext appContext, BuildContext context) async { + if (sectionDTO.label != null) { + SectionDTO newSection = await appContext.getContext().clientAPI.sectionApi.sectionCreate(sectionDTO); + ManagerAppContext managerAppContext = appContext.getContext(); + if (managerAppContext.selectedConfiguration.sectionIds == null) { + managerAppContext.selectedConfiguration.sectionIds = new List(); + } + managerAppContext.selectedConfiguration.sectionIds.add(newSection.id); + appContext.setContext(managerAppContext); + + // popup a toast. + toast('La section a été créée avec succès'); + + Navigator.of(context).pop(); + } +} \ No newline at end of file diff --git a/manager_api/doc/ConfigurationApi.md b/manager_api/doc/ConfigurationApi.md index e4acba2..7eed9f1 100644 --- a/manager_api/doc/ConfigurationApi.md +++ b/manager_api/doc/ConfigurationApi.md @@ -17,7 +17,7 @@ Method | HTTP request | Description # **configurationCreate** -> RessourceDetailDTO configurationCreate(configurationDTO) +> ConfigurationDTO configurationCreate(configurationDTO) @@ -46,7 +46,7 @@ Name | Type | Description | Notes ### Return type -[**RessourceDetailDTO**](RessourceDetailDTO.md) +[**ConfigurationDTO**](ConfigurationDTO.md) ### Authorization diff --git a/manager_api/lib/api/configuration_api.dart b/manager_api/lib/api/configuration_api.dart index 842e92b..dfa4bd8 100644 --- a/manager_api/lib/api/configuration_api.dart +++ b/manager_api/lib/api/configuration_api.dart @@ -64,7 +64,7 @@ class ConfigurationApi { /// Parameters: /// /// * [ConfigurationDTO] configurationDTO (required): - Future configurationCreate(ConfigurationDTO configurationDTO) async { + Future configurationCreate(ConfigurationDTO configurationDTO) async { final response = await configurationCreateWithHttpInfo(configurationDTO); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -73,9 +73,9 @@ class ConfigurationApi { // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { - return apiClient.deserialize(_decodeBodyBytes(response), 'RessourceDetailDTO') as RessourceDetailDTO; + return apiClient.deserialize(_decodeBodyBytes(response), 'ConfigurationDTO') as ConfigurationDTO; } - return Future.value(null); + return Future.value(null); } /// Performs an HTTP 'DELETE /api/Configuration/{id}' operation and returns the [Response]. diff --git a/manager_api/swagger.yaml b/manager_api/swagger.yaml index da62419..ddeb389 100644 --- a/manager_api/swagger.yaml +++ b/manager_api/swagger.yaml @@ -47,7 +47,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/RessourceDetailDTO' + $ref: '#/components/schemas/ConfigurationDTO' '400': description: '' content: @@ -901,6 +901,31 @@ components: dateCreation: type: string format: date-time + RessourceDTO: + type: object + additionalProperties: false + properties: + id: + type: string + nullable: true + type: + $ref: '#/components/schemas/RessourceType' + label: + type: string + nullable: true + RessourceType: + type: string + description: '' + x-enumNames: + - Image + - Video + - ImageUrl + - VideoUrl + enum: + - Image + - Video + - ImageUrl + - VideoUrl RessourceDetailDTO: type: object additionalProperties: false @@ -919,31 +944,6 @@ components: data: type: string nullable: true - RessourceType: - type: string - description: '' - x-enumNames: - - Image - - Video - - ImageUrl - - VideoUrl - enum: - - Image - - Video - - ImageUrl - - VideoUrl - RessourceDTO: - type: object - additionalProperties: false - properties: - id: - type: string - nullable: true - type: - $ref: '#/components/schemas/RessourceType' - label: - type: string - nullable: true SectionDTO: type: object additionalProperties: false diff --git a/pubspec.lock b/pubspec.lock index ce8416b..cc9bcaf 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -123,6 +123,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.0" + multiselect_formfield: + dependency: "direct main" + description: + name: multiselect_formfield + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.6" nested: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 07c20f1..9a78927 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -29,6 +29,7 @@ dependencies: overlay_support: 1.0.5-hotfix1 auto_size_text: ^2.1.0 flutter_colorpicker: ^0.4.0 + multiselect_formfield: ^0.1.6 managerapi: path: manager_api