Add languages multi select dialog
This commit is contained in:
parent
85db23ee76
commit
5b0f9cc954
78
lib/Components/multi_select_dropdown_container.dart
Normal file
78
lib/Components/multi_select_dropdown_container.dart
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:manager_app/constants.dart';
|
||||||
|
import 'package:multi_select_flutter/chip_display/multi_select_chip_display.dart';
|
||||||
|
import 'package:multi_select_flutter/dialog/multi_select_dialog_field.dart';
|
||||||
|
import 'package:multi_select_flutter/util/multi_select_item.dart';
|
||||||
|
import 'package:multi_select_flutter/util/multi_select_list_type.dart';
|
||||||
|
|
||||||
|
import 'message_notification.dart';
|
||||||
|
|
||||||
|
class MultiSelectDropdownContainer extends StatelessWidget {
|
||||||
|
final Color color;
|
||||||
|
final String label;
|
||||||
|
final List<String> values;
|
||||||
|
final List<String> initialValue;
|
||||||
|
final bool isMultiple;
|
||||||
|
final bool isAtLeastOne;
|
||||||
|
final ValueChanged<List<dynamic>> onChanged;
|
||||||
|
const MultiSelectDropdownContainer({
|
||||||
|
Key key,
|
||||||
|
this.color = kSecond,
|
||||||
|
this.label,
|
||||||
|
this.values,
|
||||||
|
this.initialValue,
|
||||||
|
this.isMultiple,
|
||||||
|
this.isAtLeastOne = false,
|
||||||
|
this.onChanged,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Size size = MediaQuery.of(context).size;
|
||||||
|
return Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Align(
|
||||||
|
alignment: AlignmentDirectional.centerStart,
|
||||||
|
child: Text(label, style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300))
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
child: Container(
|
||||||
|
width: size.width *0.2,
|
||||||
|
child: MultiSelectDialogField(
|
||||||
|
items: values.map((e) => MultiSelectItem(e, e)).toList(),
|
||||||
|
listType: MultiSelectListType.LIST,
|
||||||
|
cancelText: Text("Annuler"),
|
||||||
|
initialValue: initialValue,
|
||||||
|
buttonText: Text("Sélectionner"),
|
||||||
|
checkColor: Colors.white,
|
||||||
|
searchable: true,
|
||||||
|
chipDisplay: MultiSelectChipDisplay.none(),
|
||||||
|
selectedColor: kPrimaryColor,
|
||||||
|
title: Text("Veuillez sélectionner une langue"),
|
||||||
|
dialogHeight: size.height *0.4,
|
||||||
|
dialogWidth: size.width *0.2,
|
||||||
|
onConfirm: (values) {
|
||||||
|
print("do something");
|
||||||
|
//_selectedAnimals = values;
|
||||||
|
},
|
||||||
|
onSelectionChanged: (selectedList) {
|
||||||
|
onChanged(selectedList);
|
||||||
|
},
|
||||||
|
),/*MultiSelectDropdown(
|
||||||
|
values,
|
||||||
|
initialValue,
|
||||||
|
isMultiple,
|
||||||
|
isAtLeastOne,
|
||||||
|
onSelectionChanged: (selectedList) {
|
||||||
|
onChanged(selectedList);
|
||||||
|
},
|
||||||
|
)*/
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,6 +11,7 @@ import 'package:manager_app/Components/confirmation_dialog.dart';
|
|||||||
import 'package:manager_app/Components/loading_common.dart';
|
import 'package:manager_app/Components/loading_common.dart';
|
||||||
import 'package:manager_app/Components/message_notification.dart';
|
import 'package:manager_app/Components/message_notification.dart';
|
||||||
import 'package:manager_app/Components/multi_select_container.dart';
|
import 'package:manager_app/Components/multi_select_container.dart';
|
||||||
|
import 'package:manager_app/Components/multi_select_dropdown_container.dart';
|
||||||
import 'package:manager_app/Components/rounded_button.dart';
|
import 'package:manager_app/Components/rounded_button.dart';
|
||||||
import 'package:manager_app/Components/string_input_container.dart';
|
import 'package:manager_app/Components/string_input_container.dart';
|
||||||
import 'package:manager_app/Helpers/FileHelper.dart';
|
import 'package:manager_app/Helpers/FileHelper.dart';
|
||||||
@ -168,7 +169,7 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
|||||||
configurationDTO.label = value;
|
configurationDTO.label = value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
MultiSelectContainer(
|
MultiSelectDropdownContainer(
|
||||||
label: "Langues :",
|
label: "Langues :",
|
||||||
initialValue: configurationDTO.languages != null ? configurationDTO.languages: [],
|
initialValue: configurationDTO.languages != null ? configurationDTO.languages: [],
|
||||||
values: languages,
|
values: languages,
|
||||||
@ -180,6 +181,18 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
|||||||
//print(configurationDTO.languages);
|
//print(configurationDTO.languages);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
/*MultiSelectContainer(
|
||||||
|
label: "Langues :",
|
||||||
|
initialValue: configurationDTO.languages != null ? configurationDTO.languages: [],
|
||||||
|
values: languages,
|
||||||
|
isMultiple: true,
|
||||||
|
isAtLeastOne: true,
|
||||||
|
onChanged: (value) {
|
||||||
|
var tempOutput = new List<String>.from(value);
|
||||||
|
configurationDTO.languages = tempOutput;
|
||||||
|
//print(configurationDTO.languages);
|
||||||
|
},
|
||||||
|
),*/
|
||||||
CheckInputContainer(
|
CheckInputContainer(
|
||||||
icon: Icons.signal_wifi_off,
|
icon: Icons.signal_wifi_off,
|
||||||
label: "Hors ligne :",
|
label: "Hors ligne :",
|
||||||
|
|||||||
@ -15,7 +15,7 @@ const kSuccess = Color(0xFF8bc34a);
|
|||||||
|
|
||||||
const List<String> section_types = ["Map", "Slider", "Video", "Web", "Menu", "Quizz", "Article"];
|
const List<String> section_types = ["Map", "Slider", "Video", "Web", "Menu", "Quizz", "Article"];
|
||||||
const List<String> map_types = ["none", "normal", "satellite", "terrain", "hybrid"];
|
const List<String> map_types = ["none", "normal", "satellite", "terrain", "hybrid"];
|
||||||
const List<String> languages = ["FR", "NL", "EN", "DE"];
|
const List<String> languages = ["FR", "NL", "EN", "DE", "IT", "ES", "CN", "PL"];
|
||||||
const List<String> resource_types = ["image", "image url"]; // "video url" , "video",
|
const List<String> resource_types = ["image", "image url"]; // "video url" , "video",
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -254,6 +254,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.7.0"
|
version: "1.7.0"
|
||||||
|
multi_select_flutter:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: multi_select_flutter
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "4.1.2"
|
||||||
multiselect_formfield:
|
multiselect_formfield:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -42,6 +42,7 @@ dependencies:
|
|||||||
encrypt: ^5.0.0
|
encrypt: ^5.0.0
|
||||||
qr_flutter: ^4.0.0
|
qr_flutter: ^4.0.0
|
||||||
pdf: ^3.6.0
|
pdf: ^3.6.0
|
||||||
|
multi_select_flutter: ^4.1.2
|
||||||
#msix: ^2.1.3
|
#msix: ^2.1.3
|
||||||
#window_size:
|
#window_size:
|
||||||
# git:
|
# git:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user