-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_drop_down.dart
60 lines (57 loc) · 1.7 KB
/
custom_drop_down.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
58
59
60
import 'package:flutter/material.dart';
import 'package:futara/controller/constants/size.dart';
import 'package:futara/view/widgets/my_text.dart';
class CustomDropDown extends StatelessWidget {
const CustomDropDown({
this.hintTittle,
this.dropVal,
this.source,
this.text,
this.dropDownColor,
this.textColor,
this.onChanged,
Key? key,
}) : super(key: key);
final String? hintTittle, text;
final String? dropVal;
final List<DropdownMenuItem<String>>? source;
final Color? textColor, dropDownColor;
final void Function(String id)? onChanged;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MyText(
title: (text ?? ''),
color: textColor ?? Colors.black,
),
6.h,
Container(
height: 50,
padding: const EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
color: dropDownColor,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.grey, width: .5)),
child: DropdownButton<String>(
value: dropVal! == '' ? null : dropVal!,
isExpanded: true,
hint: MyText(
title: (hintTittle ?? ''),
color: Colors.grey[600],
),
underline: Container(),
onChanged: (v) {
if (onChanged != null) onChanged!(v!);
},
items: source,
),
),
],
),
);
}
}