diff --git a/lib/Components/message_notification.dart b/lib/Components/message_notification.dart index 70b84da..476b219 100644 --- a/lib/Components/message_notification.dart +++ b/lib/Components/message_notification.dart @@ -1,7 +1,18 @@ +import 'package:another_flushbar/flushbar.dart'; import 'package:flutter/material.dart'; -showNotification (Color backgroundColor, Color textColor, String text, BuildContext context, int? duration) { - final snackBar = SnackBar( +showNotification (Color backgroundColor, Color textColor, String text, BuildContext context, int? duration) async { + + await Flushbar( + message: text, + messageColor: textColor, + margin: EdgeInsets.all(8), + backgroundColor: backgroundColor, + borderRadius: BorderRadius.circular(8), + duration: duration == null ? Duration(milliseconds: 1500) : Duration(milliseconds: duration), + ).show(context); + + /*final snackBar = SnackBar( behavior: SnackBarBehavior.floating, duration: duration == null ? Duration(milliseconds: 1500) : Duration(milliseconds: duration), width: 320.0, // Width of the SnackBar. @@ -23,5 +34,5 @@ showNotification (Color backgroundColor, Color textColor, String text, BuildCont ), ) ); - ScaffoldMessenger.of(context).showSnackBar(snackBar); + ScaffoldMessenger.of(context).showSnackBar(snackBar);*/ } diff --git a/lib/Components/multi_string_input_html_modal.dart b/lib/Components/multi_string_input_html_modal.dart index 6d704b4..77fb744 100644 --- a/lib/Components/multi_string_input_html_modal.dart +++ b/lib/Components/multi_string_input_html_modal.dart @@ -9,6 +9,7 @@ import 'package:collection/collection.dart'; showMultiStringInputHTML (String label, String modalLabel, bool isTitle, List values, List newValues, Function onGetResult, int maxLines, List? resourceTypes, BuildContext context, bool isMandatory) { showDialog( + useRootNavigator: false, builder: (BuildContext context) { return AlertDialog( shape: RoundedRectangleBorder( @@ -70,6 +71,7 @@ showMultiStringInputHTML (String label, String modalLabel, bool isTitle, List values, List newValues, Function onGetResult, int maxLines, List? resourceTypes, BuildContext context) { showDialog( + useRootNavigator: false, builder: (BuildContext context) { return AlertDialog( shape: RoundedRectangleBorder( diff --git a/lib/Components/translation_input_container.dart b/lib/Components/translation_input_container.dart index 9b30324..7066113 100644 --- a/lib/Components/translation_input_container.dart +++ b/lib/Components/translation_input_container.dart @@ -2,12 +2,14 @@ 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/Components/resource_input_container.dart'; +import 'package:manager_app/Components/rounded_button.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'; +import 'message_notification.dart'; class _TranslationInputContainerState extends State with TickerProviderStateMixin { TabController? _tabController; @@ -201,30 +203,54 @@ class _TranslationInputContainerState extends State w ]; return Container( - height: widget.isTitle ? MediaQuery.of(context).size.height *0.35 : MediaQuery.of(context).size.height *0.53, + height: widget.isTitle ? MediaQuery.of(context).size.height *0.4 : 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(), + child: Column( + children: [ + 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.resourceTypes, widget.newValues, currentLanguage!) + ], + ), + ), + Center( + child: Container( + width: 370, + height: 70, + child: RoundedButton( + text: "Appliquer à toutes les langues", + icon: Icons.copy, + color: kSecond, + press: () async { + var plainText = await controllerQuill.getText(); + widget.newValues.forEach((language) { + language.value = plainText; + } + ); + showNotification(kSuccess, kWhite, 'Le texte a été appliqué à toutes les langues', context, null); + }, + fontSize: 20, ), ), - getTranslation(context, Provider.of(context), controllerQuill, customToolBarList, widget.isTitle, widget.resourceTypes, widget.newValues, currentLanguage!) - ], - ), + ), + ], ), ); } diff --git a/pubspec.lock b/pubspec.lock index 5d5acf0..f544c9d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -25,6 +25,14 @@ packages: url: "https://pub.dev" source: hosted version: "6.1.0" + another_flushbar: + dependency: "direct main" + description: + name: another_flushbar + sha256: "19bf9520230ec40b300aaf9dd2a8fefcb277b25ecd1c4838f530566965befc2a" + url: "https://pub.dev" + source: hosted + version: "1.12.30" archive: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 03cbef6..8b76cdf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -70,6 +70,7 @@ dependencies: flutter_widget_from_html: ^0.10.1 firebase_storage: ^12.0.1 firebase_core: ^3.1.0 + another_flushbar: ^1.12.30 dev_dependencies: flutter_test: