push tab to run and handling automation

This commit is contained in:
ashrafzarkanisala
2024-11-24 23:07:03 +03:00
parent 87c47a74ce
commit 0c555cda83
13 changed files with 295 additions and 154 deletions

View File

@ -19,6 +19,7 @@ class StatefulTextField extends StatefulWidget {
this.icon,
this.hintColor,
required this.onChanged,
this.isRequired,
});
final String title;
@ -34,6 +35,7 @@ class StatefulTextField extends StatefulWidget {
final IconData? icon;
final Color? hintColor;
final Function(String)? onChanged;
final bool? isRequired;
@override
State<StatefulTextField> createState() => _StatefulTextFieldState();
@ -62,6 +64,7 @@ class _StatefulTextFieldState extends State<StatefulTextField> {
icon: widget.icon,
hintColor: widget.hintColor,
onChanged: widget.onChanged,
isRequired: widget.isRequired,
);
}
}
@ -82,6 +85,7 @@ class CustomTextField extends StatelessWidget {
this.icon,
this.hintColor,
required this.onChanged,
this.isRequired,
});
final String title;
@ -97,6 +101,7 @@ class CustomTextField extends StatelessWidget {
final IconData? icon;
final Color? hintColor;
final Function(String)? onChanged;
final bool? isRequired;
@override
Widget build(BuildContext context) {
@ -123,6 +128,7 @@ class CustomTextField extends StatelessWidget {
child: TextFormField(
controller: controller,
style: const TextStyle(color: Colors.black),
decoration: InputDecoration(
hintText: hintText,
hintStyle: TextStyle(
@ -140,6 +146,16 @@ class CustomTextField extends StatelessWidget {
onChanged: (value) {
onChanged!(value);
},
/// required validator
validator: (value) {
if (isRequired == true) {
if (value == null || value.isEmpty) {
return 'This field is required';
}
}
return null;
},
),
),
),