mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
push tab to run and handling automation
This commit is contained in:
@ -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;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
Reference in New Issue
Block a user