Add isTitle to 2000 char

This commit is contained in:
Fransolet Thomas 2022-08-18 18:13:23 +02:00
parent e3beb6c7f8
commit 025338ae9f
7 changed files with 39 additions and 16 deletions

View File

@ -9,7 +9,7 @@ import 'package:managerapi/api.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
showMultiStringInput (String label, String modalLabel, List<TranslationDTO> values, List<TranslationDTO> newValues, Function onGetResult, int maxLines, BuildContext context) { /*Function onSelect,*/ showMultiStringInput (String label, String modalLabel, bool isTitle, List<TranslationDTO> values, List<TranslationDTO> newValues, Function onGetResult, int maxLines, BuildContext context) { /*Function onSelect,*/
showDialog( showDialog(
builder: (BuildContext context) => AlertDialog( builder: (BuildContext context) => AlertDialog(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@ -23,7 +23,7 @@ showMultiStringInput (String label, String modalLabel, List<TranslationDTO> valu
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: getTranslations(context, Provider.of<AppContext>(context), label, newValues), children: getTranslations(context, Provider.of<AppContext>(context), label, isTitle, newValues),
), ),
), ),
), ),
@ -84,7 +84,7 @@ showMultiStringInput (String label, String modalLabel, List<TranslationDTO> valu
); );
} }
getTranslations(BuildContext context, AppContext appContext, String label, List<TranslationDTO> newValues) { getTranslations(BuildContext context, AppContext appContext, String label, bool isTitle, List<TranslationDTO> newValues) {
List<Widget> translations = <Widget>[]; List<Widget> translations = <Widget>[];
ManagerAppContext managerAppContext = appContext.getContext(); ManagerAppContext managerAppContext = appContext.getContext();
for(var language in managerAppContext.selectedConfiguration.languages) { for(var language in managerAppContext.selectedConfiguration.languages) {
@ -114,7 +114,7 @@ getTranslations(BuildContext context, AppContext appContext, String label, List<
TextFormInputContainer( TextFormInputContainer(
label: label, label: label,
color: kWhite, color: kWhite,
isTitle: true, isTitle: isTitle,
initialValue: newValues.where((element) => element.language == language).first.value, initialValue: newValues.where((element) => element.language == language).first.value,
onChanged: (value) { onChanged: (value) {
newValues.where((element) => element.language == language).first.value = value; newValues.where((element) => element.language == language).first.value = value;

View File

@ -13,6 +13,7 @@ class MultiStringContainer extends StatelessWidget {
final List<TranslationDTO> initialValue; final List<TranslationDTO> initialValue;
final Function onGetResult; final Function onGetResult;
final int maxLines; final int maxLines;
final bool isTitle;
const MultiStringContainer({ const MultiStringContainer({
Key key, Key key,
this.color = kSecond, this.color = kSecond,
@ -21,6 +22,7 @@ class MultiStringContainer extends StatelessWidget {
this.initialValue, this.initialValue,
this.onGetResult, this.onGetResult,
this.maxLines, this.maxLines,
this.isTitle,
}) : super(key: key); }) : super(key: key);
@override @override
@ -45,7 +47,7 @@ class MultiStringContainer extends StatelessWidget {
initialValue.forEach((value) { initialValue.forEach((value) {
newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(value)))); newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(value))));
}); });
showMultiStringInput(label, modalLabel, initialValue, newValues, onGetResult, maxLines, context); showMultiStringInput(label, modalLabel, isTitle, initialValue, newValues, onGetResult, maxLines, context);
}, },
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(

View File

@ -1,7 +1,10 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:manager_app/Components/check_input_container.dart'; import 'package:manager_app/Components/check_input_container.dart';
import 'package:manager_app/Components/multi_string_input_container.dart'; import 'package:manager_app/Components/multi_string_input_container.dart';
import 'package:manager_app/Components/text_form_input_container.dart';
import 'package:manager_app/Models/managerContext.dart';
import 'package:manager_app/Screens/Configurations/Section/SubSection/Slider/listView_card_image.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/Slider/listView_card_image.dart';
import 'package:manager_app/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart'; import 'package:manager_app/Screens/Configurations/Section/SubSection/Slider/new_update_image_slider.dart';
import 'package:manager_app/app_context.dart'; import 'package:manager_app/app_context.dart';
@ -77,12 +80,12 @@ class _ArticleConfigState extends State<ArticleConfig> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
// Bad
MultiStringContainer( MultiStringContainer(
label: "Contenu affiché:", label: "Contenu affiché:",
modalLabel: "Contenu", modalLabel: "Contenu",
color: kPrimaryColor, color: kPrimaryColor,
initialValue: articleDTO != null ? articleDTO.content : [], initialValue: articleDTO != null ? articleDTO.content : [],
isTitle: false,
onGetResult: (value) { onGetResult: (value) {
setState(() { setState(() {
if (articleDTO.content != value) { if (articleDTO.content != value) {

View File

@ -169,6 +169,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
} }
}, },
maxLines: 1, maxLines: 1,
isTitle: true,
), ),
MultiStringContainer( MultiStringContainer(
label: "Description affichée:", label: "Description affichée:",
@ -182,6 +183,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
} }
}, },
maxLines: 2, maxLines: 2,
isTitle: true,
), ),
], ],
), ),

View File

@ -5,6 +5,9 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
) )
list(APPEND FLUTTER_FFI_PLUGIN_LIST
)
set(PLUGIN_BUNDLED_LIBRARIES) set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST}) foreach(plugin ${FLUTTER_PLUGIN_LIST})
@ -13,3 +16,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin) endforeach(plugin)
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)

View File

@ -77,7 +77,7 @@ packages:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.15.0" version: "1.16.0"
convert: convert:
dependency: "direct main" dependency: "direct main"
description: description:
@ -126,7 +126,7 @@ packages:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.3.0"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
@ -218,7 +218,7 @@ packages:
name: js name: js
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.3" version: "0.6.4"
managerapi: managerapi:
dependency: "direct main" dependency: "direct main"
description: description:
@ -239,7 +239,7 @@ packages:
name: material_color_utilities name: material_color_utilities
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.3" version: "0.1.4"
material_segmented_control: material_segmented_control:
dependency: "direct main" dependency: "direct main"
description: description:
@ -281,7 +281,7 @@ packages:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.1"
path_parsing: path_parsing:
dependency: transitive dependency: transitive
description: description:
@ -363,7 +363,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.1" version: "1.8.2"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -398,7 +398,7 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.8" version: "0.4.9"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -412,7 +412,7 @@ packages:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" version: "2.1.2"
video_player: video_player:
dependency: "direct main" dependency: "direct main"
description: description:
@ -463,5 +463,5 @@ packages:
source: hosted source: hosted
version: "5.3.1" version: "5.3.1"
sdks: sdks:
dart: ">=2.15.0 <3.0.0" dart: ">=2.17.0-0 <3.0.0"
flutter: ">=2.10.0" flutter: ">=2.10.0"

View File

@ -5,6 +5,9 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
) )
list(APPEND FLUTTER_FFI_PLUGIN_LIST
)
set(PLUGIN_BUNDLED_LIBRARIES) set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST}) foreach(plugin ${FLUTTER_PLUGIN_LIST})
@ -13,3 +16,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin) endforeach(plugin)
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)