diff --git a/assets/images/ar.png b/assets/images/ar.png new file mode 100644 index 0000000..395928c Binary files /dev/null and b/assets/images/ar.png differ diff --git a/assets/images/cn.png b/assets/images/cn.png new file mode 100644 index 0000000..344eab5 Binary files /dev/null and b/assets/images/cn.png differ diff --git a/assets/images/de.png b/assets/images/de.png new file mode 100644 index 0000000..c4caaaf Binary files /dev/null and b/assets/images/de.png differ diff --git a/assets/images/en.png b/assets/images/en.png new file mode 100644 index 0000000..b81442d Binary files /dev/null and b/assets/images/en.png differ diff --git a/assets/images/es.png b/assets/images/es.png new file mode 100644 index 0000000..f19308d Binary files /dev/null and b/assets/images/es.png differ diff --git a/assets/images/fr.png b/assets/images/fr.png new file mode 100644 index 0000000..feff210 Binary files /dev/null and b/assets/images/fr.png differ diff --git a/assets/images/it.png b/assets/images/it.png new file mode 100644 index 0000000..81013f0 Binary files /dev/null and b/assets/images/it.png differ diff --git a/assets/images/nl.png b/assets/images/nl.png new file mode 100644 index 0000000..e456302 Binary files /dev/null and b/assets/images/nl.png differ diff --git a/assets/images/pl.png b/assets/images/pl.png new file mode 100644 index 0000000..91d8931 Binary files /dev/null and b/assets/images/pl.png differ diff --git a/assets/images/uk.png b/assets/images/uk.png new file mode 100644 index 0000000..8219610 Binary files /dev/null and b/assets/images/uk.png differ diff --git a/lib/Components/audio_input_container.dart b/lib/Components/audio_input_container.dart index 2281716..809d4cb 100644 --- a/lib/Components/audio_input_container.dart +++ b/lib/Components/audio_input_container.dart @@ -10,7 +10,7 @@ import 'package:provider/provider.dart'; class AudioInputContainer extends StatefulWidget { final Color color; - final String label; + final String? label; final String? initialValue; final ValueChanged onChanged; final BoxFit imageFit; @@ -19,7 +19,7 @@ class AudioInputContainer extends StatefulWidget { const AudioInputContainer({ Key? key, this.color = kSecond, - required this.label, + this.label, this.initialValue, required this.onChanged, this.imageFit = BoxFit.cover, @@ -45,8 +45,10 @@ class _AudioInputContainerState extends State { Size size = MediaQuery.of(context).size; return Container( child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Align( + if(widget.label != null) Align( alignment: AlignmentDirectional.centerStart, child: AutoSizeText( widget.label!, @@ -61,8 +63,8 @@ class _AudioInputContainerState extends State { child: Padding( padding: EdgeInsets.only(left: widget.isSmall ? 5 : 10, top: 10, bottom: 10), child: Container( - width: size.width *0.08, - height: size.width *0.08, + width: size.width *0.125, + height: size.width *0.06, child: InkWell( onTap: () async { ResourceDTO? result = await showSelectResourceModal( @@ -131,6 +133,7 @@ class _AudioInputContainerState extends State { "Choisir un fichier audio", style: TextStyle(color: kWhite), maxLines: 1, + textAlign: TextAlign.center, ) ), ) @@ -148,7 +151,7 @@ class _AudioInputContainerState extends State { return BoxDecoration( shape: BoxShape.rectangle, color: kWhite, - borderRadius: BorderRadius.circular(30.0), + borderRadius: BorderRadius.circular(20.0), /*image: new DecorationImage( fit: widget.imageFit, image: resourceDTO.type != null ? new NetworkImage( diff --git a/lib/Components/flag_decoration.dart b/lib/Components/flag_decoration.dart new file mode 100644 index 0000000..f8fbff6 --- /dev/null +++ b/lib/Components/flag_decoration.dart @@ -0,0 +1,36 @@ +import 'package:flare_flutter/flare_actor.dart'; +import 'package:flutter/material.dart'; +import 'package:manager_app/constants.dart'; + +class FlagDecoration extends StatelessWidget { + final String language; + FlagDecoration({Key? key, required this.language}) : super(key: key); + + @override + Widget build(BuildContext context) { + Size size = MediaQuery.of(context).size; + return Container( + width: 35, + height: 35, + decoration: BoxDecoration( + color: kBackgroundColor, + shape: BoxShape.circle, + //border: Border.all(width: 1.5, color: kSecondGrey), + image: DecorationImage( + fit: BoxFit.contain, + image: AssetImage("assets/images/"+language.toLowerCase()+".png")/*Svg( + "assets/images/"+language.toLowerCase()+".svg", + )*/, //AssetImage("assets/images/"+language+".png"), + ), + boxShadow: const [ + BoxShadow( + color: kBackgroundColor, + spreadRadius: 0.5, + blurRadius: 5, + offset: Offset(0, 1.5), // changes position of shadow + ), + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/Components/multi_input_modal.dart b/lib/Components/multi_input_modal.dart index 700ab41..3f4bcb7 100644 --- a/lib/Components/multi_input_modal.dart +++ b/lib/Components/multi_input_modal.dart @@ -13,7 +13,7 @@ import 'package:collection/collection.dart'; import 'package:provider/provider.dart'; import 'audio_input_container.dart'; - +import 'flag_decoration.dart'; showMultiStringInput (String label, String modalLabel, bool isTitle, List values, List newValues, Function onGetResult, int maxLines, bool isAudio, BuildContext context) { /*Function onSelect,*/ showDialog( @@ -51,36 +51,42 @@ showMultiStringInput (String label, String modalLabel, bool isTitle, List element.language == language).first.value, - color: kPrimaryColor, - onChanged: (ResourceDTO resource) { - newValues.where((element) => element.language == language).first.value = resource.id; - }, + width: MediaQuery.of(context).size.width *0.15, + height: 100, + //color: Colors.blueAccent, + child: Center( + child: AudioInputContainer( + //label: "Audio :", + initialValue: newValues.where((element) => element.language == language).first.value, + color: kPrimaryColor, + onChanged: (ResourceDTO resource) { + newValues.where((element) => element.language == language).first.value = resource.id; + }, + ), ), ), ], @@ -150,6 +160,7 @@ getTranslations(BuildContext context, AppContext appContext, String label, bool } return translations; } + /* showValues(List newValues) { List valuesToShow = new List(); diff --git a/lib/Components/multi_select_dropdown_container.dart b/lib/Components/multi_select_dropdown_container.dart index a8acee1..232a201 100644 --- a/lib/Components/multi_select_dropdown_container.dart +++ b/lib/Components/multi_select_dropdown_container.dart @@ -6,9 +6,12 @@ import 'package:multi_select_flutter/dialog/multi_select_dialog_field.dart'; import 'package:multi_select_flutter/util/multi_select_item.dart'; import 'package:multi_select_flutter/util/multi_select_list_type.dart'; +import 'flag_decoration.dart'; + class MultiSelectDropdownContainer extends StatelessWidget { final Color color; final String label; + final String labelHint; final List values; final List initialValue; final bool isMultiple; @@ -19,6 +22,7 @@ class MultiSelectDropdownContainer extends StatelessWidget { Key? key, this.color = kSecond, required this.label, + this.labelHint = "Veuillez sélectionner une langue", required this.values, required this.initialValue, required this.isMultiple, @@ -57,7 +61,7 @@ class MultiSelectDropdownContainer extends StatelessWidget { searchable: true, chipDisplay: MultiSelectChipDisplay.none(), selectedColor: kPrimaryColor, - title: Text("Veuillez sélectionner une langue"), + title: Text(labelHint), dialogHeight: size.height *0.4, dialogWidth: size.width *0.2, onSelectionChanged: (selectedList) { diff --git a/lib/Components/multi_string_input_html_modal.dart b/lib/Components/multi_string_input_html_modal.dart index 1297e8a..8905509 100644 --- a/lib/Components/multi_string_input_html_modal.dart +++ b/lib/Components/multi_string_input_html_modal.dart @@ -1,241 +1,62 @@ import 'dart:ui'; - -import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Components/rounded_button.dart'; -import 'package:manager_app/Components/text_form_input_container.dart'; -import 'package:manager_app/Models/managerContext.dart'; -import 'package:manager_app/Screens/Resources/select_resource_modal.dart'; -import 'package:manager_app/app_context.dart'; +import 'package:manager_app/Components/translation_input_container.dart'; import 'package:manager_app/constants.dart'; import 'package:manager_api_new/api.dart'; import 'package:collection/collection.dart'; -import 'package:provider/provider.dart'; -import 'package:quill_html_editor/quill_html_editor.dart'; -import 'audio_input_container.dart'; - - -showMultiStringInputHTML (String label, String modalLabel, bool isTitle, List values, List newValues, Function onGetResult, int maxLines, bool isAudio, BuildContext context) { /*Function onSelect,*/ - QuillEditorController controllerQuill = QuillEditorController(); +showMultiStringInputHTML (String label, String modalLabel, bool isTitle, List values, List newValues, Function onGetResult, int maxLines, bool isAudio, BuildContext context) { showDialog( - builder: (BuildContext context) => AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(20.0)) - ), + builder: (BuildContext context) { + return AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(20.0)) + ), title: Center(child: Text(modalLabel)), content: SingleChildScrollView( - child: Column( - children: [ - Container( - child: SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: getTranslations(context, Provider.of(context), controllerQuill, label, isTitle, isAudio, newValues), - ), - ), - ), - /*Container( - width: 500, - height: 200, - child: TranslationTab( - translations: newValues, - maxLines: maxLines - ) - ),*/ - /*Column( - children: showValues(newValues), - ),*/ - ], - ) - ), - actions: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Container( - width: 180, - height: 70, - child: RoundedButton( - text: "Annuler", - icon: Icons.undo, - color: kSecond, - press: () { - onGetResult(values); - Navigator.of(context).pop(); - }, - fontSize: 20, - ), - ), - Container( - width: 180, - height: 70, - child: RoundedButton( - text: "Valider", - icon: Icons.check, - color: kPrimaryColor, - textColor: kWhite, - press: () { - Function deepEq = const DeepCollectionEquality().equals; - if (!deepEq(values, newValues)) { - onGetResult(newValues); - } - Navigator.of(context).pop(); - }, - fontSize: 20, - ), - ), - ], + child: TranslationInputContainer(isTitle: isTitle, values: values, newValues: newValues, onGetResult: onGetResult, maxLines: maxLines, isAudio: isAudio) ), - ], - ), context: context - ); -} - -getTranslations(BuildContext context, AppContext appContext, QuillEditorController controllerQuill, String label, bool isTitle, bool isAudio, List newValues) { - List translations = []; - ManagerAppContext managerAppContext = appContext.getContext(); - final customToolBarList = isTitle ? [ - ToolBarStyle.bold, - ToolBarStyle.italic, - ToolBarStyle.color, - ToolBarStyle.background, - ToolBarStyle.clean - ] : [ - ToolBarStyle.bold, - ToolBarStyle.italic, - ToolBarStyle.align, - ToolBarStyle.color, - ToolBarStyle.background, - ToolBarStyle.listBullet, - ToolBarStyle.listOrdered, - ToolBarStyle.clean - ]; - - var language = managerAppContext.selectedConfiguration!.languages![0]; - //for(var language in managerAppContext.selectedConfiguration!.languages!) { - translations.add( - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, + actions: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( - width: MediaQuery.of(context).size.width *0.05, - height: MediaQuery.of(context).size.height *0.10, - decoration: BoxDecoration( - border: Border( - right: BorderSide(width: 1.5, color: kSecond), - ), - ), - child: Center(child: AutoSizeText(language.toUpperCase())) - ), - Padding( - padding: const EdgeInsets.only(left: 8.0), - child: Container( - width: MediaQuery.of(context).size.width *0.5, - height: MediaQuery.of(context).size.height *0.5, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - !isAudio ? - Column( - children: [ - ToolBar( - toolBarColor: Colors.cyan.shade50, - activeIconColor: Colors.green, - padding: const EdgeInsets.all(8), - iconSize: 20, - toolBarConfig: customToolBarList, - controller: controllerQuill, - customButtons: [], - ), - QuillHtmlEditor( - text: newValues.where((element) => element.language == language).first.value!, - hintText: 'Hint text goes here', - controller: controllerQuill, - isEnabled: true, - minHeight: 300, - /*textStyle: _editorTextStyle, - hintTextStyle: _hintTextStyle,*/ - hintTextAlign: TextAlign.start, - padding: const EdgeInsets.only(left: 10, top: 5), - hintTextPadding: EdgeInsets.zero, - backgroundColor: kSecond, - onFocusChanged: (hasFocus) => debugPrint('has focus $hasFocus'), - //onTextChanged: (text) => debugPrint('widget text change $text'), - onTextChanged: (value) { - newValues.where((element) => element.language == language).first.value = value; - }, - onEditorCreated: () => debugPrint('Editor has been loaded'), - onEditorResized: (height) => - debugPrint('Editor resized $height'), - onSelectionChanged: (sel) => - debugPrint('${sel.index},${sel.length}'), - ), - ], - ) - /*HtmlEditor( - controller: controller, - htmlEditorOptions: HtmlEditorOptions( - hint: "Your text here...", - initialText: newValues.where((element) => element.language == language).first.value!, - shouldEnsureVisible: true, - ), - htmlToolbarOptions: HtmlToolbarOptions( - toolbarPosition: ToolbarPosition.aboveEditor, //required to place toolbar anywhere! - //other options - ), - otherOptions: OtherOptions( - height: 400, - ), - )*/ - /*TextFormInputContainer( - label: label, - color: kWhite, - isTitle: isTitle, - initialValue: newValues.where((element) => element.language == language).first.value!, - onChanged: (value) { - newValues.where((element) => element.language == language).first.value = value; - }, - )*/ : - Container( - width: 250, - height: 120, - child: AudioInputContainer( - label: "Audio :", - initialValue: newValues.where((element) => element.language == language).first.value, - color: kPrimaryColor, - onChanged: (ResourceDTO resource) { - newValues.where((element) => element.language == language).first.value = resource.id; - }, - ), - ), - ], - ), + width: 180, + height: 70, + child: RoundedButton( + text: "Annuler", + icon: Icons.undo, + color: kSecond, + press: () { + onGetResult(values); + Navigator.of(context).pop(); + }, + fontSize: 20, ), - ) + ), + Container( + width: 180, + height: 70, + child: RoundedButton( + text: "Valider", + icon: Icons.check, + color: kPrimaryColor, + textColor: kWhite, + press: () { + Function deepEq = const DeepCollectionEquality().equals; + if (!deepEq(values, newValues)) { + onGetResult(newValues); + } + Navigator.of(context).pop(); + }, + fontSize: 20, + ), + ), ], ), - ) - ); - //} - return translations; + ], + ); + }, context: context + ); } -/* -showValues(List newValues) { - List valuesToShow = new List(); - newValues.forEach((newValue) { - valuesToShow.add( - new StringInputContainer( - color: Colors.lightBlue, - label: newValue.language, - initialValue: newValue.value, - onChanged: (String value) { - newValue.value = value; - }, - )); - }); - return valuesToShow; -}*/ diff --git a/lib/Components/translation_input_container.dart b/lib/Components/translation_input_container.dart new file mode 100644 index 0000000..d1805af --- /dev/null +++ b/lib/Components/translation_input_container.dart @@ -0,0 +1,239 @@ +import 'package:flutter/material.dart'; +import 'package:manager_api_new/api.dart'; +import 'package:manager_app/Components/audio_input_container.dart'; +import 'package:manager_app/app_context.dart'; +import 'package:manager_app/constants.dart'; +import 'package:provider/provider.dart'; +import 'package:quill_html_editor/quill_html_editor.dart'; + +import 'flag_decoration.dart'; + +class _TranslationInputContainerState extends State with TickerProviderStateMixin { + TabController? _tabController; + QuillEditorController controllerQuill = QuillEditorController(); + ValueNotifier? currentLanguage; + + @override + void initState() { + super.initState(); + _tabController = new TabController(length: widget.newValues.length, vsync: this); + currentLanguage = ValueNotifier(widget.newValues.first.language!); + controllerQuill.insertText(widget.newValues[_tabController!.index].value!); + + controllerQuill.onTextChanged((p0) async { + var plainText = await controllerQuill.getPlainText(); + if(widget.isTitle) { + if(plainText.length > 60) { + print("to much text au dessus"); + controllerQuill.undo(); + } + } else { + if(plainText.length > 2500) { + print("to much text description au dessus"); + controllerQuill.undo(); + } + } + }); + + _tabController!.addListener(() { + if (!_tabController!.indexIsChanging) { + setState(() { + currentLanguage!.value = widget.newValues[_tabController!.index].language; + if(!widget.isAudio) { + controllerQuill.clear(); + controllerQuill.insertText(widget.newValues[_tabController!.index].value!); + } + }); + } + }); + } + + @override + void dispose() { + super.dispose(); + _tabController!.dispose(); + } + + getTranslation(BuildContext context, AppContext appContext, QuillEditorController controllerQuill, List customToolBarList, bool isTitle, bool isAudio, List newValues, ValueNotifier currentLanguage) { + return Padding( + padding: const EdgeInsets.all(6.0), + child: Padding( + padding: const EdgeInsets.only(left: 8.0), + child: Container( + width: MediaQuery.of(context).size.width *0.7, + height: widget.isTitle ? MediaQuery.of(context).size.height *0.25 : MediaQuery.of(context).size.height *0.4, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + !isAudio ? + Column( + children: [ + ToolBar( + toolBarColor: kSecond, + activeIconColor: kPrimaryColor, + padding: const EdgeInsets.all(8), + iconSize: 20, + toolBarConfig: customToolBarList, + controller: controllerQuill, + customButtons: [], + ), + SingleChildScrollView( + child: Container( + height: widget.isTitle ? MediaQuery.of(context).size.height *0.13 : MediaQuery.of(context).size.height *0.35, + child: QuillHtmlEditor( + text: newValues.where((element) => element.language! == currentLanguage.value).first.value!, + //hintText: 'Hint text goes here', + controller: controllerQuill, + minHeight: widget.isTitle ? 80 : 240, + /*textStyle: _editorTextStyle, + hintTextStyle: _hintTextStyle,*/ + hintTextAlign: TextAlign.start, + padding: const EdgeInsets.only(left: 10, right: 10, top: 5), + hintTextPadding: EdgeInsets.zero, + backgroundColor: kBackgroundColor, + ensureVisible: true, + inputAction: widget.isTitle ? InputAction.send : InputAction.newline, // don't accept enter if title + onFocusChanged: (hasFocus) => debugPrint('has focus $hasFocus'), + //onTextChanged: (text) => debugPrint('widget text change $text'), + onTextChanged: (value) { + newValues.where((element) => element.language! == currentLanguage.value).first.value = value; + }, + onEditorCreated: () => debugPrint('Editor has been loaded'), + onEditorResized: (height) => + debugPrint('Editor resized $height'), + onSelectionChanged: (sel) => + debugPrint('${sel.index},${sel.length}'), + ), + ), + ), + ], + ) + /*HtmlEditor( + controller: controller, + htmlEditorOptions: HtmlEditorOptions( + hint: "Your text here...", + initialText: newValues.where((element) => element.language == language).first.value!, + shouldEnsureVisible: true, + ), + htmlToolbarOptions: HtmlToolbarOptions( + toolbarPosition: ToolbarPosition.aboveEditor, //required to place toolbar anywhere! + //other options + ), + otherOptions: OtherOptions( + height: 400, + ), + )*/ + /*TextFormInputContainer( + label: label, + color: kWhite, + isTitle: isTitle, + initialValue: newValues.where((element) => element.language == language).first.value!, + onChanged: (value) { + newValues.where((element) => element.language == language).first.value = value; + }, + )*/ : + Container( + width: 250, + height: 120, + child: ValueListenableBuilder( + valueListenable: currentLanguage, + builder: (context, value, _) { + return AudioInputContainer( + //label: "Audio :", + initialValue: newValues.where((element) => element.language! == value).first.value, + color: kPrimaryColor, + onChanged: (ResourceDTO resource) { + newValues.where((element) => element.language! == value).first.value = resource.id; + }, + ); + }, + ), + ), + ], + ), + ), + ), + ); + } + + @override + Widget build(BuildContext context) { + final customToolBarList = widget.isTitle ? [ + ToolBarStyle.bold, + ToolBarStyle.italic, + ToolBarStyle.color, + ToolBarStyle.background, + ToolBarStyle.clean + ] : [ + ToolBarStyle.bold, + ToolBarStyle.italic, + ToolBarStyle.align, + ToolBarStyle.color, + ToolBarStyle.background, + ToolBarStyle.listBullet, + ToolBarStyle.listOrdered, + ToolBarStyle.clean + ]; + + return Container( + height: widget.isTitle ? MediaQuery.of(context).size.height *0.35 : MediaQuery.of(context).size.height *0.53, + width: MediaQuery.of(context).size.width *0.7, + constraints: BoxConstraints( + minHeight: 200, + minWidth: 300 + ), + child: DefaultTabController( + length: widget.newValues.length, + child: Column( + children: [ + RotatedBox( + quarterTurns: 0, // Can be used to test vertical tab in case of smaller screen + child: TabBar( + indicatorColor: kPrimaryColor, + //overlayColor: MaterialStateProperty().c, + labelColor: kPrimaryColor, + unselectedLabelColor: Colors.black, + controller: _tabController, + tabs: widget.newValues.map((v) => Tab(icon: FlagDecoration(language: v.language!))).toList(), // text: v.language!.toUpperCase(), + ), + ), + getTranslation(context, Provider.of(context), controllerQuill, customToolBarList, widget.isTitle, widget.isAudio, widget.newValues, currentLanguage!) + /*TabContainer( + radius: 0, + tabs: values.map((v) => v.language!.toUpperCase()).toList(), + children: getTranslations(context, Provider.of(context), controllerQuill, customToolBarList, label, isTitle, isAudio, newValues), + + /*child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: getTranslations(context, Provider.of(context), controllerQuill, label, isTitle, isAudio, newValues), + ),*/ + ),*/ + ], + ), + ), + ); + } +} + +class TranslationInputContainer extends StatefulWidget { + TranslationInputContainer({ + Key? key, + required this.isTitle, + required this.values, + required this.newValues, + required this.onGetResult, + required this.maxLines, + required this.isAudio, + }) : super(key: key); + + bool isTitle; + List values; + List newValues; + Function onGetResult; + int maxLines; + bool isAudio; + + @override + State createState() => _TranslationInputContainerState(); +} diff --git a/lib/Screens/Configurations/Section/SubSection/Article/article_config.dart b/lib/Screens/Configurations/Section/SubSection/Article/article_config.dart index 8b5d60c..58c9ba5 100644 --- a/lib/Screens/Configurations/Section/SubSection/Article/article_config.dart +++ b/lib/Screens/Configurations/Section/SubSection/Article/article_config.dart @@ -83,6 +83,7 @@ class _ArticleConfigState extends State { label: "Contenu affiché :", modalLabel: "Contenu", color: kPrimaryColor, + isHTML: true, initialValue: articleDTO != null ? articleDTO.content! : [], isTitle: false, onGetResult: (value) { diff --git a/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart b/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart index 3e1d2ed..a6840d8 100644 --- a/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart @@ -1,5 +1,6 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; +import 'package:manager_app/Components/multi_string_input_container.dart'; import 'package:manager_app/Components/rounded_button.dart'; import 'package:manager_app/Components/string_input_container.dart'; import 'package:manager_app/Components/text_form_input_container.dart'; @@ -63,11 +64,48 @@ void showNewOrUpdateGeoPoint(GeoPointDTO? inputGeoPointDTO, Function getResult, ], ), Container( - height: size.height * 0.33, + height: size.height * 0.2, width: double.infinity, - child: ListView( - scrollDirection: Axis.horizontal, - children: getTranslations(context, appContext, geoPointDTO), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + constraints: BoxConstraints(minHeight: 50, maxHeight: 80), + child: MultiStringInputContainer( + label: "Titre affiché:", + modalLabel: "Titre", + fontSize: 20, + isHTML: true, + color: kPrimaryColor, + initialValue: geoPointDTO.title != null ? geoPointDTO.title! : [], + onGetResult: (value) { + if (geoPointDTO.title != value) { + geoPointDTO.title = value; + } + }, + maxLines: 1, + isTitle: true + ), + ), + Container( + constraints: BoxConstraints(minHeight: 50, maxHeight: 80), + child: MultiStringInputContainer( + label: "Description affichée:", + modalLabel: "Description", + fontSize: 20, + isHTML: true, + color: kPrimaryColor, + initialValue: geoPointDTO.description != null ? geoPointDTO.description! : [], + onGetResult: (value) { + if (geoPointDTO.description != value) { + geoPointDTO.description = value; + } + }, + maxLines: 1, + isTitle: false + ), + ), + ], ), ), Container( @@ -148,63 +186,3 @@ void showNewOrUpdateGeoPoint(GeoPointDTO? inputGeoPointDTO, Function getResult, ), context: context ); } - -getTranslations(BuildContext context, AppContext appContext, GeoPointDTO geoPointDTO) { - List translations = []; - ManagerAppContext managerAppContext = appContext.getContext(); - for(var language in managerAppContext.selectedConfiguration!.languages!) { - translations.add( - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - width: MediaQuery.of(context).size.width *0.05, - height: MediaQuery.of(context).size.height *0.2, - decoration: BoxDecoration( - border: Border( - right: BorderSide(width: 1.5, color: kSecond), - ), - ), - child: Center(child: AutoSizeText(language.toUpperCase())) - ), - Padding( - padding: const EdgeInsets.only(left: 8.0), - child: Container( - child: SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - TextFormInputContainer( - label: "Titre:", - color: kWhite, - isTitle: true, - initialValue: geoPointDTO.title!.where((element) => element.language == language).first.value!, - onChanged: (value) { - geoPointDTO.title!.where((element) => element.language == language).first.value = value; - }, - ), - TextFormInputContainer( - label: "Description:", - color: kWhite, - isTitle: false, - initialValue: geoPointDTO.description!.where((element) => element.language == language).first.value!, - onChanged: (value) { - geoPointDTO.description!.where((element) => element.language == language).first.value = value; - }, - ), - ], - ), - ), - ), - ) - ], - ), - ) - ); - } - return translations; -} - diff --git a/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart b/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart index 55fd67d..b1af686 100644 --- a/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart +++ b/lib/Screens/Configurations/Section/SubSection/Menu/showEditSubSection.dart @@ -1,6 +1,7 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:manager_app/Components/image_input_container.dart'; import 'package:flutter/material.dart'; +import 'package:manager_app/Components/multi_string_input_container.dart'; import 'package:manager_app/Components/rounded_button.dart'; import 'package:manager_app/Components/string_input_container.dart'; import 'package:manager_app/Components/text_form_input_container.dart'; @@ -60,12 +61,50 @@ void showEditSubSection(SectionDTO subSectionDTO, Function getResult, AppContext ], ), Container( - height: size.height * 0.33, + height: size.height * 0.1, width: double.infinity, - child: ListView( - scrollDirection: Axis.horizontal, - children: getTranslations(context, appContext, subSectionDTO), - ), + constraints: BoxConstraints(minHeight: 50), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + constraints: BoxConstraints(minHeight: 50, maxHeight: 80), + child: MultiStringInputContainer( + label: "Titre affiché:", + modalLabel: "Titre", + fontSize: 20, + isHTML: true, + color: kPrimaryColor, + initialValue: subSectionDTO.title != null ? subSectionDTO.title! : [], + onGetResult: (value) { + if (subSectionDTO.title != value) { + subSectionDTO.title = value; + } + }, + maxLines: 1, + isTitle: true + ), + ), + Container( + constraints: BoxConstraints(minHeight: 50, maxHeight: 80), + child: MultiStringInputContainer( + label: "Description affichée:", + modalLabel: "Description", + fontSize: 20, + isHTML: true, + color: kPrimaryColor, + initialValue: subSectionDTO.description != null ? subSectionDTO.description! : [], + onGetResult: (value) { + if (subSectionDTO.description != value) { + subSectionDTO.description = value; + } + }, + maxLines: 1, + isTitle: false + ), + ), + ], + ) ), Container( decoration: BoxDecoration( @@ -182,64 +221,3 @@ getSpecificData(SectionDTO sectionDTO, BuildContext context, AppContext appConte ); } } - -getTranslations(BuildContext context, AppContext appContext, SectionDTO subSectionDTO) { - List translations = []; - ManagerAppContext managerAppContext = appContext.getContext(); - for(var language in managerAppContext.selectedConfiguration!.languages!) { - translations.add( - SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - width: MediaQuery.of(context).size.width *0.05, - height: MediaQuery.of(context).size.height *0.2, - decoration: BoxDecoration( - border: Border( - right: BorderSide(width: 1.5, color: kSecond), - ), - ), - child: Center(child: AutoSizeText(language.toUpperCase())) - ), - Padding( - padding: const EdgeInsets.only(left: 8.0), - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - TextFormInputContainer( - label: "Titre:", - color: kWhite, - isTitle: true, - maxLines: 1, - initialValue: subSectionDTO.title!.where((element) => element.language == language).first.value!, - onChanged: (value) { - subSectionDTO.title!.where((element) => element.language == language).first.value = value; - }, - ), - TextFormInputContainer( - label: "Description:", - color: kWhite, - isTitle: false, - initialValue: subSectionDTO.description!.where((element) => element.language == language).first.value!, - onChanged: (value) { - subSectionDTO.description!.where((element) => element.language == language).first.value = value; - }, - ), - ], - ), - ), - ) - ], - ), - ), - ) - ); - } - return translations; -} - diff --git a/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_question_quizz.dart b/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_question_quizz.dart index 5620579..e2c6142 100644 --- a/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_question_quizz.dart +++ b/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_question_quizz.dart @@ -2,6 +2,7 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:manager_app/Components/image_input_container.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Components/message_notification.dart'; +import 'package:manager_app/Components/multi_string_input_container.dart'; import 'package:manager_app/Components/rounded_button.dart'; import 'package:manager_app/Components/text_form_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; @@ -48,30 +49,48 @@ Future showNewOrUpdateQuestionQuizz(QuestionDTO? inputQuestionDTO, Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Center( - child: ImageInputContainer( - label: "Image :", - initialValue: questionDTO.resourceId, - color: kPrimaryColor, - onChanged: (ResourceDTO resource) { - if(resource.id == null) { - questionDTO.resourceId = null; - questionDTO.source_ = null; - } else { - questionDTO.resourceId = resource.id; - questionDTO.source_ = resource.type == ResourceType.ImageUrl ? resource.data : (appContext.getContext() as ManagerAppContext).clientAPI!.resourceApi!.apiClient.basePath+"/api/Resource/"+ resource.id!; - } - }, - isSmall: true - ), - ), Container( - //color: Colors.orangeAccent, - height: size.height * 0.15, - width: double.infinity, - child: ListView( - scrollDirection: Axis.horizontal, - children: getTranslations(dialogContext, appContext, questionDTO), + height: size.height*0.25, + constraints: BoxConstraints(minHeight: 100, maxHeight: 150), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + ImageInputContainer( + label: "Image :", + initialValue: questionDTO.resourceId, + color: kPrimaryColor, + onChanged: (ResourceDTO resource) { + if(resource.id == null) { + questionDTO.resourceId = null; + questionDTO.source_ = null; + } else { + questionDTO.resourceId = resource.id; + questionDTO.source_ = resource.type == ResourceType.ImageUrl ? resource.data : (appContext.getContext() as ManagerAppContext).clientAPI!.resourceApi!.apiClient.basePath+"/api/Resource/"+ resource.id!; + } + }, + isSmall: true + ), + Container( + //color: Colors.orangeAccent, + height: size.height * 0.15, + constraints: BoxConstraints(minHeight: 50, maxHeight: 80), + child: MultiStringInputContainer( + label: "Question:", + modalLabel: "Question", + fontSize: 20, + isHTML: true, + color: kPrimaryColor, + initialValue: questionDTO.label != null ? questionDTO.label! : [], + onGetResult: (value) { + if (questionDTO.label != value) { + questionDTO.label = value; + } + }, + maxLines: 1, + isTitle: true + ), + ), + ], ), ), Container( @@ -152,54 +171,3 @@ Future showNewOrUpdateQuestionQuizz(QuestionDTO? inputQuestionDTO, ); return result; } - -getTranslations(BuildContext context, AppContext appContext, QuestionDTO questionDTO) { - List translations = []; - ManagerAppContext managerAppContext = appContext.getContext(); - for(var language in managerAppContext.selectedConfiguration!.languages!) { - translations.add( - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - width: MediaQuery.of(context).size.width *0.05, - height: MediaQuery.of(context).size.height *0.2, - decoration: BoxDecoration( - border: Border( - right: BorderSide(width: 1.5, color: kSecond), - ), - ), - child: Center(child: AutoSizeText(language.toUpperCase())) - ), - Padding( - padding: const EdgeInsets.only(left: 8.0), - child: Container( - child: SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - TextFormInputContainer( - label: "Question:", - color: kWhite, - isTitle: false, - initialValue: questionDTO.label!.where((element) => element.language == language).first.value!, - onChanged: (value) { - questionDTO.label!.where((element) => element.language == language).first.value = value; - }, - ), - ], - ), - ), - ), - ) - ], - ), - ) - ); - } - return translations; -} - diff --git a/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_response_quizz.dart b/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_response_quizz.dart index d9643ec..fb0038e 100644 --- a/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_response_quizz.dart +++ b/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_response_quizz.dart @@ -1,6 +1,7 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:manager_app/Components/message_notification.dart'; +import 'package:manager_app/Components/multi_string_input_container.dart'; import 'package:manager_app/Components/rounded_button.dart'; import 'package:manager_app/Components/text_form_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; @@ -27,6 +28,9 @@ Future showNewOrUpdateResponseQuizz(ResponseDTO? inputResponseDTO, } Size size = MediaQuery.of(context).size; + + //showMultiStringInputHTML("Réponse", "Modifier la réponse:", false, initials, newValues, onGetResult, 1, false, context); + var result = await showDialog( builder: (BuildContext dialogContext) => AlertDialog( shape: RoundedRectangleBorder( @@ -39,18 +43,27 @@ Future showNewOrUpdateResponseQuizz(ResponseDTO? inputResponseDTO, mainAxisAlignment: MainAxisAlignment.center, children: [ Text(text, style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)), - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - height: size.height * 0.25, - width: double.infinity, - child: ListView( - scrollDirection: Axis.horizontal, - children: getTranslations(dialogContext, appContext, responseDTO), - ), + Container( + height: size.height * 0.25, + width: double.infinity, + child: Container( + constraints: BoxConstraints(minHeight: 50, maxHeight: 80), + child: MultiStringInputContainer( + label: "Modifier la réponse:", + modalLabel: "Réponse", + fontSize: 20, + isHTML: true, + color: kPrimaryColor, + initialValue: responseDTO.label != null ? responseDTO.label! : [], + onGetResult: (value) { + if (responseDTO.label != value) { + responseDTO.label = value; + } + }, + maxLines: 1, + isTitle: true ), - ], + ), ), /*Row( mainAxisAlignment: MainAxisAlignment.center, @@ -124,54 +137,3 @@ Future showNewOrUpdateResponseQuizz(ResponseDTO? inputResponseDTO, ); return result; } - -getTranslations(BuildContext context, AppContext appContext, ResponseDTO responseDTO) { - List translations = []; - ManagerAppContext managerAppContext = appContext.getContext(); - for(var language in managerAppContext.selectedConfiguration!.languages!) { - translations.add( - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - width: MediaQuery.of(context).size.width *0.05, - height: MediaQuery.of(context).size.height *0.2, - decoration: BoxDecoration( - border: Border( - right: BorderSide(width: 1.5, color: kSecond), - ), - ), - child: Center(child: AutoSizeText(language.toUpperCase())) - ), - Padding( - padding: const EdgeInsets.only(left: 8.0), - child: Container( - child: SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - TextFormInputContainer( - label: "Réponse:", - color: kWhite, - isTitle: true, - initialValue: responseDTO.label!.where((element) => element.language == language).first.value!, - onChanged: (value) { - responseDTO.label!.where((element) => element.language == language).first.value = value; - }, - ), - ], - ), - ), - ), - ) - ], - ), - ) - ); - } - return translations; -} - diff --git a/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_score_quizz.dart b/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_score_quizz.dart index 4e08b62..61a6f6d 100644 --- a/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_score_quizz.dart +++ b/lib/Screens/Configurations/Section/SubSection/Quizz/new_update_score_quizz.dart @@ -1,6 +1,7 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:manager_app/Components/image_input_container.dart'; import 'package:flutter/material.dart'; +import 'package:manager_app/Components/multi_string_input_container.dart'; import 'package:manager_app/Components/rounded_button.dart'; import 'package:manager_app/Components/text_form_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; @@ -39,8 +40,8 @@ Future showNewOrUpdateScoreQuizz(LevelDTO? inputLevelDTO, AppContext mainAxisAlignment: MainAxisAlignment.center, children: [ Text(text, style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)), - Column( - mainAxisAlignment: MainAxisAlignment.center, + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Center( child: ImageInputContainer( @@ -60,12 +61,23 @@ Future showNewOrUpdateScoreQuizz(LevelDTO? inputLevelDTO, AppContext ), ), Container( - height: size.height * 0.33, - width: double.infinity, - child: ListView( - scrollDirection: Axis.horizontal, - children: getTranslations(dialogContext, appContext, levelDTO), - ), + height: size.height * 0.2, + constraints: BoxConstraints(minHeight: 50, maxHeight: 80), + child: MultiStringInputContainer( + label: "Message:", + modalLabel: "Message", + fontSize: 20, + isHTML: true, + color: kPrimaryColor, + initialValue: levelDTO.label != null ? levelDTO.label! : [], + onGetResult: (value) { + if (levelDTO.label != value) { + levelDTO.label = value; + } + }, + maxLines: 1, + isTitle: true + ) ), ], ), @@ -117,54 +129,3 @@ Future showNewOrUpdateScoreQuizz(LevelDTO? inputLevelDTO, AppContext ); return result; } - -getTranslations(BuildContext context, AppContext appContext, LevelDTO levelDTO) { - List translations = []; - ManagerAppContext managerAppContext = appContext.getContext(); - for(var language in managerAppContext.selectedConfiguration!.languages!) { - translations.add( - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - width: MediaQuery.of(context).size.width *0.05, - height: MediaQuery.of(context).size.height *0.2, - decoration: BoxDecoration( - border: Border( - right: BorderSide(width: 1.5, color: kSecond), - ), - ), - child: Center(child: AutoSizeText(language.toUpperCase())) - ), - Padding( - padding: const EdgeInsets.only(left: 8.0), - child: Container( - child: SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - TextFormInputContainer( - label: "Message:", - color: kWhite, - isTitle: false, - initialValue: levelDTO.label!.where((element) => element.language == language).first.value!, - onChanged: (value) { - levelDTO.label!.where((element) => element.language == language).first.value = value; - }, - ), - ], - ), - ), - ), - ) - ], - ), - ) - ); - } - return translations; -} - diff --git a/lib/Screens/Configurations/Section/SubSection/Quizz/quizz_answer_list.dart b/lib/Screens/Configurations/Section/SubSection/Quizz/quizz_answer_list.dart index 12f9bf3..3ecfd2d 100644 --- a/lib/Screens/Configurations/Section/SubSection/Quizz/quizz_answer_list.dart +++ b/lib/Screens/Configurations/Section/SubSection/Quizz/quizz_answer_list.dart @@ -1,5 +1,9 @@ +import 'dart:convert'; + import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; +import 'package:manager_app/Components/multi_string_input_html_modal.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:manager_api_new/api.dart'; @@ -137,11 +141,10 @@ class _QuizzResponseListState extends State { Center( child: Padding( padding: const EdgeInsets.all(2.0), - child: AutoSizeText( - response.label == null ? "" : response.label![0].value!, - style: new TextStyle(fontSize: 15), - maxLines: 2, - textAlign: TextAlign.center, + child: HtmlWidget( + response.label == null ? "" : response.label![0].value!, + //textAlign: TextAlign.left, + textStyle: TextStyle(fontSize: 15) ), ), ), @@ -174,19 +177,31 @@ class _QuizzResponseListState extends State { message: "Modifier", child: InkWell( onTap: () async { - var result = await showNewOrUpdateResponseQuizz( - response, - appContext, - context, - "Modifier la réponse" - ); + List newValues = []; - if (result != null) { - setState(() { - responsesMiddle[response.order!] = result; - widget.onChanged(responsesMiddle); - }); + List initials = response.label!; + if(initials == null) { + initials = []; } + + languages.forEach((value) { + if(initials.map((iv) => iv.language).contains(value)) { + newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(initials.firstWhere((element) => element.language == value)))!)!); + } else { + // New language + newValues.add(TranslationDTO(language: value, value: null)); + } + }); + + showMultiStringInputHTML("Réponse", "Modifier la réponse", true, initials, newValues, (value) { + setState(() { + if (response.label! != value) { + response.label = value; + responsesMiddle[response.order!] = value; + widget.onChanged(responsesMiddle); + } + }); + }, 1, false, context); }, child: Padding( padding: const EdgeInsets.all(8.0), diff --git a/lib/Screens/Configurations/Section/SubSection/Slider/listView_card_image.dart b/lib/Screens/Configurations/Section/SubSection/Slider/listView_card_image.dart index 15987ff..3c9a552 100644 --- a/lib/Screens/Configurations/Section/SubSection/Slider/listView_card_image.dart +++ b/lib/Screens/Configurations/Section/SubSection/Slider/listView_card_image.dart @@ -4,6 +4,7 @@ import 'package:manager_app/Screens/Configurations/Section/SubSection/Slider/new import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:manager_api_new/api.dart'; +import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; class ListViewCardImage extends StatefulWidget { final int index; @@ -46,11 +47,16 @@ class _ListViewCard extends State { padding: const EdgeInsets.only(right: 20.0), child: Column( children: [ - AutoSizeText( + HtmlWidget( + widget.listItems[widget.index].title == null ? "" : widget.listItems[widget.index].title![0].value!, + //textAlign: TextAlign.left, + textStyle: TextStyle(fontSize: 15) + ), + /*AutoSizeText( widget.listItems[widget.index].title == null ? "" : widget.listItems[widget.index].title![0].value!, style: new TextStyle(fontSize: 15), maxLines: 1, - ), + ),*/ Center( child: Container( height: MediaQuery.of(context).size.height * 0.1, diff --git a/lib/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart b/lib/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart index f61cfae..ab69351 100644 --- a/lib/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart +++ b/lib/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart @@ -1,6 +1,7 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:manager_app/Components/image_input_container.dart'; import 'package:flutter/material.dart'; +import 'package:manager_app/Components/multi_string_input_container.dart'; import 'package:manager_app/Components/rounded_button.dart'; import 'package:manager_app/Components/text_form_input_container.dart'; import 'package:manager_app/Models/managerContext.dart'; @@ -39,7 +40,8 @@ Future showNewOrUpdateImageSlider(ImageDTO? inputImageDTO, AppContext borderRadius: BorderRadius.all(Radius.circular(20.0)) ), content: Container( - width: size.width *0.5, + width: size.width *0.35, + constraints: BoxConstraints(minWidth: 300), child: SingleChildScrollView( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -53,6 +55,7 @@ Future showNewOrUpdateImageSlider(ImageDTO? inputImageDTO, AppContext label: "Image :", initialValue: imageDTO.resourceId, color: kPrimaryColor, + fontSize: 20, onChanged: (ResourceDTO resource) { if(resource.id == null) { imageDTO.resourceId = null; @@ -67,12 +70,43 @@ Future showNewOrUpdateImageSlider(ImageDTO? inputImageDTO, AppContext ), if(showTitle || showDescription) Container( - height: size.height * 0.33, + height: size.height * 0.2, width: double.infinity, - child: ListView( - scrollDirection: Axis.horizontal, - children: getTranslations(dialogContext, appContext, imageDTO, showTitle, showDescription), - ), + constraints: BoxConstraints(minHeight: 150), + child: Column( + children: [ + MultiStringInputContainer( + label: "Titre affiché:", + modalLabel: "Titre", + fontSize: 20, + isHTML: true, + color: kPrimaryColor, + initialValue: imageDTO.title != null ? imageDTO.title! : [], + onGetResult: (value) { + if (imageDTO.title != value) { + imageDTO.title = value; + } + }, + maxLines: 1, + isTitle: true + ), + MultiStringInputContainer( + label: "Description affichée:", + modalLabel: "Description", + fontSize: 20, + isHTML: true, + color: kPrimaryColor, + initialValue: imageDTO.description != null ? imageDTO.description! : [], + onGetResult: (value) { + if (imageDTO.description != value) { + imageDTO.description = value; + } + }, + maxLines: 1, + isTitle: false + ), + ], + ) ), ], ), @@ -127,82 +161,3 @@ Future showNewOrUpdateImageSlider(ImageDTO? inputImageDTO, AppContext return result; } - -getTranslations(BuildContext context, AppContext appContext, ImageDTO imageDTO, bool showTitle, bool showDescription) { - List translations = []; - ManagerAppContext managerAppContext = appContext.getContext(); - for(var language in managerAppContext.selectedConfiguration!.languages!) { - - if(imageDTO.title!.where((element) => element.language == language).length == 0) { - imageDTO.title = []; - var translationTitleDTO = new TranslationDTO(); - translationTitleDTO.language = language; - translationTitleDTO.value = ""; - imageDTO.title!.add(translationTitleDTO); - } - - if(imageDTO.description!.where((element) => element.language == language).length == 0) { - imageDTO.description = []; - var translationDescriptionDTO = new TranslationDTO(); - translationDescriptionDTO.language = language; - translationDescriptionDTO.value = ""; - imageDTO.description!.add(translationDescriptionDTO); - } - - translations.add( - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - width: MediaQuery.of(context).size.width *0.05, - height: MediaQuery.of(context).size.height *0.2, - decoration: BoxDecoration( - border: Border( - right: BorderSide(width: 1.5, color: kSecond), - ), - ), - child: Center(child: AutoSizeText(language.toUpperCase())) - ), - Padding( - padding: const EdgeInsets.only(left: 8.0), - child: Container( - child: SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - if(showTitle) - TextFormInputContainer( - label: "Titre:", - color: kWhite, - isTitle: true, - initialValue: imageDTO.title!.where((element) => element.language == language).first.value!, - onChanged: (value) { - imageDTO.title!.where((element) => element.language == language).first.value = value; - }, - ), - if(showDescription) - TextFormInputContainer( - label: "Description:", - color: kWhite, - isTitle: false, - initialValue: imageDTO.description!.where((element) => element.language == language).first.value!, - onChanged: (value) { - imageDTO.description!.where((element) => element.language == language).first.value = value; - }, - ), - ], - ), - ), - ), - ) - ], - ), - ) - ); - } - return translations; -} - diff --git a/lib/Screens/Configurations/Section/section_detail_screen.dart b/lib/Screens/Configurations/Section/section_detail_screen.dart index 746a852..12006e2 100644 --- a/lib/Screens/Configurations/Section/section_detail_screen.dart +++ b/lib/Screens/Configurations/Section/section_detail_screen.dart @@ -250,6 +250,7 @@ class _SectionDetailScreenState extends State { label: "Description affichée:", modalLabel: "Description", color: kPrimaryColor, + isHTML: true, initialValue: sectionDTO != null ? sectionDTO.description! : [], onGetResult: (value) { if (sectionDTO!.description != value) { diff --git a/lib/Screens/Configurations/configuration_detail_screen.dart b/lib/Screens/Configurations/configuration_detail_screen.dart index 1b1f379..d2e8337 100644 --- a/lib/Screens/Configurations/configuration_detail_screen.dart +++ b/lib/Screens/Configurations/configuration_detail_screen.dart @@ -269,6 +269,7 @@ class _ConfigurationDetailScreenState extends State { label: "Titre affiché:", modalLabel: "Titre", fontSize: 20, + isHTML: true, color: kPrimaryColor, initialValue: configurationDTO != null ? configurationDTO.title! : [], onGetResult: (value) { diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index d21238c..1560fc8 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -7,9 +7,13 @@ #include "generated_plugin_registrant.h" #include +#include void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) pasteboard_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "PasteboardPlugin"); pasteboard_plugin_register_with_registrar(pasteboard_registrar); + g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); + url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); } diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index c242e0a..5a3c388 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST pasteboard + url_launcher_linux ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 9b15cc8..d4702a9 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -10,6 +10,10 @@ import just_audio import package_info_plus import pasteboard import path_provider_foundation +import sqflite +import url_launcher_macos +import video_player_avfoundation +import wakelock_plus func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin")) @@ -17,4 +21,8 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) + FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin")) + WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index 612a692..23ff367 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -153,6 +153,30 @@ packages: url: "https://pub.dev" source: hosted version: "8.6.3" + cached_network_image: + dependency: transitive + description: + name: cached_network_image + sha256: f98972704692ba679db144261172a8e20feb145636c617af0eb4022132a6797f + url: "https://pub.dev" + source: hosted + version: "3.3.0" + cached_network_image_platform_interface: + dependency: transitive + description: + name: cached_network_image_platform_interface + sha256: "56aa42a7a01e3c9db8456d9f3f999931f1e05535b5a424271e9a38cabf066613" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + cached_network_image_web: + dependency: transitive + description: + name: cached_network_image_web + sha256: "759b9a9f8f6ccbb66c185df805fac107f05730b1dab9c64626d1008cca532257" + url: "https://pub.dev" + source: hosted + version: "1.1.0" characters: dependency: transitive description: @@ -169,6 +193,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" + chewie: + dependency: transitive + description: + name: chewie + sha256: ccfce3350ae9fd419cd336cdf3380f77a08e45171e1e3cb3d499d204de5e7ea8 + url: "https://pub.dev" + source: hosted + version: "1.7.1" clock: dependency: transitive description: @@ -209,6 +241,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.3" + csslib: + dependency: transitive + description: + name: csslib + sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + url: "https://pub.dev" + source: hosted + version: "1.0.0" cupertino_icons: dependency: "direct main" description: @@ -225,6 +265,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.2" + dbus: + dependency: transitive + description: + name: dbus + sha256: "6f07cba3f7b3448d42d015bfd3d53fe12e5b36da2423f23838efc1d5fb31a263" + url: "https://pub.dev" + source: hosted + version: "0.7.8" diacritic: dependency: "direct main" description: @@ -302,6 +350,14 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_cache_manager: + dependency: transitive + description: + name: flutter_cache_manager + sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba" + url: "https://pub.dev" + source: hosted + version: "3.3.1" flutter_colorpicker: dependency: "direct main" description: @@ -318,6 +374,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.17" + flutter_svg: + dependency: transitive + description: + name: flutter_svg + sha256: bfc7cc3c75fe1282e8ce2e056d8fd1533f1a6848b65c379b4a5e7a9b623d3371 + url: "https://pub.dev" + source: hosted + version: "2.0.8" flutter_test: dependency: "direct dev" description: flutter @@ -328,6 +392,22 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_widget_from_html: + dependency: "direct main" + description: + name: flutter_widget_from_html + sha256: "8d2a9a7979a9c1a5d866d1f4134d2ec2cca78716c112c76803d6a552281405cc" + url: "https://pub.dev" + source: hosted + version: "0.10.6" + flutter_widget_from_html_core: + dependency: transitive + description: + name: flutter_widget_from_html_core + sha256: "22140caa191cb4bba0fe4d5e4ad875c7e8a9ba47d61517f56d733019cf76396d" + url: "https://pub.dev" + source: hosted + version: "0.10.6" frontend_server_client: dependency: transitive description: @@ -336,6 +416,54 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.0" + fwfh_cached_network_image: + dependency: transitive + description: + name: fwfh_cached_network_image + sha256: "3de22aa3a6943c968e0d9fbcba4463b3dbbf7103171d62c84b6c672fb83eebdf" + url: "https://pub.dev" + source: hosted + version: "0.7.0+7" + fwfh_chewie: + dependency: transitive + description: + name: fwfh_chewie + sha256: "0b51a1c976bb74da5e8e45d545c74cb54a7168ad3938dd77103a7aee485f55fa" + url: "https://pub.dev" + source: hosted + version: "0.7.1+4" + fwfh_just_audio: + dependency: transitive + description: + name: fwfh_just_audio + sha256: "237b93a4cb9f0495a4b51940f361adda2a5abd57231dd44f07459db00144a6cd" + url: "https://pub.dev" + source: hosted + version: "0.9.0+3" + fwfh_svg: + dependency: transitive + description: + name: fwfh_svg + sha256: "26df142c1784c29c3675ad0d37f589fc5c2173a14fc002d2c38cde3d0f117302" + url: "https://pub.dev" + source: hosted + version: "0.8.0+4" + fwfh_url_launcher: + dependency: transitive + description: + name: fwfh_url_launcher + sha256: "2a526c9819f74b4106ba2fba4dac79f0082deecd8d2c7011cd0471cb710e3eff" + url: "https://pub.dev" + source: hosted + version: "0.9.0+4" + fwfh_webview: + dependency: transitive + description: + name: fwfh_webview + sha256: "90a8dda0695403cf57abd7e8b83f6fb1f1a12933930a0bf9cac7cafb06e06a18" + url: "https://pub.dev" + source: hosted + version: "0.9.0+2" glob: dependency: transitive description: @@ -352,6 +480,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.1" + html: + dependency: transitive + description: + name: html + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + url: "https://pub.dev" + source: hosted + version: "0.15.4" http: dependency: transitive description: @@ -543,6 +679,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" + octo_image: + dependency: transitive + description: + name: octo_image + sha256: "45b40f99622f11901238e18d48f5f12ea36426d8eced9f4cbf58479c7aa2430d" + url: "https://pub.dev" + source: hosted + version: "2.0.0" openapi_generator: dependency: "direct dev" description: @@ -836,6 +980,22 @@ packages: url: "https://pub.dev" source: hosted version: "7.0.0" + sqflite: + dependency: transitive + description: + name: sqflite + sha256: "591f1602816e9c31377d5f008c2d9ef7b8aca8941c3f89cc5fd9d84da0c38a9a" + url: "https://pub.dev" + source: hosted + version: "2.3.0" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + sha256: "1b92f368f44b0dee2425bb861cfa17b6f6cf3961f762ff6f941d20b33355660a" + url: "https://pub.dev" + source: hosted + version: "2.5.0" stack_trace: dependency: transitive description: @@ -868,6 +1028,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + tab_container: + dependency: "direct main" + description: + name: tab_container + sha256: "05782d9364332a55a5615825f83fa2595d21c2876dee2374bd32ff8b1031ee1d" + url: "https://pub.dev" + source: hosted + version: "2.0.0" term_glyph: dependency: transitive description: @@ -900,6 +1076,70 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" + url_launcher: + dependency: transitive + description: + name: url_launcher + sha256: b1c9e98774adf8820c96fbc7ae3601231d324a7d5ebd8babe27b6dfac91357ba + url: "https://pub.dev" + source: hosted + version: "6.2.1" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "31222ffb0063171b526d3e569079cf1f8b294075ba323443fdc690842bfd4def" + url: "https://pub.dev" + source: hosted + version: "6.2.0" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "4ac97281cf60e2e8c5cc703b2b28528f9b50c8f7cebc71df6bdf0845f647268a" + url: "https://pub.dev" + source: hosted + version: "6.2.0" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: "9f2d390e096fdbe1e6e6256f97851e51afc2d9c423d3432f1d6a02a8a9a8b9fd" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 + url: "https://pub.dev" + source: hosted + version: "3.1.0" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "980e8d9af422f477be6948bdfb68df8433be71f5743a188968b0c1b887807e50" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "7754a1ad30ee896b265f8d14078b0513a4dba28d358eabb9d5f339886f4a1adc" + url: "https://pub.dev" + source: hosted + version: "3.1.0" uuid: dependency: transitive description: @@ -908,6 +1148,30 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.0" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: "0f0c746dd2d6254a0057218ff980fc7f5670fd0fcf5e4db38a490d31eed4ad43" + url: "https://pub.dev" + source: hosted + version: "1.1.9+1" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: "0edf6d630d1bfd5589114138ed8fada3234deacc37966bec033d3047c29248b7" + url: "https://pub.dev" + source: hosted + version: "1.1.9+1" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: d24333727332d9bd20990f1483af4e09abdb9b1fc7c3db940b56ab5c42790c26 + url: "https://pub.dev" + source: hosted + version: "1.1.9+1" vector_math: dependency: transitive description: @@ -916,6 +1180,46 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + video_player: + dependency: transitive + description: + name: video_player + sha256: "74b86e63529cf5885130c639d74cd2f9232e7c8a66cbecbddd1dcb9dbd060d1e" + url: "https://pub.dev" + source: hosted + version: "2.7.2" + video_player_android: + dependency: transitive + description: + name: video_player_android + sha256: "3fe89ab07fdbce786e7eb25b58532d6eaf189ceddc091cb66cba712f8d9e8e55" + url: "https://pub.dev" + source: hosted + version: "2.4.10" + video_player_avfoundation: + dependency: transitive + description: + name: video_player_avfoundation + sha256: "6387c2de77763b45104256b3b00b660089be4f909ded8631457dc11bf635e38f" + url: "https://pub.dev" + source: hosted + version: "2.5.0" + video_player_platform_interface: + dependency: transitive + description: + name: video_player_platform_interface + sha256: be72301bf2c0150ab35a8c34d66e5a99de525f6de1e8d27c0672b836fe48f73a + url: "https://pub.dev" + source: hosted + version: "6.2.1" + video_player_web: + dependency: transitive + description: + name: video_player_web + sha256: "2dd24f7ba46bfb5d070e9c795001db95e0ca5f2a3d025e98f287c10c9f0fd62f" + url: "https://pub.dev" + source: hosted + version: "2.1.1" vm_service: dependency: transitive description: @@ -924,6 +1228,22 @@ packages: url: "https://pub.dev" source: hosted version: "12.0.0" + wakelock_plus: + dependency: transitive + description: + name: wakelock_plus + sha256: f45a6c03aa3f8322e0a9d7f4a0482721c8789cb41d555407367650b8f9c26018 + url: "https://pub.dev" + source: hosted + version: "1.1.3" + wakelock_plus_platform_interface: + dependency: transitive + description: + name: wakelock_plus_platform_interface + sha256: "40fabed5da06caff0796dc638e1f07ee395fb18801fbff3255a2372db2d80385" + url: "https://pub.dev" + source: hosted + version: "1.1.0" watcher: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 825ad8f..5da4b87 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -62,6 +62,8 @@ dependencies: cupertino_icons: ^1.0.6 quill_html_editor: ^2.2.7 responsive_framework: ^1.1.1 + tab_container: ^2.0.0 + flutter_widget_from_html: ^0.10.1 dev_dependencies: flutter_test: diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 7c2f20e..02129f5 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -7,8 +7,11 @@ #include "generated_plugin_registrant.h" #include +#include void RegisterPlugins(flutter::PluginRegistry* registry) { PasteboardPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("PasteboardPlugin")); + UrlLauncherWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 6414160..82731c9 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST pasteboard + url_launcher_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST