updated snackbar to flushbar + added copy to other languages
This commit is contained in:
parent
214fe574e6
commit
a9f9aa81e0
@ -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);*/
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import 'package:collection/collection.dart';
|
||||
|
||||
showMultiStringInputHTML (String label, String modalLabel, bool isTitle, List<TranslationDTO> values, List<TranslationDTO> newValues, Function onGetResult, int maxLines, List<ResourceType>? 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<Tr
|
||||
|
||||
showMultiStringInputAndResourceHTML (String label, String modalLabel, bool isTitle, List<TranslationAndResourceDTO> values, List<TranslationAndResourceDTO> newValues, Function onGetResult, int maxLines, List<ResourceType>? resourceTypes, BuildContext context) {
|
||||
showDialog(
|
||||
useRootNavigator: false,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
|
||||
@ -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<TranslationInputContainer> with TickerProviderStateMixin {
|
||||
TabController? _tabController;
|
||||
@ -201,13 +203,15 @@ class _TranslationInputContainerState extends State<TranslationInputContainer> 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(
|
||||
child: Column(
|
||||
children: [
|
||||
DefaultTabController(
|
||||
length: widget.newValues.length,
|
||||
child: Column(
|
||||
children: [
|
||||
@ -226,6 +230,28 @@ class _TranslationInputContainerState extends State<TranslationInputContainer> w
|
||||
],
|
||||
),
|
||||
),
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user