93 lines
2.7 KiB
Dart
93 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:manager_app/Components/rounded_button.dart';
|
|
import 'package:manager_app/Components/string_input_container.dart';
|
|
import 'package:manager_app/Components/translation_tab.dart';
|
|
import 'package:manager_app/constants.dart';
|
|
import 'package:managerapi/api.dart';
|
|
import 'package:collection/collection.dart';
|
|
|
|
showMultiStringInput (String text, List<TranslationDTO> values, List<TranslationDTO> newValues, Function onGetResult, int maxLines, BuildContext context) { /*Function onSelect,*/
|
|
showDialog(
|
|
builder: (BuildContext context) => AlertDialog(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(20.0))
|
|
),
|
|
title: Text(text),
|
|
content: SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
width: 500,
|
|
height: 200,
|
|
child: TranslationTab(
|
|
translations: newValues,
|
|
maxLines: maxLines
|
|
)
|
|
),
|
|
/*Column(
|
|
children: showValues(newValues),
|
|
),*/
|
|
],
|
|
)
|
|
),
|
|
actions: <Widget>[
|
|
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,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
), context: context
|
|
);
|
|
}
|
|
|
|
showValues(List<TranslationDTO> newValues) {
|
|
List<Widget> valuesToShow = new List<Widget>();
|
|
newValues.forEach((newValue) {
|
|
valuesToShow.add(
|
|
new StringInputContainer(
|
|
color: Colors.lightBlue,
|
|
label: newValue.language,
|
|
initialValue: newValue.value,
|
|
onChanged: (String value) {
|
|
newValue.value = value;
|
|
},
|
|
));
|
|
});
|
|
return valuesToShow;
|
|
}
|
|
|
|
|