Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class _DropDownState extends State<DropDown> {
- final formkey = new GlobalKey<FormState>();
- String depart;
- String destination;
- String poids;
- String dimensions;
- String nomDest;
- String prenomDest;
- String emailDest;
- String telephone;
- String quartier;
- String precision;
- mailValidation(){
- if (validateAndSave()){
- _showDialogVerif('Vérification et validation',
- "Les informations que vous avez entrées sont les suivantes:" 'nn'
- "Nom dest: "+nomDest+ 'nn'
- "Prénom dest: "+prenomDest+ 'nn'
- "Téléphone dest: "+telephone+ 'nn'
- "Quartier dest: "+quartier+ 'nn'
- "Précison: "+precision+ 'nn'
- "Bien vouloir CONFIRMER si vous etes d'accord, si non appuyez sur RETOUR pour modifier",
- );
- }
- }
- bool validateAndSave(){
- final form = formkey.currentState;
- if (form.validate()){
- form.save();
- return true;
- }
- return false;
- }
- // Here we're going to define the LIST
- List _citiesdept = ["Douala","Yaoundé"];
- List _citiesarriv = ["Douala","Yaoundé"];
- List _weight = ["0-1 KG","1-3 KG","3-5 KG"];
- List _dimensions = ["A5","A4","A3","A2"];
- // End
- var resultsList = new List.filled(4, "");
- @override
- void initState(){
- // Here we're going to set the initial values
- resultsList[0] = "Douala";
- resultsList[1] = "Douala";
- resultsList[2] = "0-1 KG";
- resultsList[3] = "A5";
- return super.initState();
- }
- _fieldDropDown(List theList, int resultPosition, var dbField) {
- return new FormField(
- builder: (FormFieldState state) {
- return InputDecorator(
- decoration: InputDecoration(),
- child: new DropdownButtonHideUnderline(
- child: new DropdownButton(
- value: this.resultsList[resultPosition],
- isDense: true,
- onChanged: (dynamic newValue) {
- setState(() {
- this.resultsList[resultPosition] = newValue;
- state.didChange(newValue);
- print(
- 'The List result = ' + this.resultsList[resultPosition]);
- //write newValue to a database field, which can be used in the override init to set the field originally
- });
- },
- // Comment to remove Error
- items: theList.map((dynamic value) {
- return new DropdownMenuItem(
- value: value,
- child: new Text(value),
- );
- }).toList(),
- ),
- ),
- );
- },
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement