在变量中获取我的下拉按钮的内容

时间:2019-04-22 21:39:47

标签: dart flutter

你好,我是一名学生,一个学徒,我试着将我的dropdownbutton的内容放在一个变量中,以便像我在照片上看到的那样在showDialog(_showDialogVerif)上获取所有信息。对于我所有的TextFormField。请帮助我。

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:" '\n\n'
      "Nom dest:   "+nomDest+ '\n\n'
      "Prénom dest:   "+prenomDest+ '\n\n'
      "Téléphone dest:   "+telephone+ '\n\n'
      "Quartier dest:   "+quartier+ '\n\n'
      "Précison:   "+precision+ '\n\n'


      "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(),

    ),

  ),

    );

  },

   );

 }
   }

你好,我是一名学生,一个学徒,我试着将我的dropdownbutton的内容放在一个变量中,以便像我在照片上看到的那样在showDialog(_showDialogVerif)上获取所有信息。对于我所有的TextFormField。请帮助我。

what I expected with dropdownbutton

0 个答案:

没有答案