-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCourseDropDown.dart
57 lines (48 loc) · 1.49 KB
/
CourseDropDown.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import 'package:flutter/material.dart';
class CourseDropDown extends StatefulWidget {
String DropDescription;
List<String> courses;
String ?value;
CourseDropDown({required this.DropDescription, required this.courses, required this.value});
@override
_CourseDropDownState createState() => _CourseDropDownState();
}
class _CourseDropDownState extends State<CourseDropDown> {
@override
Widget build(BuildContext context) {
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 8.0),
child: Text(
widget.DropDescription,
style: TextStyle(
fontSize: 20,
),
),
),
Container(
decoration: BoxDecoration(
// border: Border.all(color: Colors.black, width: 2)
),
child: DropdownButton<String>(
value: widget.value,
items: widget.courses.map(buildMenuItem).toList(),
onChanged: (value) => setState(() => this.widget.value = value),
),
),
],
),
);
}
DropdownMenuItem<String> buildMenuItem(String item) {
return DropdownMenuItem<String>(
value: item,
child: Text(
item,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
));
}
}