Createaccount
Createaccount
dart';
import 'package:http/http.dart' as http;
import 'varconnect.dart';
@override
State<CreateAccount> createState() => _CreateAccountState();
}
//email verification
final RegExp emailRegex = RegExp(
r'^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$',
);
print(userdata);
setState(() {
msg = response.body;
});
}
verification()
{
bool namecheck = name.text.isEmpty;
String checkmail = email.text.trim();
bool isValidEmail = emailRegex.hasMatch(checkmail);
bool emptypass1 = pass1.text.isEmpty;
bool emptypass2 = pass1.text.isEmpty;
bool passcheck = identical(pass1.text, pass2.text);
else
{
setState(() {
msg = "Something wrong with your credential, please try again ";
});
}
}
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.only(top: 30,left: 10,right: 10,bottom: 5),
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.black12,
width: 2.0,
),
borderRadius: BorderRadius.circular(60.0),
color: Colors.black,
boxShadow: [
BoxShadow(
color: Colors.black26,
blurRadius: 5.0,
spreadRadius: 2.0,
offset: Offset(0, 3),
),
],
),
child: Padding(
padding: const EdgeInsets.all(40.0),
child: Column(
children: [
SizedBox(height: 30,),
Container(
child: Column(
children: [
Row(
children: [
Text('Name ',style: TextStyle(fontWeight:
FontWeight.bold,fontSize: 15,color: Colors.white),),
],
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0), // Adjust
the radius as needed
border: Border.all(
color: Colors.yellow, // Set the border color
width: 2.0, // Set the border width
),
),
child: TextField(
decoration: InputDecoration(
//labelText: 'Name',
border: InputBorder.none, // Remove the default
TextField border
contentPadding: EdgeInsets.symmetric(horizontal:
10.0), // Adjust the padding as needed
),
style: TextStyle(color: Colors.white),
controller: name
),
),
SizedBox(height: 30,),
Row(
children: [
Text('Email ',style: TextStyle(fontWeight:
FontWeight.bold,fontSize: 15,color: Colors.white),),
],
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0), // Adjust
the radius as needed
border: Border.all(
color: Colors.yellow, // Set the border color
width: 2.0, // Set the border width
),
),
child: TextField(
decoration: InputDecoration(
//labelText: 'Email',
border: InputBorder.none, // Remove the default
TextField border
contentPadding: EdgeInsets.symmetric(horizontal:
10.0), // Adjust the padding as needed
),
style: TextStyle(color: Colors.white),
controller: email
),
),
SizedBox(height: 30,),
Row(
children: [
Text('Password ',style: TextStyle(fontWeight:
FontWeight.bold,fontSize: 15,color: Colors.white),),
],
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0), // Adjust
the radius as needed
border: Border.all(
color: Colors.yellow, // Set the border color
width: 2.0, // Set the border width
),
),
child: TextField(
obscureText: _obscureText1,
decoration: InputDecoration(
//labelText: 'Password',
border: InputBorder.none, // Remove the default
TextField border
contentPadding: EdgeInsets.only(left: 10.0,top:
10.0),
//contentPadding: EdgeInsets.symmetric(horizontal:
10.0), // Adjust the padding as needed
suffixIcon: IconButton(
icon: Icon(
_obscureText1 ? Icons.visibility :
Icons.visibility_off,color: Colors.yellow,
),
onPressed: () {
setState(() {
_obscureText1 = !_obscureText1;
});
},
),
),
style: TextStyle(color: Colors.white),
controller: pass1
),
),
SizedBox(height: 30,),
Row(
children: [
Text('Confirm Password ',style: TextStyle(fontWeight:
FontWeight.bold,fontSize: 15,color: Colors.white),),
],
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0), // Adjust
the radius as needed
border: Border.all(
color: Colors.yellow, // Set the border color
width: 2.0, // Set the border width
),
),
child: TextField(
obscureText: _obscureText2,
decoration: InputDecoration(
//labelText: 'Password',
border: InputBorder.none, // Remove the default
TextField border
contentPadding: EdgeInsets.only(left: 10.0,top:
10.0), // Adjust the padding as needed
suffixIcon: IconButton(
icon: Icon(
_obscureText2 ? Icons.visibility :
Icons.visibility_off,
color: Colors.yellow,
),
onPressed: () {
setState(() {
_obscureText2 = !_obscureText2;
});
},
),
),
style: TextStyle(color: Colors.white),
controller: pass2
),
),
SizedBox(height: 30,),
Container(
width: 200,
height: 40,
child: ClipRRect(
borderRadius: BorderRadius.circular(100.0), // Set the
border radius
child: Container(
color: Colors.yellow,
child: TextButton(
onPressed: () async{
await verification();
name.text = "";
email.text = "";
pass1.text = "";
pass2.text = "";
],
),
),
],
),
),
),
),
),
);
}
}