Skip to content

Instantly share code, notes, and snippets.

@MisterJimson
Created July 7, 2020 15:38
Show Gist options
  • Save MisterJimson/9a882b46acf7a16f0bad18cc677dad85 to your computer and use it in GitHub Desktop.
Save MisterJimson/9a882b46acf7a16f0bad18cc677dad85 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatefulWidget {
@override
_MyWidgetState createState() => _MyWidgetState();
}
class _MyWidgetState extends State<MyWidget> {
String selected = 'value1';
@override
Widget build(BuildContext context) {
return DropdownButton<String>(
dropdownColor: Colors.blue,
style: TextStyle(color: Colors.white),
value: selected,
items: [
DropdownMenuItem(
value: 'value1',
child: Text('value1'),
),
DropdownMenuItem(
value: 'value2',
child: Text('value2'),
),
DropdownMenuItem(
value: 'value3',
child: Text('value3'),
),
],
onChanged: (newValue) {
setState(() {
selected = newValue;
});
},
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment