diff --git a/lib/Components/check_input_container.dart b/lib/Components/check_input_container.dart new file mode 100644 index 0000000..6fea901 --- /dev/null +++ b/lib/Components/check_input_container.dart @@ -0,0 +1,81 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:manager_app/Components/color_picker.dart'; + +import '../constants.dart'; + +class CheckInputContainer extends StatefulWidget { + final bool isChecked; + final IconData icon; + final String label; + final ValueChanged onChanged; + const CheckInputContainer({ + Key key, + this.isChecked, + this.icon, + this.label, + this.onChanged, + }) : super(key: key); + + @override + _CheckInputContainerState createState() => _CheckInputContainerState(); +} + +class _CheckInputContainerState extends State { + bool isChecked; + + @override + void initState() { + setState(() { + isChecked = widget.isChecked; + }); + super.initState(); + } + @override + Widget build(BuildContext context) { + + return Container( + child: Row( + children: [ + Align( + alignment: AlignmentDirectional.centerStart, + child: Row( + children: [ + if(widget.icon != null) + Padding( + padding: const EdgeInsets.only(right: 8.0), + child: Icon( + widget.icon, + color: kPrimaryColor, + size: 25.0, + ), + ), + if(widget.label != null) + Text(widget.label, style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300)), + ], + ) + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Container( + width: 50, + height: 50, + child: Checkbox( + shape: CircleBorder(), + value: isChecked, + checkColor: Colors.white, + activeColor: kPrimaryColor, + onChanged: (bool value) { + setState(() { + isChecked = value; + }); + widget.onChanged(value); + }, + ), + ), + ), + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/Components/fetch_section_icon.dart b/lib/Components/fetch_section_icon.dart index ee09dd2..88280b0 100644 --- a/lib/Components/fetch_section_icon.dart +++ b/lib/Components/fetch_section_icon.dart @@ -21,6 +21,9 @@ IconData getSectionIcon(elementType) { case SectionType.quizz: return Icons.question_answer; break; + case SectionType.article: + return Icons.article_outlined; + break; } return Icons.menu; } \ 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 5d65710..9d0358d 100644 --- a/lib/Screens/Configurations/configuration_detail_screen.dart +++ b/lib/Screens/Configurations/configuration_detail_screen.dart @@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; +import 'package:manager_app/Components/check_input_container.dart'; import 'package:manager_app/Components/color_picker_input_container.dart'; import 'package:manager_app/Components/confirmation_dialog.dart'; import 'package:manager_app/Components/loading.dart'; @@ -178,6 +179,14 @@ class _ConfigurationDetailScreenState extends State { print(configurationDTO.languages); }, ), + CheckInputContainer( + icon: Icons.signal_wifi_off, + label: "Hors ligne :", + isChecked: configurationDTO.isOffline, + onChanged: (value) { + configurationDTO.isOffline = value; + }, + ), ], ), Column( @@ -198,6 +207,22 @@ class _ConfigurationDetailScreenState extends State { configurationDTO.secondaryColor = value; }, ), + CheckInputContainer( + icon: Icons.tablet, + label: "Tablette :", + isChecked: configurationDTO.isTablet, + onChanged: (value) { + configurationDTO.isTablet = value; + }, + ), + CheckInputContainer( + icon: Icons.phone_android, + label: "MyVisit :", + isChecked: configurationDTO.isMobile, + onChanged: (value) { + configurationDTO.isMobile = value; + }, + ), ], ) ], diff --git a/lib/constants.dart b/lib/constants.dart index 1d2b714..153de07 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -13,7 +13,7 @@ const kWhite = Color(0xFFFFFFFF); const kBlack = Color(0xFF000000); const kSuccess = Color(0xFF8bc34a); -const List section_types = ["Map", "Slider", "Video", "Web", "Menu", "Quizz"]; +const List section_types = ["Map", "Slider", "Video", "Web", "Menu", "Quizz", "Article"]; const List map_types = ["none", "normal", "satellite", "terrain", "hybrid"]; const List languages = ["FR", "NL", "EN", "DE"]; const List resource_types = ["image", "image url", "video url"]; // "video", diff --git a/manager_api/.openapi-generator/FILES b/manager_api/.openapi-generator/FILES index 74774bf..5451054 100644 --- a/manager_api/.openapi-generator/FILES +++ b/manager_api/.openapi-generator/FILES @@ -84,4 +84,3 @@ lib/model/user_detail_dto.dart lib/model/video_dto.dart lib/model/web_dto.dart pubspec.yaml -test/article_dto_test.dart diff --git a/manager_api/doc/ConfigurationDTO.md b/manager_api/doc/ConfigurationDTO.md index 6cd01ae..43694ec 100644 --- a/manager_api/doc/ConfigurationDTO.md +++ b/manager_api/doc/ConfigurationDTO.md @@ -15,6 +15,7 @@ Name | Type | Description | Notes **languages** | **List** | | [optional] [default to const []] **dateCreation** | [**DateTime**](DateTime.md) | | [optional] **isMobile** | **bool** | | [optional] +**isTablet** | **bool** | | [optional] **isOffline** | **bool** | | [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) diff --git a/manager_api/doc/ExportConfigurationDTO.md b/manager_api/doc/ExportConfigurationDTO.md index e1d4046..44a4f2d 100644 --- a/manager_api/doc/ExportConfigurationDTO.md +++ b/manager_api/doc/ExportConfigurationDTO.md @@ -15,6 +15,7 @@ Name | Type | Description | Notes **languages** | **List** | | [optional] [default to const []] **dateCreation** | [**DateTime**](DateTime.md) | | [optional] **isMobile** | **bool** | | [optional] +**isTablet** | **bool** | | [optional] **isOffline** | **bool** | | [optional] **sections** | [**List**](SectionDTO.md) | | [optional] [default to const []] **resources** | [**List**](ResourceDTO.md) | | [optional] [default to const []] diff --git a/manager_api/lib/model/configuration_dto.dart b/manager_api/lib/model/configuration_dto.dart index b5b9f58..ae287cf 100644 --- a/manager_api/lib/model/configuration_dto.dart +++ b/manager_api/lib/model/configuration_dto.dart @@ -19,6 +19,7 @@ class ConfigurationDTO { this.languages, this.dateCreation, this.isMobile, + this.isTablet, this.isOffline, }); @@ -36,6 +37,8 @@ class ConfigurationDTO { bool isMobile; + bool isTablet; + bool isOffline; @override @@ -47,6 +50,7 @@ class ConfigurationDTO { other.languages == languages && other.dateCreation == dateCreation && other.isMobile == isMobile && + other.isTablet == isTablet && other.isOffline == isOffline; @override @@ -58,10 +62,11 @@ class ConfigurationDTO { (languages == null ? 0 : languages.hashCode) + (dateCreation == null ? 0 : dateCreation.hashCode) + (isMobile == null ? 0 : isMobile.hashCode) + + (isTablet == null ? 0 : isTablet.hashCode) + (isOffline == null ? 0 : isOffline.hashCode); @override - String toString() => 'ConfigurationDTO[id=$id, label=$label, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isOffline=$isOffline]'; + String toString() => 'ConfigurationDTO[id=$id, label=$label, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline]'; Map toJson() { final json = {}; @@ -86,6 +91,9 @@ class ConfigurationDTO { if (isMobile != null) { json[r'isMobile'] = isMobile; } + if (isTablet != null) { + json[r'isTablet'] = isTablet; + } if (isOffline != null) { json[r'isOffline'] = isOffline; } @@ -108,6 +116,7 @@ class ConfigurationDTO { ? null : DateTime.parse(json[r'dateCreation']), isMobile: json[r'isMobile'], + isTablet: json[r'isTablet'], isOffline: json[r'isOffline'], ); diff --git a/manager_api/lib/model/export_configuration_dto.dart b/manager_api/lib/model/export_configuration_dto.dart index b30c1c5..5f62ec4 100644 --- a/manager_api/lib/model/export_configuration_dto.dart +++ b/manager_api/lib/model/export_configuration_dto.dart @@ -19,6 +19,7 @@ class ExportConfigurationDTO { this.languages, this.dateCreation, this.isMobile, + this.isTablet, this.isOffline, this.sections, this.resources, @@ -38,6 +39,8 @@ class ExportConfigurationDTO { bool isMobile; + bool isTablet; + bool isOffline; List sections; @@ -53,6 +56,7 @@ class ExportConfigurationDTO { other.languages == languages && other.dateCreation == dateCreation && other.isMobile == isMobile && + other.isTablet == isTablet && other.isOffline == isOffline && other.sections == sections && other.resources == resources; @@ -66,12 +70,13 @@ class ExportConfigurationDTO { (languages == null ? 0 : languages.hashCode) + (dateCreation == null ? 0 : dateCreation.hashCode) + (isMobile == null ? 0 : isMobile.hashCode) + + (isTablet == null ? 0 : isTablet.hashCode) + (isOffline == null ? 0 : isOffline.hashCode) + (sections == null ? 0 : sections.hashCode) + (resources == null ? 0 : resources.hashCode); @override - String toString() => 'ExportConfigurationDTO[id=$id, label=$label, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isOffline=$isOffline, sections=$sections, resources=$resources]'; + String toString() => 'ExportConfigurationDTO[id=$id, label=$label, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, sections=$sections, resources=$resources]'; Map toJson() { final json = {}; @@ -96,6 +101,9 @@ class ExportConfigurationDTO { if (isMobile != null) { json[r'isMobile'] = isMobile; } + if (isTablet != null) { + json[r'isTablet'] = isTablet; + } if (isOffline != null) { json[r'isOffline'] = isOffline; } @@ -124,6 +132,7 @@ class ExportConfigurationDTO { ? null : DateTime.parse(json[r'dateCreation']), isMobile: json[r'isMobile'], + isTablet: json[r'isTablet'], isOffline: json[r'isOffline'], sections: SectionDTO.listFromJson(json[r'sections']), resources: ResourceDTO.listFromJson(json[r'resources']),