Last active
May 20, 2020 00:34
-
-
Save fdenisnascimento/991cadce93ac37edca7d3048393914ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class Denis extends StatelessWidget { | |
final Map<String, String> states = { | |
"AC": "Acre", | |
"AL": "Alagoas", | |
"AP": "Amapá", | |
"AM": "Amazonas", | |
"BA": "Bahia", | |
"CE": "Ceará", | |
"DF": "Distrito Federal", | |
"ES": "Espírito Santo", | |
"GO": "Goiás", | |
"MA": "Maranhão", | |
"MT": "Mato Grosso", | |
"MS": "Mato Grosso do Sul", | |
"MG": "Minas Gerais", | |
"PR": "Paraná", | |
"PB": "Paraíba", | |
"PA": "Pará", | |
"PE": "Pernambuco", | |
"PI": "Piauí", | |
"RN": "Rio Grande do Norte", | |
"RS": "Rio Grande do Sul", | |
"RJ": "Rio de Janeiro", | |
"RO": "Rondônia", | |
"RR": "Roraima", | |
"SC": "Santa Catarina", | |
"SE": "Sergipe", | |
"SP": "São Paulo", | |
"TO": "Tocantins" | |
}; | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
child: DropdownButton( | |
value: 'MG', | |
items: states.entries.map<DropdownMenuItem<String>>((entry) { | |
return DropdownMenuItem( | |
value: entry.key, | |
child: Text(entry.value), | |
); | |
}).toList(), | |
onChanged: (value) => null, | |
), | |
); | |
} | |
} | |
//Quem está utilizando esse tipo de lista em Dart provavelmente vai querer exibir as informações em um Dropdown, então segue o código para isso: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment