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';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
showNotification (Color backgroundColor, Color textColor, String text, BuildContext context, int? duration) {
|
showNotification (Color backgroundColor, Color textColor, String text, BuildContext context, int? duration) async {
|
||||||
final snackBar = SnackBar(
|
|
||||||
|
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,
|
behavior: SnackBarBehavior.floating,
|
||||||
duration: duration == null ? Duration(milliseconds: 1500) : Duration(milliseconds: duration),
|
duration: duration == null ? Duration(milliseconds: 1500) : Duration(milliseconds: duration),
|
||||||
width: 320.0, // Width of the SnackBar.
|
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) {
|
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(
|
showDialog(
|
||||||
|
useRootNavigator: false,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
shape: RoundedRectangleBorder(
|
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) {
|
showMultiStringInputAndResourceHTML (String label, String modalLabel, bool isTitle, List<TranslationAndResourceDTO> values, List<TranslationAndResourceDTO> newValues, Function onGetResult, int maxLines, List<ResourceType>? resourceTypes, BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
|
useRootNavigator: false,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
|
|||||||
@ -2,12 +2,14 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:manager_api_new/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
import 'package:manager_app/Components/audio_input_container.dart';
|
import 'package:manager_app/Components/audio_input_container.dart';
|
||||||
import 'package:manager_app/Components/resource_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/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:quill_html_editor/quill_html_editor.dart';
|
import 'package:quill_html_editor/quill_html_editor.dart';
|
||||||
|
|
||||||
import 'flag_decoration.dart';
|
import 'flag_decoration.dart';
|
||||||
|
import 'message_notification.dart';
|
||||||
|
|
||||||
class _TranslationInputContainerState extends State<TranslationInputContainer> with TickerProviderStateMixin {
|
class _TranslationInputContainerState extends State<TranslationInputContainer> with TickerProviderStateMixin {
|
||||||
TabController? _tabController;
|
TabController? _tabController;
|
||||||
@ -201,30 +203,54 @@ class _TranslationInputContainerState extends State<TranslationInputContainer> w
|
|||||||
];
|
];
|
||||||
|
|
||||||
return Container(
|
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,
|
width: MediaQuery.of(context).size.width *0.7,
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
minHeight: 200,
|
minHeight: 200,
|
||||||
minWidth: 300
|
minWidth: 300
|
||||||
),
|
),
|
||||||
child: DefaultTabController(
|
child: Column(
|
||||||
length: widget.newValues.length,
|
children: [
|
||||||
child: Column(
|
DefaultTabController(
|
||||||
children: [
|
length: widget.newValues.length,
|
||||||
RotatedBox(
|
child: Column(
|
||||||
quarterTurns: 0, // Can be used to test vertical tab in case of smaller screen
|
children: [
|
||||||
child: TabBar(
|
RotatedBox(
|
||||||
indicatorColor: kPrimaryColor,
|
quarterTurns: 0, // Can be used to test vertical tab in case of smaller screen
|
||||||
//overlayColor: MaterialStateProperty().c,
|
child: TabBar(
|
||||||
labelColor: kPrimaryColor,
|
indicatorColor: kPrimaryColor,
|
||||||
unselectedLabelColor: Colors.black,
|
//overlayColor: MaterialStateProperty().c,
|
||||||
controller: _tabController,
|
labelColor: kPrimaryColor,
|
||||||
tabs: widget.newValues.map((v) => Tab(icon: FlagDecoration(language: v.language!))).toList(), // text: v.language!.toUpperCase(),
|
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<AppContext>(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<AppContext>(context), controllerQuill, customToolBarList, widget.isTitle, widget.resourceTypes, widget.newValues, currentLanguage!)
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.1.0"
|
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:
|
archive:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -70,6 +70,7 @@ dependencies:
|
|||||||
flutter_widget_from_html: ^0.10.1
|
flutter_widget_from_html: ^0.10.1
|
||||||
firebase_storage: ^12.0.1
|
firebase_storage: ^12.0.1
|
||||||
firebase_core: ^3.1.0
|
firebase_core: ^3.1.0
|
||||||
|
another_flushbar: ^1.12.30
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user