Commit 97acc590 authored by Ade Fikriatul  Ilmi's avatar Ade Fikriatul Ilmi

menambahkan kondisi no hp

parent 6e6511ba
...@@ -18,6 +18,9 @@ class ContactUs2 extends StatelessWidget { ...@@ -18,6 +18,9 @@ class ContactUs2 extends StatelessWidget {
final emailController = TextEditingController(); final emailController = TextEditingController();
final messageController = TextEditingController(); final messageController = TextEditingController();
String pattern =
r'(\+62|62|0)(\d{2,3})?\)?[ .-]?\d{2,4}[ .-]?\d{2,4}[ .-]?\d{2,4}';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var screenSize = MediaQuery.of(context).size; var screenSize = MediaQuery.of(context).size;
...@@ -186,6 +189,8 @@ class ContactUs2 extends StatelessWidget { ...@@ -186,6 +189,8 @@ class ContactUs2 extends StatelessWidget {
validator: (value) { validator: (value) {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return 'Please enter your phone number'; return 'Please enter your phone number';
} else if (!RegExp(pattern).hasMatch(value)) {
return 'Start with 628 or 08';
} }
return null; return null;
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment