-
Notifications
You must be signed in to change notification settings - Fork 0
/
customInputFeild.dart
48 lines (42 loc) · 1.26 KB
/
customInputFeild.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
import 'package:flutter/material.dart';
import 'package:movie_app/core/init/theme/color/color_theme.dart';
class CustomInputFeild extends StatefulWidget {
String? hintText;
IconData prefixIcon;
IconData? SuffixIcon;
CustomInputFeild({
Key? key,
this.hintText,
required this.prefixIcon,
this.SuffixIcon,
}) : super(key: key);
@override
State<CustomInputFeild> createState() => _CustomInputFeildState();
}
class _CustomInputFeildState extends State<CustomInputFeild> {
bool visible = true;
@override
Widget build(BuildContext context) {
return TextFormField(
obscureText: visible ? true : false,
style: TextStyle(
color: AppColors().grey, fontSize: 18, fontWeight: FontWeight.w500),
decoration: InputDecoration(
prefixIcon: Icon(widget.prefixIcon),
suffixIcon: widget.SuffixIcon != null
? GestureDetector(
child: visible
? const Icon(Icons.visibility_off)
: Icon(widget.SuffixIcon),
onTap: () {
setState(() {
visible = !visible;
});
},
)
: const SizedBox(),
hintText: widget.hintText ?? '',
),
);
}
}