Created
May 2, 2022 14:44
-
-
Save romanejaquez/587328e1b484dba6ab2e18e781bb8b7a 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'; | |
const Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
body: Center( | |
child: MyWidget(), | |
), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatefulWidget { | |
MyWidgetState createState() => MyWidgetState(); | |
} | |
class MyWidgetState extends State<MyWidget> { | |
String dropdownvalue1 = '--'; | |
String dropdownvalue2 = '--'; | |
@override | |
Widget build(BuildContext context) { | |
return Column( | |
children: [ | |
DropdownButton<String>( | |
value: dropdownvalue1, | |
items: <String>['--','A', 'B', 'C', 'D'] | |
.map((String value) { | |
return DropdownMenuItem<String>( | |
value: value, | |
child: Text(value), | |
); | |
}).toList(), | |
onChanged: (String? newValue) { | |
setState(() { | |
dropdownvalue1 = newValue!; | |
}); | |
}), | |
DropdownButton<String>( | |
value: dropdownvalue2, | |
items: <String>['--','E', 'F', 'G', 'H'] | |
.map((String value) { | |
return DropdownMenuItem<String>( | |
value: value, | |
child: Text(value), | |
); | |
}).toList(), | |
onChanged: (String? newValue) { | |
setState(() { | |
dropdownvalue2 = newValue!; | |
}); | |
}), | |
], | |
); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment