Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. class _DropDownState extends State<DropDown> {
  2.  
  3. final formkey = new GlobalKey<FormState>();
  4.  
  5. String depart;
  6. String destination;
  7. String poids;
  8. String dimensions;
  9. String nomDest;
  10. String prenomDest;
  11. String emailDest;
  12. String telephone;
  13. String quartier;
  14. String precision;
  15.  
  16.  
  17. mailValidation(){
  18. if (validateAndSave()){
  19. _showDialogVerif('Vérification et validation',
  20. "Les informations que vous avez entrées sont les suivantes:" 'nn'
  21. "Nom dest: "+nomDest+ 'nn'
  22. "Prénom dest: "+prenomDest+ 'nn'
  23. "Téléphone dest: "+telephone+ 'nn'
  24. "Quartier dest: "+quartier+ 'nn'
  25. "Précison: "+precision+ 'nn'
  26.  
  27.  
  28. "Bien vouloir CONFIRMER si vous etes d'accord, si non appuyez sur RETOUR pour modifier",
  29.  
  30. );
  31. }
  32. }
  33. bool validateAndSave(){
  34. final form = formkey.currentState;
  35. if (form.validate()){
  36. form.save();
  37. return true;
  38. }
  39. return false;
  40. }
  41.  
  42. // Here we're going to define the LIST
  43.  
  44. List _citiesdept = ["Douala","Yaoundé"];
  45. List _citiesarriv = ["Douala","Yaoundé"];
  46. List _weight = ["0-1 KG","1-3 KG","3-5 KG"];
  47. List _dimensions = ["A5","A4","A3","A2"];
  48.  
  49. // End
  50. var resultsList = new List.filled(4, "");
  51.  
  52. @override
  53. void initState(){
  54. // Here we're going to set the initial values
  55.  
  56. resultsList[0] = "Douala";
  57. resultsList[1] = "Douala";
  58. resultsList[2] = "0-1 KG";
  59. resultsList[3] = "A5";
  60.  
  61. return super.initState();
  62. }
  63.  
  64. _fieldDropDown(List theList, int resultPosition, var dbField) {
  65.  
  66. return new FormField(
  67.  
  68. builder: (FormFieldState state) {
  69.  
  70. return InputDecorator(
  71.  
  72. decoration: InputDecoration(),
  73.  
  74. child: new DropdownButtonHideUnderline(
  75.  
  76. child: new DropdownButton(
  77.  
  78. value: this.resultsList[resultPosition],
  79.  
  80. isDense: true,
  81.  
  82. onChanged: (dynamic newValue) {
  83.  
  84. setState(() {
  85.  
  86. this.resultsList[resultPosition] = newValue;
  87.  
  88. state.didChange(newValue);
  89.  
  90. print(
  91.  
  92. 'The List result = ' + this.resultsList[resultPosition]);
  93.  
  94. //write newValue to a database field, which can be used in the override init to set the field originally
  95.  
  96. });
  97.  
  98. },
  99.  
  100. // Comment to remove Error
  101.  
  102. items: theList.map((dynamic value) {
  103.  
  104. return new DropdownMenuItem(
  105.  
  106. value: value,
  107.  
  108. child: new Text(value),
  109.  
  110. );
  111.  
  112. }).toList(),
  113.  
  114. ),
  115.  
  116. ),
  117.  
  118. );
  119.  
  120. },
  121.  
  122. );
  123.  
  124. }
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement